2013-09-01 10:20:37 [SEVERE] null org.bukkit.command.CommandException: Unhandled exception executing

Discussion in 'Plugin Development' started by kney1987, Sep 1, 2013.

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

    kney1987

    Code:
    2013-09-01 10:20:37 [SEVERE] null
    org.bukkit.command.CommandException: Unhandled exception executing command 'gl' in plugin TheGlitch v1.0
        at org.bukkit.command.PluginCommand.execute(PluginCommand.java:46)
        at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:191)
        at org.bukkit.craftbukkit.v1_6_R2.CraftServer.dispatchCommand(CraftServer.java:523)
        at net.minecraft.server.v1_6_R2.PlayerConnection.handleCommand(PlayerConnection.java:954)
        at net.minecraft.server.v1_6_R2.PlayerConnection.chat(PlayerConnection.java:872)
        at net.minecraft.server.v1_6_R2.PlayerConnection.a(PlayerConnection.java:829)
        at net.minecraft.server.v1_6_R2.Packet3Chat.handle(SourceFile:49)
        at net.minecraft.server.v1_6_R2.NetworkManager.b(NetworkManager.java:296)
        at net.minecraft.server.v1_6_R2.PlayerConnection.e(PlayerConnection.java:116)
        at net.minecraft.server.v1_6_R2.ServerConnection.b(SourceFile:37)
        at net.minecraft.server.v1_6_R2.DedicatedServerConnection.b(SourceFile:30)
        at net.minecraft.server.v1_6_R2.MinecraftServer.t(MinecraftServer.java:590)
        at net.minecraft.server.v1_6_R2.DedicatedServer.t(DedicatedServer.java:226)
        at net.minecraft.server.v1_6_R2.MinecraftServer.s(MinecraftServer.java:486)
        at net.minecraft.server.v1_6_R2.MinecraftServer.run(MinecraftServer.java:419)
        at net.minecraft.server.v1_6_R2.ThreadServerApplication.run(SourceFile:582)
    Caused by: java.lang.Error: Unresolved compilation problems:
        Constructor call must be the first statement in a constructor
        s cannot be resolved to a variable
        Constructor call must be the first statement in a constructor
     
        at com.GlitcherDOTbe.TheGlitch.Arena.Arena$3.<init>(Arena.java:232)
        at com.GlitcherDOTbe.TheGlitch.Arena.Arena.setHunger(Arena.java:203)
        at com.GlitcherDOTbe.TheGlitch.Arena.Arena.checkLobby(Arena.java:198)
        at com.GlitcherDOTbe.TheGlitch.Arena.Arena.addPlayer(Arena.java:182)
        at com.GlitcherDOTbe.TheGlitch.Arena.Arena.joinArena(Arena.java:90)
        at com.GlitcherDOTbe.TheGlitch.TheGlitch.onCommand(TheGlitch.java:158)
        at org.bukkit.command.PluginCommand.execute(PluginCommand.java:44)
        ... 15 more
     
  2. Offline

    xXMinecraftXx

    kney1987 , could you post your code ?
     
  3. Offline

    kney1987

    Which class?
    Arena or main class?
     
  4. Offline

    curlyfries1999

  5. Offline

    kney1987

    Code:java
    1.  
    2. public class Arena implements Listener {
    3. public List arenaPlayers;
    4. public boolean disabled;
    5. protected boolean inLobby;
    6.  
    7. public Arena(TheGlitch plugin) {
    8. arenaPlayers = new ArrayList();
    9. disabled = false;
    10. inLobby = true;
    11. this.plugin = plugin;
    12. }
    13.  
    14. public void joinArena(Player player) {
    15. boolean isEmpty = true;
    16.  
    17. if(!disabled) {
    18. if(inLobby) {
    19. if(!arenaPlayers.contains(player)) {
    20. if(arenaPlayers.size() <= plugin.ch.getMaxPlayers()) {
    21. ItemStack aitemstack[];
    22. int j = (aitemstack = player.getInventory().getContents()).length;
    23. for(int i = 0; i < j; i++) {
    24. ItemStack itemStack = aitemstack[i];
    25. if(itemStack != null) {
    26. isEmpty = false;
    27. }
    28. }
    29.  
    30. if(isEmpty) {
    31. if(player.getGameMode() == GameMode.SURVIVAL) {
    32. addPlayer(player);
    33. plugin.sendConsole((new StringBuilder(String.valueOf(player.getName()))).append(" has been added to the arena.").toString());
    34. } else {
    35. addPlayer(player);
    36. player.setGameMode(GameMode.SURVIVAL);
    37. plugin.sendConsole((new StringBuilder(String.valueOf(player.getName()))).append(" has been added to the arena.").toString());
    38. }
    39. } else {
    40. plugin.sendHPMessage(player, "Please Empty your inventory before entering.");
    41. }
    42. } else {
    43. plugin.sendHPMessage(player, "Arena is full.");
    44. }
    45. } else {
    46. plugin.sendHPMessage(player, "You are already in the arena.");
    47. }
    48. } else {
    49. plugin.sendHPMessage(player, "There is a game in progress.");
    50. }
    51. } else {
    52. plugin.sendHPMessage(player, "TheGlitch is currently disabled.");
    53. }
    54. }
    55.  
    56. public void addPlayer(Player player) {
    57. int arenaSize = arenaPlayers.size() + 1;
    58. tellArena((new StringBuilder()).append(ChatColor.AQUA).append(player.getName()).append(ChatColor.BLUE).append(" has joined the game. (").append(arenaSize).append("/").append(plugin.ch.getMaxPlayers()).append(")").toString());
    59. arenaPlayers.add(player);
    60. player.setGameMode(GameMode.ADVENTURE);
    61. player.setHealth(20D);
    62. player.setFoodLevel(20);
    63. player.setFireTicks(0);
    64. player.getActivePotionEffects().clear();
    65. player.setExp(0.0F);
    66. Inventory pi = player.getInventory();
    67. pi.clear();
    68. player.getInventory().setHelmet(null);
    69. player.getInventory().setChestplate(null);
    70. player.getInventory().setLeggings(null);
    71. player.getInventory().setBoots(null);
    72. spawnBack.put(player.getName(), player.getLocation());
    73. levels.put(player.getName(), Float.valueOf(player.getExp()));
    74. lobbySpawn(player);
    75. checkLobby();
    76. player.playSound(player.getLocation(), Sound.LEVEL_UP, 1.0F, 10F);
    77. }
    78.  
    79. public void checkLobby() {
    80. if(arenaPlayers.size() >= plugin.ch.getMaxPlayers()) {
    81. lobbyTimer = plugin.ch.getLobbyTime();
    82. startLobbyTime();
    83. } else {
    84. int playersLeft = plugin.ch.getMinPlayers() - arenaPlayers.size();
    85. tellArena((new StringBuilder("You need ")).append(playersLeft).append(" more players to start the game.").toString());
    86. }
    87. for(int i = 0; i < arenaPlayers.size(); i++) {
    88. Player p = (Player)arenaPlayers.get(i);
    89. }
    90. setHunger();
    91. }
    92.  
    93. public void setHunger() {
    94. if(!arenaPlayers.isEmpty())
    95. plugin.getServer().getScheduler().scheduleAsyncRepeatingTask(plugin, new Runnable() {
    96. public void run()
    97. {
    98. if(time != -1)
    99. {
    100. if(time != 0)
    101. {
    102. for(int i = 0; i < arenaPlayers.size(); i++)
    103. {
    104. Player p = (Player)arenaPlayers.get(i);
    105. p.setLevel(lobbyTimer);
    106. p.setFoodLevel(20);
    107. }
    108.  
    109. }
    110. if(time == 0)
    111. {
    112. setHunger();
    113. time--;
    114. }
    115. }
    116. }
    117.  
    118. int time;
    119. final Arena this$0;
    120.  
    121.  
    122. {
    123. this$0 = Arena.this;
    124. super();
    125. time = 1;
    126. }
    127. }
    128. , 0L, 20L);
    129. }
    130. }
    131. [/i]
     
  6. Offline

    kbunkrams97

    kney1987 Could we also get the main class please? Also was that the entire Arena file? It appears that the errors are on lines that do not exists.
     
  7. Offline

    mbaxter ʇıʞʞnq ɐ sɐɥ ı

    Unresolved compilation problems means your IDE told you there were errors but you told it to compile anyway. Look at the red underlined code in your IDE and fix the issues or ask for help with the specific problem here.
     
  8. Offline

    kney1987

    This is always underlined in red

    Code:java
    1.  
    2. super();
    3.  
     
  9. Offline

    Gopaintman

    If anything is underlined (meaning you made a mistake in your coding) in red do not compile it, simple as that. What error is your IDE telling you when you hover over it?
     
  10. Offline

    kney1987

    I'll post this evening.. I'm at work now
     
  11. Offline

    jayfella

    i'm confused as to why you would call the constructor to the subclass there. You can only do that in the first line of the class constructor. It actually looks very much like you are copy-pasting de-compiled code straight into your project. Not only is that plagiarism, but it will rarely work anyway - as your snippet has proven.

    Read the code, try to understand what it is doing and apply yourself to the task of writing it in your own way, in your own words.
     
Thread Status:
Not open for further replies.

Share This Page