Solved Nullpointexceptionerror

Discussion in 'Plugin Development' started by xepisolonxx, May 11, 2014.

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

    xepisolonxx

    Main class
    Code:
    public class Main extends JavaPlugin implements Listener{
       
        SettingsManager settings = SettingsManager.getInstance();
       
        private Logger log = Logger.getLogger("Minecraft");
     
        public void onEnable(){
            PluginManager pm = getServer().getPluginManager();
     
              log.info("[eCommon] is now enabled!");
     
            settings.setup(this);
     
            pm.registerEvents(this, this);
            pm.registerEvents(new Chat(this), this);
            pm.registerEvents(new Killstreaks(), this);
            pm.registerEvents(new Admin(), this);
            pm.registerEvents(new Gameplay(this), this);
           
            getCommand("cchat").setExecutor(new Cchat());
            getCommand("spawn").setExecutor(new Spawn(this));
            getCommand("admin").setExecutor(new Admin());
            getCommand("warp").setExecutor(new Warp(this));
            getCommand("reply").setExecutor(new Reply());
            getCommand("unban").setExecutor(new Unban());
            getCommand("taunt").setExecutor(new Taunt(this));
            getCommand("broadcast").setExecutor(new Broadcast());
            getCommand("setspawn").setExecutor(new Setspawn());
            getCommand("suicide").setExecutor(new Suicide());
            getCommand("message").setExecutor(new Message());
            getCommand("delwarp").setExecutor(new Delwarp());
            getCommand("setwarp").setExecutor(new Setwarp());
            getCommand("leave").setExecutor(new Leave());
            getCommand("join").setExecutor(new Join());
            getCommand("health").setExecutor(new Health());
            getCommand("fw").setExecutor(new Fw(this));
            getCommand("inv").setExecutor(new Inventory());
            getCommand("setpvp").setExecutor(new Pvp());
            getCommand("head").setExecutor(new Head());
            getCommand("silent").setExecutor(new Silent());
            getCommand("kick").setExecutor(new Kick());       
        }
        }
    Command class
    Code:
    package me.jr.main.commands;
     
    import org.bukkit.Bukkit;
    import org.bukkit.ChatColor;
    import org.bukkit.OfflinePlayer;
    import org.bukkit.command.Command;
    import org.bukkit.command.CommandExecutor;
    import org.bukkit.command.CommandSender;
    import org.bukkit.entity.Player;
     
    public class Unban implements CommandExecutor{
     
        public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args){
           
            if (cmd.getName().equalsIgnoreCase("unban") && args.length== 0){
                sender.sendMessage(ChatColor.RED + "Usage:" + " /unban <name>");
               
            }else if (cmd.getName().equalsIgnoreCase("unban") && args.length==1){
                if (sender instanceof Player){
                    if (sender.hasPermission("admin.unban")){
                        OfflinePlayer target = Bukkit.getOfflinePlayer(args[0]);
     
                        if(target !=null){
                        target.setBanned(false);
                        sender.sendMessage(ChatColor.GOLD + "You have unbanned " + ChatColor.WHITE + target.getName() + "!");
                            }   
                        }
                    }else{
                        OfflinePlayer target = Bukkit.getOfflinePlayer(args[0]);
     
                        if(target !=null){
                            target.setBanned(false);
                            sender.sendMessage(ChatColor.GOLD + "You have unbanned " + ChatColor.WHITE + target.getName() + "!");
     
                        }
                        }
                    }else if (cmd.getName().equalsIgnoreCase("unban") && args.length <=2){
                        if (sender instanceof Player){
                        if (sender.hasPermission("admin.unban")){
     
                            sender.sendMessage(ChatColor.RED + "Usage:" + " /unban <name>");
                        }   
                        }else{
                            sender.sendMessage(ChatColor.RED + "Usage:" + " /unban <name>");
                        }
                    }
            return false;
           
            }
        }
     
  2. Offline

    Nghtmr9999

    Do you have a stacktrace?
     
  3. Offline

    xepisolonxx

    Code:
    Loading libraries, please wait...
     
    [13:56:07 INFO]: Starting minecraft server version 1.7.2
     
    [13:56:07 INFO]: Loading properties
     
    [13:56:07 INFO]: Default game type: SURVIVAL
     
    [13:56:07 INFO]: Generating keypair
     
    [13:56:08 INFO]: Starting Minecraft server on *:25565
     
    [13:56:08 INFO]: This server is running CraftBukkit version git-Bukkit-1.7.2-R0.
     
    3-b3020jnks (MC: 1.7.2) (Implementing API version 1.7.2-R0.3)
     
    [13:56:09 INFO]: [GroupManager] Loading GroupManager v2.0 (2.12.1) (Phoenix)
     
    [13:56:09 INFO]: [WorldEdit] Loading WorldEdit v5.5.8
     
    [13:56:09 INFO]: [eKits] Loading eKits v1.0
     
    [13:56:09 INFO]: [eCommon] Loading eCommon v1.0
     
    [13:56:09 INFO]: Preparing level "world"
     
    [13:56:09 INFO]: Preparing start region for level 0 (Seed: 8201323975223267374)
     
    [13:56:10 INFO]: ----- Bukkit Auto Updater -----
     
    [13:56:10 INFO]: It appears that you're running a Beta Build, when you've specif
     
    ied in bukkit.yml that you prefer to run Recommended Builds.
     
    [13:56:10 INFO]: If you would like to be kept informed about new Beta Build rele
     
    ases, it is recommended that you change 'preferred-channel' in your bukkit.yml t
     
    o 'beta'.
     
    [13:56:10 INFO]: With that set, you will be told whenever a new version is avail
     
    able for download, so that you can always keep up to date and secure with the la
     
    test fixes.
     
    [13:56:10 INFO]: If you would like to disable this warning, simply set 'suggest-
     
    channels' to false in bukkit.yml.
     
    [13:56:10 INFO]: ----- ------------------- -----
     
    [13:56:10 INFO]: Preparing spawn area: 44%
     
    [13:56:11 INFO]: [GroupManager] Enabling GroupManager v2.0 (2.12.1) (Phoenix)
     
    [13:56:11 INFO]: GroupManager - INFO - World Found: world
     
    [13:56:11 INFO]: GroupManager - INFO - Superperms support enabled.
     
    [13:56:11 INFO]: GroupManager - INFO - Scheduled Data Saving is set for every 10
     
    minutes!
     
    [13:56:11 INFO]: GroupManager - INFO - Backups will be retained for 24 hours!
     
    [13:56:11 INFO]: GroupManager version 2.0 (2.12.1) (Phoenix) is enabled!
     
    [13:56:11 INFO]: [WorldEdit] Enabling WorldEdit v5.5.8
     
    [13:56:11 INFO]: WEPIF: GroupManager detected! Using GroupManager for permission
     
    s.
     
    [13:56:11 INFO]: [eKits] Enabling eKits v1.0
     
    [13:56:11 INFO]: [eKits] has been enabled!
     
    [13:56:11 INFO]: [eCommon] Enabling eCommon v1.0
     
    [13:56:11 INFO]: [eCommon] is now enabled!
     
    [13:56:11 ERROR]: Error occurred while enabling eCommon v1.0 (Is it up to date?)
     
     
     
    java.lang.NullPointerException
     
    at me.jr.main.Main.onEnable(Main.java:61) ~[?:?]
     
    at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:250) ~[c
     
    raftbukkit.jar:git-Bukkit-1.7.2-R0.3-b3020jnks]
     
    at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader
     
    .java:350) [craftbukkit.jar:git-Bukkit-1.7.2-R0.3-b3020jnks]
     
    at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManage
     
    r.java:389) [craftbukkit.jar:git-Bukkit-1.7.2-R0.3-b3020jnks]
     
    at org.bukkit.craftbukkit.v1_7_R1.CraftServer.loadPlugin(CraftServer.jav
     
    a:439) [craftbukkit.jar:git-Bukkit-1.7.2-R0.3-b3020jnks]
     
    at org.bukkit.craftbukkit.v1_7_R1.CraftServer.enablePlugins(CraftServer.
     
    java:375) [craftbukkit.jar:git-Bukkit-1.7.2-R0.3-b3020jnks]
     
    at net.minecraft.server.v1_7_R1.MinecraftServer.m(MinecraftServer.java:3
     
    42) [craftbukkit.jar:git-Bukkit-1.7.2-R0.3-b3020jnks]
     
    at net.minecraft.server.v1_7_R1.MinecraftServer.g(MinecraftServer.java:3
     
    19) [craftbukkit.jar:git-Bukkit-1.7.2-R0.3-b3020jnks]
     
    at net.minecraft.server.v1_7_R1.MinecraftServer.a(MinecraftServer.java:2
     
    75) [craftbukkit.jar:git-Bukkit-1.7.2-R0.3-b3020jnks]
     
    at net.minecraft.server.v1_7_R1.DedicatedServer.init(DedicatedServer.jav
     
    a:175) [craftbukkit.jar:git-Bukkit-1.7.2-R0.3-b3020jnks]
     
    at net.minecraft.server.v1_7_R1.MinecraftServer.run(MinecraftServer.java
     
    :424) [craftbukkit.jar:git-Bukkit-1.7.2-R0.3-b3020jnks]
     
    at net.minecraft.server.v1_7_R1.ThreadServerApplication.run(SourceFile:6
     
    17) [craftbukkit.jar:git-Bukkit-1.7.2-R0.3-b3020jnks]
     
    [13:56:11 INFO]: Server permissions file permissions.yml is empty, ignoring it
     
    [13:56:11 INFO]: Done (2.314s)! For help, type "help" or "?"
     
    [13:56:11 INFO]: GroupManager - INFO - Bukkit Permissions Updated!
     
    >
    Line 61
    Code:
            getCommand("unban").setExecutor(new Unban());
    
     
  4. Offline

    Nghtmr9999

    Do you have that command registered in the plugin.yml?
     
  5. Offline

    Rocoty

    You can't seriously expect to get help when you don't even bother to take your time to explain your problem...?
     
  6. Offline

    dentych

    Rocoty likes this.
  7. Offline

    xepisolonxx

    omg thank you i just relooked and noticed i had miss the "n" in unban
     
Thread Status:
Not open for further replies.

Share This Page