Configuration reloading HELP

Discussion in 'Plugin Development' started by Cystalize, Aug 8, 2012.

  1. Offline

    Cystalize

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    I am trying to get my configuration to reload but I keep getting error messages in the console. The error is CommandException. I can't figure out how to fix it. I am getting the error from my commands class.

    Heres a little snippet:
    Code:
      public boolean onCommand(CommandSender arg0, Command arg1, String arg2, String[] arg3) {
         
         
            boolean op = false;
            if ((arg0 instanceof Player)) {
              Player player = (Player)arg0;
              op = player.isOp();
            }
            if (arg3.length == 1 && (arg3[0].equalsIgnoreCase("reload"))) {
              load();
              reloadConfig();
              log.info("[Spamicide]  Configuration reloaded");
              if (op) {
                arg0.sendMessage(ChatColor.RED + "[Spamicide]  " + ChatColor.GREEN + "Configuration reloaded");
              }
              return true;
            }
    The console is directing the error to the 'reloadConfig();' part. I'm not sure what's wrong with this. I am not getting any errors from Eclipse.

    Heres what I think it is: The main config settings are in the main class, which the command class is extending to (ProxyCommands extends Spamicide). I thought that extending it would mean that everything from Spamicide.class would be conjoined with ProxyCommands. Maybe I have to be more specific with what 'reloadConfig();' is?

    Am I going to have the move the whole main configuration to the commands class? If not, how could I fix this?
  2. Offline

    A5H73Y

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    remove load();
  3. Offline

    Cystalize

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Nope :( I still got the same error on reloadConfig();
  4. Offline

    A5H73Y

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Add Final FileConfiguration config = this.getConfig();
    below onCommand
  5. Offline

    Cystalize

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    It told me that the config variable was not in use. Probably because this class extends to the class with the config
  6. Offline

    sensus12

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    }else if(commandLabel.equalsIgnoreCase"reload){

    this.reloadConfig()

    log.info("Config reloaded")

    }

Share This Page