Solved NPE?

Discussion in 'Spigot Plugin Development' started by gluebaby, Jun 5, 2016.

  1. Hey guys, I come with an error xD. I am a little embarrassed to post, because in all honesty it is probably a super simple error and I will feel like a nub. So here is the console log on startup:

    Code (Text):
    [10:14:04 INFO]: [CombatBeta] Enabling CombatBeta v1.0
    [10:14:04 ERROR]: Error occurred while enabling CombatBeta v1.0 (Is it up to date?)
        at me.undeadguppy.combatbeta.Main.onEnable( ~[?:?]
        at ~[spigot.jar:git-Spigot-db6de12-18fbb24]
        at [spigot.jar:git-Spigot-db6de12-18fbb24]
        at org.bukkit.plugin.SimplePluginManager.enablePlugin( [spigot.jar:git-Spigot-db6de12-18fbb24]
        at org.bukkit.craftbukkit.v1_8_R3.CraftServer.loadPlugin( [spigot.jar:git-Spigot-db6de12-18fbb24]
        at org.bukkit.craftbukkit.v1_8_R3.CraftServer.enablePlugins( [spigot.jar:git-Spigot-db6de12-18fbb24]
        at net.minecraft.server.v1_8_R3.MinecraftServer.s( [spigot.jar:git-Spigot-db6de12-18fbb24]
        at net.minecraft.server.v1_8_R3.MinecraftServer.k( [spigot.jar:git-Spigot-db6de12-18fbb24]
        at net.minecraft.server.v1_8_R3.MinecraftServer.a( [spigot.jar:git-Spigot-db6de12-18fbb24]
        at net.minecraft.server.v1_8_R3.DedicatedServer.init( [spigot.jar:git-Spigot-db6de12-18fbb24]
        at [spigot.jar:git-Spigot-db6de12-18fbb24]
        at [?:1.8.0_65]
    Its kind of odd, because recently all my plugins I have compiled have given me a similar error... I have a feeling its to do with a bad spigot.jar but I don't know. Any ideas?

    A few things I think it may be:
    - Having a corrupted spigot.jar
    - Having multiple commands in a CommandExecutor class (Not multiple booleans, just cmd.getName().
  2. Show us at line 21
  3. My entire main class (line 21 is getCommand("kit"):

    Code (Text):
    package me.undeadguppy.combatbeta;

    import org.bukkit.Bukkit;
    import org.bukkit.plugin.PluginManager;

    import me.undeadguppy.combatbeta.Commands.Kits;
    import me.undeadguppy.combatbeta.Commands.Shop;
    import me.undeadguppy.combatbeta.Listeners.DeathMessages;
    import me.undeadguppy.combatbeta.Listeners.JoinLeave;
    import me.undeadguppy.combatbeta.Listeners.MobDeath;
    import me.undeadguppy.combatbeta.Listeners.NoCash;

    public class Main extends JavaPlugin {

        Kits kit = new Kits();
        Shop shop = new Shop();
        PluginManager pm = Bukkit.getServer().getPluginManager();

        public void onEnable() {
            pm.registerEvents(new MobDeath(), this);
            pm.registerEvents(new NoCash(), this);
            pm.registerEvents(new JoinLeave(), this);
            pm.registerEvents(new DeathMessages(), this);
            if (Bukkit.getServer().getPluginManager().getPlugin("MineConomy") == null) {
                getLogger().severe("Disabled due to no dependancy found");


        public void onDisable() {


  4. Did you register the command "kit" in your plugin.yml? Also, don't register new commands with the same command executor, instead, use the aliases option in your plugin.yml.
  5. Just did that, and that seems to have fixed it. Thanks!