[UNSOLVED] Configuration reloading errors... HELP D:

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

Thread Status:
Not open for further replies.
  1. Offline

    Cystalize

    So heres the error message coming from the console:

    Code:
    21:57:29 [SEVERE] Encountered an unexpected exception CommandException
    org.bukkit.command.CommandException: Unhandled exception executing command 'spam' in plugin Spamicide v0.1
        at org.bukkit.command.PluginCommand.execute(PluginCommand.java:42)
        at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:168)
        at org.bukkit.craftbukkit.CraftServer.dispatchCommand(CraftServer.java:492)
        at org.bukkit.craftbukkit.CraftServer.dispatchServerCommand(CraftServer.java:488)
        at net.minecraft.server.DedicatedServer.ah(DedicatedServer.java:248)
        at net.minecraft.server.DedicatedServer.q(DedicatedServer.java:213)
        at net.minecraft.server.MinecraftServer.p(MinecraftServer.java:476)
        at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:408)
        at net.minecraft.server.ThreadServerApplication.run(SourceFile:539)
    Caused by: java.lang.IllegalArgumentException: File cannot be null
        at org.apache.commons.lang.Validate.notNull(Validate.java:203)
        at org.bukkit.configuration.file.YamlConfiguration.loadConfiguration(YamlConfiguration.java:170)
        at org.bukkit.plugin.java.JavaPlugin.reloadConfig(JavaPlugin.java:117)
        at me.arsinia.spamicide.Spamicide.onCommand(Spamicide.java:144)
        at org.bukkit.command.PluginCommand.execute(PluginCommand.java:40)
        ... 8 more
    
    It says check line 144 on my main class because the file is null or whatever..
    Heres the configuration/top half of my main class:

    Code:
    {
      static String dir = "plugins/Spamicide";
      static File SpamFile = new File(dir + File.separator + "BlockedWords.txt");
      static Properties prop = new Properties();
      ArrayList<String> ignored = new ArrayList<String>();
      ArrayList<String> Blocked = new ArrayList<String>();
      final String defaultBlocked = "Crap,Shit";
      private static final Logger log = Logger.getLogger("Minecraft");
     
     
     
     
     
      public void onEnable() { new SpamPlayerListener(this);
        FileConfiguration config = getConfig();
        config.options().header("DEFAULT SPAMICIDE CONFIGURATION");
        config.addDefault("ChatSettings.Percentage", Integer.valueOf(60));
        config.addDefault("ChatSettings.DetectIfGreaterThan", Integer.valueOf(5));
        config.addDefault("ChatSettings.CapsMessage", "TURN OFF YOUR CAPS!");
        config.addDefault("ChatSettings.ProfanityMessage", "You cannot say that!");
        config.addDefault("ChatSettings.LowerCase", Boolean.valueOf(true));
        config.addDefault("DoS/ProxySettings.MaxConnections", Integer.valueOf(5));
        config.addDefault("DoS/ProxySettings.LockdownOnStart", Boolean.valueOf(false));
        config.addDefault("DoS/ProxySettings.Throttle", Integer.valueOf(500));
        config.addDefault("DoS/ProxySettings.Bandwidth", Integer.valueOf(10240));
        config.addDefault("DoS/ProxySettings.Afk-Timeout", Integer.valueOf(20000));
        config.addDefault("DoS/ProxySettings.Port", Integer.valueOf(25565));
        config.addDefault("DoS/ProxySettings.Block-TOR", Boolean.valueOf(true));
        config.options().copyDefaults(true);
        saveConfig();
        load();
        log.info("[Spamicide]  Enabled");
        this.fepExec = new ProxyCommands(this);
        getCommand("spam").setExecutor(this.fepExec);
        int MaxConnections = getConfig().getInt("MaxConnections");
        int Throttle = getConfig().getInt("Throttle");
        int Bandwidth = getConfig().getInt("Bandwitdh");
        int Timeout = getConfig().getInt("Afk-Timeout");
        int Port = getConfig().getInt("port");
        this.isLocked = false;
        this.events = new ProxyEvents(this);
        this.events.RegisterEvents();
        if (this.listener == null) {
          System.out.println("[Spamicide]  Enabling proxy protection...");
          this.listener = new ProxyListener(this, Bandwidth, MaxConnections, Timeout, Throttle, Port);
          this.listener.start();
        }
      }
      public void onDisable() {
        log.info("[Spamicide]  Disabled");
        reloadConfig();
        if (this.isLocked)
          getConfig().set("LockdownOnStart", "true");
        else {
          getConfig().set("LockdownOnStart", "false");
        }
        saveConfig(); }
      public ArrayList<String> parseArray(String in, char delimiter)
      {
        ArrayList<String> parsed = new ArrayList<String>();
        String build = "";
        int count = 0;
        int len = in.length();
        while (count < len) {
          while ((count < len) && (in.charAt(count) != delimiter)) {
            build = build + in.charAt(count);
            count++;
          }
          parsed.add(build);
          build = "";
          count++;
        }
        return parsed;
      }
    And here is the part that's apparently null:

    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 ((arg1.getName().equalsIgnoreCase("spam")) &&
                ((op) || (arg0 instanceof ConsoleCommandSender)) &&
                (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;
            }
            return false;
      }

    Line 144 from the console error is the line that says 'reloadConfig();' Apparently that's null, but I just don't see how. Thanks to all who can help me out :3
     
Thread Status:
Not open for further replies.

Share This Page