Solved My plugin wont work! Internal Error!

Discussion in 'Plugin Help/Development/Requests' started by mrcreeper242, Apr 23, 2015.

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

    mrcreeper242

    When I load my plugin and type in one of the commands I get a internal error. My plugin works just fine on my home hosted server though. Here is the error on the console:

    Code:
    2015-04-23T18:27:51.347629625Z org.bukkit.command.CommandException: Unhandled exception executing command 'pixelized' in plugin Pixelized v1.0
    2015-04-23T18:27:51.347629625Z >
    [18:27:51 ERROR]: null
    Here is my plugin code:
    Code:
    package me.mrcreeper242;
    
    import net.md_5.bungee.api.ChatColor;
    import org.bukkit.command.Command;
    import org.bukkit.command.CommandSender;
    import org.bukkit.entity.Player;
    import org.bukkit.plugin.java.JavaPlugin;
    
    public class Pixelized extends JavaPlugin {
    
        @Override
        public void onEnable() {
           
        }
       
        @Override
        public void onDisable() {
       
        }
           
            @Override
            public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
           
            Player p = (Player) sender;
           
           
           
            if(cmd.getName().equalsIgnoreCase("Pixelized")) {
               
                if(args.length == 0) {
                   
                    p.sendMessage(ChatColor.RED + "List of Commands");
                    p.sendMessage(ChatColor.GREEN + "/pixelized info");
                    p.sendMessage(ChatColor.GREEN + "/pixelized web");
                    p.sendMessage(ChatColor.GREEN + "/pixelized warps"); }
               
               
                else if(args.length == 1) {
                   
                   
                    if(args[0].equalsIgnoreCase("info")) {
                       
                        p.sendMessage(ChatColor.RED + "This is a short description of Pixelized");
                   
                    }
                   
                    else if(args[0].equalsIgnoreCase("warps")) {
                       
                        p.sendMessage(ChatColor.RED + "None Yet.");
                       
                    }
                   
                    else if(args[0].equalsIgnoreCase("web")) {
                       
                        p.sendMessage(ChatColor.RED + "Here is the official Pixelized website:");
                        p.sendMessage(ChatColor.BLUE + "http://pixelized-network.enjin.com/");
                       
                    }
                   
                }
                   
               
                   
                   
               
            {
            return true;
               
           
        }
            }
            return false;
           
            }
       
    
            }
    
     
  2. Offline

    bwfcwalshy Retired Staff

    @mrcreeper242 Post full error. Check before casting. Why do you have a random open bracket?
     
    mine-care likes this.
  3. Offline

    Koobaczech

    Lmao i pasted the code into my plugin and it worked fine, all commands. Do this though
    Code:
    if ((sender instanceof Player)) {
              Player p = (Player)sender;
    And make sure you don't have any open brackets like washy said

    Spoil3r (open)

    Code:
     public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
           if ((sender instanceof Player)) {
              final Player p = (Player)sender;
              if(cmd.getName().equalsIgnoreCase("Pixelized")) {
                  
                    if(args.length == 0) {                  
                        p.sendMessage(ChatColor.RED + "List of Commands");
                        p.sendMessage(ChatColor.GREEN + "/pixelized info");
                        p.sendMessage(ChatColor.GREEN + "/pixelized web");
                        p.sendMessage(ChatColor.GREEN + "/pixelized warps"); }         
                    else if(arg.length == 1) {
                                         
                        if(args[0].equalsIgnoreCase("info")) {                      
                            p.sendMessage(ChatColor.RED + "This is a short description of Pixelized");                  
                        }                  
                        else if(args[0].equalsIgnoreCase("warps")) {                      
                            p.sendMessage(ChatColor.RED + "None Yet.");                  
                        }              
                        else if(args[0].equalsIgnoreCase("web")) {
                          
                            p.sendMessage(ChatColor.RED + "Here is the official Pixelized website:");
                            p.sendMessage(ChatColor.BLUE + "http://pixelized-network.enjin.com/");                      
                        }                  
                    }              
                {
                return true;      
            }
                }
    }
    return true;
    }
     
    Last edited: Apr 23, 2015
  4. Offline

    bwfcwalshy Retired Staff

    Moved to Bukkit Alternates.
     
  5. Offline

    mrcreeper242

    The plugin works on my home hosted server. Here's the full error:
    Code:
    2015-04-23T20:37:52.040588183Z     at org.bukkit.command.PluginCommand.execute(PluginCommand.java:44) ~[server.jar:git-Spigot-1649]
    2015-04-23T20:37:52.040588183Z     at me.mrcreeper242.Pixelized.onCommand(Pixelized.java:35) ~[?:?]
    2015-04-23T20:37:52.040588183Z Caused by: java.lang.NoClassDefFoundError: net/md_5/bungee/api/ChatColor
    2015-04-23T20:37:52.040588183Z     at net.minecraft.server.v1_7_R4.ThreadServerApplication.run(SourceFile:628) [server.jar:git-Spigot-1649]
    2015-04-23T20:37:52.040588183Z     at net.minecraft.server.v1_7_R4.MinecraftServer.run(MinecraftServer.java:490) [server.jar:git-Spigot-1649]
    2015-04-23T20:37:52.040588183Z     at net.minecraft.server.v1_7_R4.MinecraftServer.u(MinecraftServer.java:584) [server.jar:git-Spigot-1649]
    2015-04-23T20:37:52.040588183Z     at net.minecraft.server.v1_7_R4.DedicatedServer.v(DedicatedServer.java:289) [server.jar:git-Spigot-1649]
    2015-04-23T20:37:52.040588183Z     at net.minecraft.server.v1_7_R4.MinecraftServer.v(MinecraftServer.java:734) [server.jar:git-Spigot-1649]
    2015-04-23T20:37:52.040588183Z     at net.minecraft.server.v1_7_R4.ServerConnection.c(ServerConnection.java:81) [server.jar:git-Spigot-1649]
    2015-04-23T20:37:52.040588183Z     at net.minecraft.server.v1_7_R4.NetworkManager.a(NetworkManager.java:186) [server.jar:git-Spigot-1649]
    2015-04-23T20:37:52.040588183Z     at net.minecraft.server.v1_7_R4.PacketPlayInChat.handle(PacketPlayInChat.java:65) [server.jar:git-Spigot-1649]
    2015-04-23T20:37:52.040588183Z     at net.minecraft.server.v1_7_R4.PacketPlayInChat.a(PacketPlayInChat.java:28) [server.jar:git-Spigot-1649]
    2015-04-23T20:37:52.040588183Z     at net.minecraft.server.v1_7_R4.PlayerConnection.a(PlayerConnection.java:880) [server.jar:git-Spigot-1649]
    2015-04-23T20:37:52.040588183Z     at net.minecraft.server.v1_7_R4.PlayerConnection.handleCommand(PlayerConnection.java:1043) [server.jar:git-Spigot-1649]
    2015-04-23T20:37:52.040588183Z     at org.bukkit.craftbukkit.v1_7_R4.CraftServer.dispatchCommand(CraftServer.java:767) ~[server.jar:git-Spigot-1649]
    2015-04-23T20:37:52.040588183Z     at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:181) ~[server.jar:git-Spigot-1649]
    2015-04-23T20:37:52.040588183Z     at org.bukkit.command.PluginCommand.execute(PluginCommand.java:46) ~[server.jar:git-Spigot-1649]
    2015-04-23T20:37:52.040588183Z org.bukkit.command.CommandException: Unhandled exception executing command 'pixelized' in plugin Pixelized v1.0
    2015-04-23T20:37:52.040588183Z >
    [20:37:52 ERROR]: null
    And where are the open brackets?

    <Edited by bwfcwalshy: Merged posts, please use the edit button rather than double posting.>
     
    Last edited by a moderator: Apr 23, 2015
  6. Offline

    bwfcwalshy Retired Staff

    @mrcreeper242

     
  7. Offline

    mrcreeper242

    There I fixed up the code a bit:
    Code:
    package me.mrcreeper242;
    
    import net.md_5.bungee.api.ChatColor;
    import org.bukkit.command.Command;
    import org.bukkit.command.CommandSender;
    import org.bukkit.entity.Player;
    import org.bukkit.plugin.java.JavaPlugin;
    
    public class Pixelized extends JavaPlugin {
    
        @Override
        public void onEnable() {
           
        }
       
        @Override
        public void onDisable() {
       
        }
           
            @Override
            public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
           
                if ((sender instanceof Player)) {
                      Player p = (Player)sender;
           
           
           
            if(cmd.getName().equalsIgnoreCase("Pixelized")) {
               
                if(args.length == 0) {
                   
                    p.sendMessage(ChatColor.RED + "List of Commands");
                    p.sendMessage(ChatColor.GREEN + "/pixelized info");
                    p.sendMessage(ChatColor.GREEN + "/pixelized web");
                    p.sendMessage(ChatColor.GREEN + "/pixelized warps");
                   
                }
               
               
                else if(args.length == 1) {
                   
                   
                    if(args[0].equalsIgnoreCase("info")) {
                       
                        p.sendMessage(ChatColor.RED + "This is a short description of Pixelized");
                   
                    }
                   
                    else if(args[0].equalsIgnoreCase("warps")) {
                       
                        p.sendMessage(ChatColor.RED + "None Yet.");
                       
                    }
                   
                    else if(args[0].equalsIgnoreCase("web")) {
                       
                        p.sendMessage(ChatColor.RED + "Here is the official Pixelized website:");
                        p.sendMessage(ChatColor.BLUE + "http://pixelized-network.enjin.com/");
                       
                    }
                   
                }
                   
               
            }
                   
               
           
            return true;
               
           
                }
                return false;
               
            }
           
    }
    
           
    
     
  8. Offline

    DomThePotato

    You are using the BungeeCord API to implement ChatColor. Your server isn't BungeeCord. (And I know because I'm currently on it).

    ~DomThePotato
     
  9. Offline

    Xerox262

    And if it were bungee cord then the bukkit forums doesn't support it
     
Thread Status:
Not open for further replies.

Share This Page