File cannot be null error. Please help.

Discussion in 'Plugin Development' started by Cyber_Pigeon, Aug 19, 2014.

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

    Cyber_Pigeon

    I have been searching for hours online, reaserching threads with the same error I am getting, and none of their fixes worked for me. Can anyone help me? Here is the stacktrace: http://gyazo.com/1b3dd9bb311f6220f6f388aee8332de9

    Main class:
    Code:
    package me.mono;
     
    import org.bukkit.Bukkit;
    import org.bukkit.configuration.file.FileConfiguration;
    import org.bukkit.plugin.PluginManager;
    import org.bukkit.plugin.java.JavaPlugin;
     
    import CommandHandlers.BanCommand;
    import CommandHandlers.BanInfoCommand;
    import CommandHandlers.BanLogin;
    import CommandHandlers.CommandHandlerMethods;
    import CommandHandlers.KickCommand;
    import CommandHandlers.TempBanCommand;
    import CommandHandlers.UnbanCommand;
     
    public class Main extends JavaPlugin
    {
      FileConfiguration config = getConfig();
     
     
      public void onEnable()
      {
        PluginManager pm = getServer().getPluginManager();
        pm.registerEvents(new BanLogin(this), this);
        getCommand("bh").setExecutor(new CommandHandlerMethods(this));
        getCommand("ban").setExecutor(new BanCommand(this));
        getCommand("banip").setExecutor(new BanCommand(this));
        getCommand("kick").setExecutor(new KickCommand(this));
        getCommand("tempban").setExecutor(new TempBanCommand(this));
        getCommand("baninfo").setExecutor(new BanInfoCommand(this));
        getCommand("unban").setExecutor(new UnbanCommand(this));
     
        this.config.addDefault("Banned.Player.BanType", "Perm ban!");
        this.config.addDefault("Banned.Player.BannedBy", "Monollyth");
        this.config.addDefault("Banned.Player.Reason", "Hacking");
        this.config.addDefault("Banned.Player.Length", "Permanent");
        this.config.addDefault("Kicked.Player.Times", Integer.valueOf(10));
     
        this.config.options().copyDefaults(false);
        saveConfig();
     
        Bukkit.getLogger().info(getName() + " has been enabled...");
      }
    }
    
    (It says the error is in the main class)


     
  2. Offline

    stormneo7

    Do you have a config.yml in the same directory as the plugin.yml?
     
  3. Offline

    Cyber_Pigeon

    Nevermind guys, I fixed it myself, I never called a loadConfig() method in my main class.
     
Thread Status:
Not open for further replies.

Share This Page