Solved My config keeps resting .

Discussion in 'Spigot Plugin Development' started by KingTux, May 10, 2016.

  1. My config keeps resting .
    I know it is because onEnable keeps being hit where else do i put it.

    Code (Text):

    package me.KingLinux01;

    import org.bukkit.command.Command;
    import org.bukkit.command.CommandSender;
    import org.bukkit.configuration.file.FileConfiguration;
    import org.bukkit.entity.Player;

    public class ServerInfo extends JavaPlugin {
       FileConfiguration config = getConfig();

       public void onEnable() {

         config.addDefault("Welcome to ServerInfo  The Plugin ", config);
         config.addDefault("website-link", "serverwebsite.domainname");
         config.addDefault("website-info", "WElcome to your server");


       public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
         Player player = (Player) sender;

         if (cmd.getName().equalsIgnoreCase("website")) {
      String Website = getConfig().getString("website-link");

         return false;



  2. #saveDefaultConfig();
  3. Do i need to remove anything?
  4. @KingLinux01 If your config keeps resting, he's probably tired.... Let him sleep.
    • Funny Funny x 1
  5. Move
    Code (Text):
    FileConfiguration config = getConfig();
    to inside the onEnable method.