I was making a plugin for my server that protects the plugins but it seems to be broken but i look at the code and it seems fine. what the prob? Code: [PluginSpy] loading PluginSpy v1.0 2012-05-08 22:58:31 [SEVERE] Error occurred while enabling PluginSpy v1.0 (Is it up to date?) java.lang.NullPointerException at me.robbcap.PluginSpy.PluginSpy.onEnable(PluginSpy.java:29) at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:215) at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:336) at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:381) at org.bukkit.craftbukkit.CraftServer.loadPlugin(CraftServer.java:250) at org.bukkit.craftbukkit.CraftServer.enablePlugins(CraftServer.java:232) at net.minecraft.server.MinecraftServer.t(MinecraftServer.java:371) at net.minecraft.server.MinecraftServer.a(MinecraftServer.java:358) at net.minecraft.server.MinecraftServer.init(MinecraftServer.java:187) at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:422) at net.minecraft.server.ThreadServerApplication.run(SourceFile:492) Code: package me.robbcap.PluginSpy; import org.bukkit.plugin.java.JavaPlugin; import java.util.logging.Logger; import org.bukkit.plugin.PluginDescriptionFile; public class PluginSpy extends JavaPlugin{ private Logger log; private PluginDescriptionFile description; private String prefix; @Override public void onEnable(){ log = Logger.getLogger("Minecraft"); description = getDescription(); prefix = "["+description.getName()+"] "; log("loading "+description.getFullName()); getCommand("pl").setExecutor(new CommandExecutor_Pl(this)); getCommand("plugins").setExecutor(new CommandExecutor_Plugins(this)); } @Override public void onDisable(){ log("disabled "+description.getFullName()); } public void log(String message){ log.info(prefix+message); } }
I guess this is line 29: Code: getCommand("plugins").setExecutor(new CommandExecutor_Plugins(this)); The only way for this to throw a NPE is if getCommand returns null, which happens for unknown commands. So I guess your plugin.yml is invalid, or you didn't put the correct one in the jar. Could you please post your plugin.yml?
Code: name: PluginSpy main: me.robbcap.PluginSpy.PluginSpy version: 1.0 author: robbcap description: > Makes players die when they type /pl or /plugins commands: plugins: description: Kills the players for typing /plugins pl: description: Kills the player for typing /pl
Can you try to rename the commands to find out whether it's an issue with overriding default Bukkit commands? If this is the case you can still use PlayerCommandPreProcessEvent to block these commands.