Plugin Help Plugin Not Enabling Properly

Discussion in 'Plugin Help/Development/Requests' started by XxPvPKnightxX, Mar 28, 2016.

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

    XxPvPKnightxX

    Ignore the name of the plugin. I can send the jar if needed to decompile and review all the code. I get the following errors!

    Code:
    [22:53:21] [Server thread/INFO]: [StaffMode] Enabling StaffMode v1.0
    [22:53:21] [Server thread/ERROR]: Error occurred while enabling StaffMode v1.0 (Is it up to date?)
    java.lang.NullPointerException
        at com.lovely.staffmode.commands.StaffList.<init>(StaffList.java:22) ~[?:?]
        at com.lovely.staffmode.Main.registerCommands(Main.java:43) ~[?:?]
        at com.lovely.staffmode.Main.onEnable(Main.java:25) ~[?:?]
        at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:321) ~[spigot45.jar:git-Spigot-5f38d38-12698ea]
        at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:340) [spigot45.jar:git-Spigot-5f38d38-12698ea]
        at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:405) [spigot45.jar:git-Spigot-5f38d38-12698ea]
        at org.bukkit.craftbukkit.v1_8_R3.CraftServer.loadPlugin(CraftServer.java:357) [spigot45.jar:git-Spigot-5f38d38-12698ea]
        at org.bukkit.craftbukkit.v1_8_R3.CraftServer.enablePlugins(CraftServer.java:317) [spigot45.jar:git-Spigot-5f38d38-12698ea]
        at net.minecraft.server.v1_8_R3.MinecraftServer.s(MinecraftServer.java:414) [spigot45.jar:git-Spigot-5f38d38-12698ea]
        at net.minecraft.server.v1_8_R3.MinecraftServer.k(MinecraftServer.java:378) [spigot45.jar:git-Spigot-5f38d38-12698ea]
        at net.minecraft.server.v1_8_R3.MinecraftServer.a(MinecraftServer.java:333) [spigot45.jar:git-Spigot-5f38d38-12698ea]
        at net.minecraft.server.v1_8_R3.DedicatedServer.init(DedicatedServer.java:263) [spigot45.jar:git-Spigot-5f38d38-12698ea]
        at net.minecraft.server.v1_8_R3.MinecraftServer.run(MinecraftServer.java:525) [spigot45.jar:git-Spigot-5f38d38-12698ea]
        at java.lang.Thread.run(Thread.java:745) [?:1.8.0_72]


    Main Code:
    Code:
    package com.lovely.staffmode;
    
    import java.util.logging.Logger;
    
    import org.bukkit.plugin.PluginDescriptionFile;
    import org.bukkit.plugin.PluginManager;
    import org.bukkit.plugin.java.JavaPlugin;
    
    import com.lovely.staffmode.commands.Goodbye;
    import com.lovely.staffmode.commands.Hello;
    import com.lovely.staffmode.commands.StaffList;
    import com.lovely.staffmode.event.block.BlockBreak;
    import com.lovely.staffmode.event.block.Signs;
    import com.lovely.staffmode.event.player.PlayerChat;
    import com.lovely.staffmode.event.player.PlayerJoin;
    import com.lovely.staffmode.event.player.PlayerLeave;
    import com.lovely.staffmode.event.player.VanishUpdate;
    
    public class Main extends JavaPlugin {
      
        public void onEnable() {
            PluginDescriptionFile pdfFile = getDescription();
            Logger logger = Logger.getLogger("Minecraft");
          
        registerCommands();
        registerEvents();
        registerConfig();
          
            logger.info(pdfFile.getName() + " has been enabled " + pdfFile.getVersion());
        }
      
        public void onDisable() {
            PluginDescriptionFile pdfFile = getDescription();
            Logger logger = Logger.getLogger("Minecraft");
          
            logger.info(pdfFile.getName() + " has been disabled (V."
            + pdfFile.getVersion() + "(");
        }
      
        public void registerCommands() {
            getCommand("hello").setExecutor(new Hello(this));
            getCommand("goodbye").setExecutor(new Goodbye());
            getCommand("staff").setExecutor(new StaffList(this));
            getCommand("liststaff").setExecutor(new StaffList(this));
        }
      
        public void registerEvents() {
            PluginManager pm = getServer().getPluginManager();
          
            pm.registerEvents(new BlockBreak(), this);
            pm.registerEvents(new PlayerChat(), this);
            pm.registerEvents(new PlayerJoin(this), this);
            pm.registerEvents(new Signs(), this);
            pm.registerEvents(new PlayerLeave(this), this);
            pm.registerEvents(new VanishUpdate(this), this);
        }
        private void registerConfig() {
            getConfig().options().copyDefaults(true);
            saveConfig();
        }
    }
    Bump - still need help

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Mar 29, 2016
  2. Offline

    Scorpionvssub

    add the class commands/stafflist to this page as the error is related to that.
     
  3. Offline

    mcdorli

    1.: Don't learn from theBcBroz, they teach bad habits
    2.: No need for enable/disable messages, bukkit already handles that for you
    3.: Don't steal minecraft's logger, use simply getLogger
    4.: You didn't posted the correct class, the problem is in StaffList
     
  4. Offline

    Kilorbine

    I would say that you try to access to "staff" (l43) to set it an executor.
    The problem is that "staff" does not exist.
    It return null and you have an error
     
Thread Status:
Not open for further replies.

Share This Page