How to set a default path in a custom config? Like an MOTD?

Discussion in 'Spigot Plugin Development' started by kinukin, Jun 4, 2017.

  1. motd:

    How would I create something like an motd with no value in a custom config?
  2. I really don't understand what you mean but when it comes to storing a string such as a MOTD you can just hard code it (just code a set MOTD in the plugin) or make it editable by using a config. If you are having troubles with configs there are many tutorials out there to help you

    I think I know what you meant, you can do getConfig().setDefault("MOTD", "This Is The Message Of The Day!");

    But that's for defaults for strings I think there is a getConfig().setString("MOTD", "This Is The Message Of The Day!");
  3. I can't edit it inside the config, it keeps getting reset to its set string.
  4. Means you aren't updating and saving it right, try this on your onEnable or perhaps make a command that does this so you can reload it inside the server.

    Code (Text):
    getConfig().getKeys(false);    /*Comment: Can be true or false doesn't matter*/


  5. Check out this video from Pogostick29 where he creates a MOTD and adds a config.
    • Agree Agree x 1