'An Internal error occurred while attempting to perform this command' error!

Discussion in 'Plugin Development' started by 123ang, Jul 2, 2014.

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

    123ang

    Please help me I've made my disguise plugin, and whenever I do /d pig I get this error in chat "An Internal error occurred while attempting to perform this command".

    Here Is the Console Error When I Run This Command:

    Code:
    [06:38:58 INFO]: 123ang issued server command: /d pig
    [06:38:58 ERROR]: null
    org.bukkit.command.CommandException: Unhandled exception executing command 'd' i
    n plugin Disguiser v1.0
            at org.bukkit.command.PluginCommand.execute(PluginCommand.java:46) ~[cra
    ftbukkit.jar:git-Bukkit-1.7.9-R0.2-10-ge6cd8c0-b3096jnks]
            at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:18
    0) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.2-10-ge6cd8c0-b3096jnks]
            at org.bukkit.craftbukkit.v1_7_R3.CraftServer.dispatchCommand(CraftServe
    r.java:742) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.2-10-ge6cd8c0-b3096jnks]
            at net.minecraft.server.v1_7_R3.PlayerConnection.handleCommand(PlayerCon
    nection.java:956) [craftbukkit.jar:git-Bukkit-1.7.9-R0.2-10-ge6cd8c0-b3096jnks]
            at net.minecraft.server.v1_7_R3.PlayerConnection.a(PlayerConnection.java
    :817) [craftbukkit.jar:git-Bukkit-1.7.9-R0.2-10-ge6cd8c0-b3096jnks]
            at net.minecraft.server.v1_7_R3.PacketPlayInChat.a(PacketPlayInChat.java
    :28) [craftbukkit.jar:git-Bukkit-1.7.9-R0.2-10-ge6cd8c0-b3096jnks]
            at net.minecraft.server.v1_7_R3.PacketPlayInChat.handle(PacketPlayInChat
    .java:47) [craftbukkit.jar:git-Bukkit-1.7.9-R0.2-10-ge6cd8c0-b3096jnks]
            at net.minecraft.server.v1_7_R3.NetworkManager.a(NetworkManager.java:157
    ) [craftbukkit.jar:git-Bukkit-1.7.9-R0.2-10-ge6cd8c0-b3096jnks]
            at net.minecraft.server.v1_7_R3.ServerConnection.c(SourceFile:134) [craf
    tbukkit.jar:git-Bukkit-1.7.9-R0.2-10-ge6cd8c0-b3096jnks]
            at net.minecraft.server.v1_7_R3.MinecraftServer.v(MinecraftServer.java:6
    67) [craftbukkit.jar:git-Bukkit-1.7.9-R0.2-10-ge6cd8c0-b3096jnks]
            at net.minecraft.server.v1_7_R3.DedicatedServer.v(DedicatedServer.java:2
    60) [craftbukkit.jar:git-Bukkit-1.7.9-R0.2-10-ge6cd8c0-b3096jnks]
            at net.minecraft.server.v1_7_R3.MinecraftServer.u(MinecraftServer.java:5
    58) [craftbukkit.jar:git-Bukkit-1.7.9-R0.2-10-ge6cd8c0-b3096jnks]
            at net.minecraft.server.v1_7_R3.MinecraftServer.run(MinecraftServer.java
    :469) [craftbukkit.jar:git-Bukkit-1.7.9-R0.2-10-ge6cd8c0-b3096jnks]
            at net.minecraft.server.v1_7_R3.ThreadServerApplication.run(SourceFile:6
    28) [craftbukkit.jar:git-Bukkit-1.7.9-R0.2-10-ge6cd8c0-b3096jnks]
    Caused by: java.lang.NoClassDefFoundError: pgDev/bukkit/DisguiseCraft/disguise/D
    isguiseType
            at me.angtim123.disguiser.Disguiser.getDisguiseType(Disguiser.java:45) ~
    [?:?]
            at me.angtim123.disguiser.Disguiser.onCommand(Disguiser.java:29) ~[?:?]
            at org.bukkit.command.PluginCommand.execute(PluginCommand.java:44) ~[cra
    ftbukkit.jar:git-Bukkit-1.7.9-R0.2-10-ge6cd8c0-b3096jnks]
            ... 13 more
    Caused by: java.lang.ClassNotFoundException: pgDev.bukkit.DisguiseCraft.disguise
    .DisguiseType
            at java.net.URLClassLoader$1.run(Unknown Source) ~[?:1.8.0_05]
            at java.net.URLClassLoader$1.run(Unknown Source) ~[?:1.8.0_05]
            at java.security.AccessController.doPrivileged(Native Method) ~[?:1.8.0_
    05]
            at java.net.URLClassLoader.findClass(Unknown Source) ~[?:1.8.0_05]
            at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.
    java:77) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.2-10-ge6cd8c0-b3096jnks]
            at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.
    java:62) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.2-10-ge6cd8c0-b3096jnks]
            at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_05]
            at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_05]
            at me.angtim123.disguiser.Disguiser.getDisguiseType(Disguiser.java:45) ~
    [?:?]
            at me.angtim123.disguiser.Disguiser.onCommand(Disguiser.java:29) ~[?:?]
            at org.bukkit.command.PluginCommand.execute(PluginCommand.java:44) ~[cra
    ftbukkit.jar:git-Bukkit-1.7.9-R0.2-10-ge6cd8c0-b3096jnks]
            ... 13 more
    I'm using the DisguiseCraft API. Here Is My ONLY Class Code:

    Code:java
    1. package me.angtim123.disguiser;
    2.  
    3. import org.bukkit.ChatColor;
    4. import org.bukkit.command.Command;
    5. import org.bukkit.command.CommandSender;
    6. import org.bukkit.entity.Player;
    7. import org.bukkit.plugin.java.JavaPlugin;
    8. import pgDev.bukkit.DisguiseCraft.DisguiseCraft;
    9. import pgDev.bukkit.DisguiseCraft.api.DisguiseCraftAPI;
    10. import pgDev.bukkit.DisguiseCraft.disguise.Disguise;
    11. import pgDev.bukkit.DisguiseCraft.disguise.DisguiseType;
    12.  
    13. public class Disguiser extends JavaPlugin {
    14.  
    15. public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
    16. if (!(sender instanceof Player)) {
    17. sender.sendMessage(ChatColor.RED + "You cannot disguise yourself!");
    18. return true;
    19. }
    20.  
    21. Player p = (Player) sender;
    22.  
    23. if (command.getName().equalsIgnoreCase("disguiser")) {
    24. if (args.length == 0) {
    25. p.sendMessage(ChatColor.RED + "Please specify an entity type!");
    26. return true;
    27. }
    28.  
    29. DisguiseType type = getDisguiseType(args[0]);
    30.  
    31. if (type == null) {
    32. p.sendMessage(ChatColor.RED + "You specified an invalid disguise type.");
    33. return true;
    34. }
    35.  
    36. DisguiseCraftAPI api = DisguiseCraft.getAPI();
    37.  
    38. api.disguisePlayer(p, new Disguise(api.newEntityID(), type));
    39. p.sendMessage(ChatColor.GREEN + "You have been disguised as a(n) " + type.toString().toLowerCase() + "!");
    40. }
    41. return true;
    42. }
    43.  
    44. private DisguiseType getDisguiseType(String arg) {
    45. for (DisguiseType type : DisguiseType.values()) {
    46. String t = type.toString().toUpperCase();
    47. if (arg.toUpperCase().equalsIgnoreCase(t)) return type;
    48. }
    49. return null;
    50. }
    51. }


    And finally here is my plugin.yml:

    Code:
    name: Disguiser
    version: 1.0
    main: me.angtim123.disguiser.Disguiser
    author: 123ang
    description: Disguise yourself!
     
    commands:
        disguiser:
            usage: /<command>
            aliases: [d]
            description: Disguise yourself!
    If someone could please help me it would extremely help me out!
     
  2. Offline

    RenegadeEagle

    First thing I am noticing is you don't even have an onEnable and onDisable method....
     
  3. Offline

    123ang

    RenegadeEagle Okay I did that

    Updated Main Class Code:

    Code:java
    1. package me.angtim123.disguiser;
    2.  
    3. import org.bukkit.ChatColor;
    4. import org.bukkit.command.Command;
    5. import org.bukkit.command.CommandSender;
    6. import org.bukkit.entity.Player;
    7. import org.bukkit.plugin.java.JavaPlugin;
    8. import pgDev.bukkit.DisguiseCraft.DisguiseCraft;
    9. import pgDev.bukkit.DisguiseCraft.api.DisguiseCraftAPI;
    10. import pgDev.bukkit.DisguiseCraft.disguise.Disguise;
    11. import pgDev.bukkit.DisguiseCraft.disguise.DisguiseType;
    12.  
    13. public class Disguiser extends JavaPlugin {
    14.  
    15. public void onEnable(){
    16. getLogger().info("Disguiser has been enabled!");
    17. }
    18.  
    19. public void onDisable(){
    20. getLogger().info("Disguiser has been disabled!");
    21. }
    22.  
    23. public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
    24. if (!(sender instanceof Player)) {
    25. sender.sendMessage(ChatColor.RED + "You cannot disguise yourself!");
    26. return true;
    27. }
    28.  
    29. Player p = (Player) sender;
    30.  
    31. if (command.getName().equalsIgnoreCase("disguiser")) {
    32. if (args.length == 0) {
    33. p.sendMessage(ChatColor.RED + "Please specify an entity type!");
    34. return true;
    35. }
    36.  
    37. DisguiseType type = getDisguiseType(args[0]);
    38.  
    39. if (type == null) {
    40. p.sendMessage(ChatColor.RED + "You specified an invalid disguise type.");
    41. return true;
    42. }
    43.  
    44. DisguiseCraftAPI api = DisguiseCraft.getAPI();
    45.  
    46. api.disguisePlayer(p, new Disguise(api.newEntityID(), type));
    47. p.sendMessage(ChatColor.GREEN + "You have been disguised as a(n) " + type.toString().toLowerCase() + "!");
    48. }
    49. return true;
    50. }
    51.  
    52. private DisguiseType getDisguiseType(String arg) {
    53. for (DisguiseType type : DisguiseType.values()) {
    54. String t = type.toString().toUpperCase();
    55. if (arg.toUpperCase().equalsIgnoreCase(t)) return type;
    56. }
    57. return null;
    58. }
    59. }
    60.  
     
  4. Offline

    Drkmaster83

    RenegadeEagle I do not believe the onEnable and onDisable methods are necessary, granted the class is an extension of a superclass which has those methods.
    123ang Make sure that your imports are up to date with the library that you're using.
    Code:
    Caused by: java.lang.NoClassDefFoundError: pgDev/bukkit/DisguiseCraft/disguise/DisguiseType
    Edit: Also, make sure that args[0] matches any case-sensitivity that it needs to. Try perhaps '/d Pig' instead?
     
  5. Offline

    123ang

    Drkmaster83 No, I've checked all of the imports are correct, and if they weren't they would give me errors.
     
  6. Offline

    Freelix2000

    Just wondering, if the plugin uses DisguiseCraft API, that means the server would have to be running DisguiseCraft as well, but if DisguiseCraft already has an identical command for disguising players, doesn't that sort of defeat the purpose of this plugin?
     
  7. Offline

    RenegadeEagle

    Caused by: java.lang.ClassNotFoundException: pgDev.bukkit.DisguiseCraft.disguise
    .DisguiseType

    Regardless of the things said above, either the plugin is not on the server or you have an outdated version.
     
  8. Offline

    123ang

    Figured out why this is happening, the DisguiseCraft is in my plugin folder, however for some reason when I do /plugins in-game it doesn't show up D: Anyone know why!

    RenegadeEagle
    Freelix2000
    Drkmaster83
     
  9. Offline

    RenegadeEagle

    Disquisecraft may not be loading. This is now an issue that is for the Bukkit-Help section.
     
  10. Offline

    Freelix2000

    123ang
    I think that means you've got an outdated DisguiseCraft, or an outdated server. You'll have to wait for a DisguiseCraft update. But really, what is the point of this plugin if its just a command that DisguiseCraft already has? =P
     
  11. Offline

    123ang

Thread Status:
Not open for further replies.

Share This Page