ScoreBoard Error Console!

Discussion in 'Plugin Development' started by ToPoEdiTs, Aug 9, 2014.

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

    ToPoEdiTs

    I recently came out an error in one of the most famous mini-games which come about 350 people already declined to 150, the error is that sometimes when you walk into heading out the scoreboard and not leave do not leave tags on your equipment and you can kill

    ERROR CONSOLE:

    Code:
    [17:26:53] [Server thread/INFO]: ToPoEdiTs[/188.165.224.198:37808] logged in with entity id 285658 at ([world] 152.5, 65.0, 256.5)
    [17:26:53] [Server thread/ERROR]: Could not pass event PlayerJoinEvent to Anni vBeta 12A
    org.bukkit.event.EventException
        at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:427) ~[craftbukkit-1.7.2-R0.2.jar:git-Bukkit-1.7.2-R0.2-b2974jnks]
        at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62) ~[craftbukkit-1.7.2-R0.2.jar:git-Bukkit-1.7.2-R0.2-b2974jnks]
        at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:481) [craftbukkit-1.7.2-R0.2.jar:git-Bukkit-1.7.2-R0.2-b2974jnks]
        at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:466) [craftbukkit-1.7.2-R0.2.jar:git-Bukkit-1.7.2-R0.2-b2974jnks]
        at net.minecraft.server.v1_7_R1.PlayerList.c(PlayerList.java:225) [craftbukkit-1.7.2-R0.2.jar:git-Bukkit-1.7.2-R0.2-b2974jnks]
        at net.minecraft.server.v1_7_R1.PlayerList.a(PlayerList.java:116) [craftbukkit-1.7.2-R0.2.jar:git-Bukkit-1.7.2-R0.2-b2974jnks]
        at net.minecraft.server.v1_7_R1.LoginListener.c(LoginListener.java:78) [craftbukkit-1.7.2-R0.2.jar:git-Bukkit-1.7.2-R0.2-b2974jnks]
        at net.minecraft.server.v1_7_R1.LoginListener.a(LoginListener.java:42) [craftbukkit-1.7.2-R0.2.jar:git-Bukkit-1.7.2-R0.2-b2974jnks]
        at net.minecraft.server.v1_7_R1.NetworkManager.a(NetworkManager.java:149) [craftbukkit-1.7.2-R0.2.jar:git-Bukkit-1.7.2-R0.2-b2974jnks]
        at net.minecraft.server.v1_7_R1.ServerConnection.c(SourceFile:134) [craftbukkit-1.7.2-R0.2.jar:git-Bukkit-1.7.2-R0.2-b2974jnks]
        at net.minecraft.server.v1_7_R1.MinecraftServer.u(MinecraftServer.java:655) [craftbukkit-1.7.2-R0.2.jar:git-Bukkit-1.7.2-R0.2-b2974jnks]
        at net.minecraft.server.v1_7_R1.DedicatedServer.u(DedicatedServer.java:250) [craftbukkit-1.7.2-R0.2.jar:git-Bukkit-1.7.2-R0.2-b2974jnks]
        at net.minecraft.server.v1_7_R1.MinecraftServer.t(MinecraftServer.java:545) [craftbukkit-1.7.2-R0.2.jar:git-Bukkit-1.7.2-R0.2-b2974jnks]
        at net.minecraft.server.v1_7_R1.MinecraftServer.run(MinecraftServer.java:457) [craftbukkit-1.7.2-R0.2.jar:git-Bukkit-1.7.2-R0.2-b2974jnks]
        at net.minecraft.server.v1_7_R1.ThreadServerApplication.run(SourceFile:617) [craftbukkit-1.7.2-R0.2.jar:git-Bukkit-1.7.2-R0.2-b2974jnks]
    Caused by: java.lang.IllegalStateException: Cannot set scoreboard for invalid CraftPlayer
        at org.bukkit.craftbukkit.v1_7_R1.entity.CraftPlayer.setScoreboard(CraftPlayer.java:1063) ~[craftbukkit-1.7.2-R0.2.jar:git-Bukkit-1.7.2-R0.2-b2974jnks]
        at net.coasterman10.Annihilation.manager.ScoreboardManager.update(ScoreboardManager.java:24) ~[?:?]
        at net.coasterman10.Annihilation.listeners.PlayerListeners.JoinListener.onPlayerJoin(JoinListener.java:145) ~[?:?]
        at sun.reflect.GeneratedMethodAccessor82.invoke(Unknown Source) ~[?:?]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_51]
        at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_51]
        at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:425) ~[craftbukkit-1.7.2-R0.2.jar:git-Bukkit-1.7.2-R0.2-b2974jnks]
        ... 14 more
    [17:26:54] [Server thread/INFO]: [PlayerPoints] Player shidoule now has 33 Points
    [17:26:54] [Server thread/INFO]: willy2978 was killed by shidoule
    [17:26:56] [Server thread/INFO]: [PlayerPoints] Player Nerodevilsxs now has 90 Points
    [17:26:56] [Server thread/INFO]: shidoule was killed by Nerodevilsxs
    [17:26:56] [Server thread/INFO]: [NoCheatPlus] miguelpinpan failed FastBreak: tried to break blocks (121) faster than possible. VL 1.
    [17:26:56] [Server thread/INFO]: nexus log
    [17:26:56] [Server thread/WARN]: [NoCheatPlus] DataMan inconsistencies: missing online players (8) | changed player instances (8)
    [17:26:58] [Server thread/INFO]: nexus log
    [17:26:59] [Server thread/INFO]: ToPoEdiTs issued server command: /ban Nerodevilsxs aaa
    [17:27:00] [Server thread/INFO]: Nerodevilsxs lost connection: Banned by admin.
    [17:27:00] [Server thread/INFO]: ToPoEdiTs: Banned player Nerodevilsxs
    [17:27:01] [Server thread/INFO]: [NoCheatPlus] miguelpinpan failed FastBreak: tried to break blocks (121) faster than possible. VL 2.
    [17:27:01] [Server thread/INFO]: nexus log
    [17:27:02] [Server thread/INFO]: ToPoEdiTs issued server command: /ban shidoule sss
    [17:27:02] [Server thread/INFO]: shidoule lost connection: Banned by admin.
    [17:27:02] [Server thread/INFO]: ToPoEdiTs: Banned player shidoule
    [17:27:03] [Server thread/INFO]: nexus log
    [17:27:04] [Server thread/INFO]: ToPoEdiTs issued server command: /stop
    [17:27:04] [Server thread/INFO]: ToPoEdiTs: Stopping the server..
    [17:27:04] [Server thread/INFO]: Stopping server
    [17:27:04] [Server thread/INFO]: [PlayerPoints] Disabling PlayerPoints v1.7
    [17:27:04] [Server thread/INFO]: [Reservations] Disabling Reservations v2.5
    [17:27:04] [Server thread/INFO]: [Reservations] is disabled!
    [17:27:04] [Server thread/INFO]: [SQLibrary] Disabling SQLibrary v7.1
    [17:27:04] [Server thread/INFO]: SQLibrary stopped.
    [17:27:04] [Server thread/INFO]: [WorldGuard] Disabling WorldGuard v5.8
    [17:27:04] [Server thread/INFO]: [WorldEdit] Disabling WorldEdit v5.5.8
    [17:27:04] [Server thread/INFO]: [Anni] Disabling Anni vBeta 12A
    [17:27:04] [Server thread/INFO]: [NoCheatPlus] Disabling NoCheatPlus v3.10.12-RC-sMD5NET-b700
    [17:27:04] [Server thread/WARN]: [NoCheatPlus] DataMan found 116 inconsistencies (warnings suppressed).
    [17:27:04] [Server thread/INFO]: [NoCheatPlus] Version 3.10.12-RC-sMD5NET-b700 is disabled.
    [17:27:04] [Server thread/INFO]: [PermissionsEx] Disabling PermissionsEx v1.20.4
    [17:27:04] [Server thread/INFO]: [Vault][Permission] PermissionsEx un-hooked.
    [17:27:04] [Server thread/INFO]: [Vault][Chat] PermissionsEx_Chat un-hooked.
    [17:27:04] [Server thread/INFO]: Permissions file successfully reloaded
    [17:27:04] [Server thread/INFO]: [SystemXP] Disabling SystemXP v1.1
    [17:27:04] [Server thread/INFO]: [Vault] Disabling Vault v1.4.1-b436
    [17:27:04] [Server thread/INFO]: [OP-PW] Disabling OP-PW v0.3
    [17:27:04] [Server thread/INFO]: [OP-PW] Plugin deaktiviert!
    [17:27:04] [Server thread/INFO]: [OP-PW] Plugin gesponsert vom Server deincraft.minecraft.gs
    [17:27:04] [Server thread/INFO]: Saving players
    [17:27:04] [Server thread/INFO]: sussy05 lost connection: Server restarting, you are teleport to the hub. The next game are coming soon.
    [17:27:04] [Server thread/INFO]: sussy05 left the game.
    [17:27:04] [Server thread/INFO]: ismapower10 lost connection: Server restarting, you are teleport to the hub. The next game are coming soon.
    [17:27:04] [Server thread/INFO]: ismapower10 left the game.
    [17:27:04] [Server thread/INFO]: Killing_Dustin3 lost connection: Server restarting, you are teleport to the hub. The next game are coming soon.
    [17:27:04] [Server thread/INFO]: Killing_Dustin3 left the game.
    [17:27:04] [Server thread/INFO]: Clanc lost connection: Server restarting, you are teleport to the hub. The next game are coming soon.
    [17:27:04] [Server thread/INFO]: Clanc left the game.
    [17:27:04] [Server thread/INFO]: agus_capitolol lost connection: Server restarting, you are teleport to the hub. The next game are coming soon.
    [17:27:04] [Server thread/INFO]: agus_capitolol left the game.
    [17:27:04] [Server thread/INFO]: superbentor lost connection: Server restarting, you are teleport to the hub. The next game are coming soon.
    [17:27:04] [Server thread/INFO]: superbentor left the game.
    [17:27:04] [Server thread/INFO]: FORTIMO lost connection: Server restarting, you are teleport to the hub. The next game are coming soon.
    [17:27:04] [Server thread/INFO]: FORTIMO left the game.
    [17:27:04] [Server thread/INFO]: ToPoEdiTs lost connection: Server restarting, you are teleport to the hub. The next game are coming soon.
    [17:27:04] [Server thread/INFO]: ToPoEdiTs left the game.
    [17:27:04] [Server thread/INFO]: Saving worlds
    [17:27:04] [Server thread/INFO]: Saving chunks for level 'world'/Overworld
    [17:27:04] [Server thread/INFO]: Saving chunks for level 'lobby'/Overworld
    [17:27:04] [Server thread/INFO]: Saving chunks for level 'Hamlet'/Overworld
    [17:27:04] [Thread-4/INFO]: Stopping server
    [17:27:04] [Thread-4/INFO]: Saving players
    CODE ScoreBoard:

    Code:java
    1.  
    2. import java.util.HashMap;
    3.  
    4. import net.coasterman10.Annihilation.object.GameTeam;
    5.  
    6. import org.bukkit.Bukkit;
    7. import org.bukkit.entity.Player;
    8. import org.bukkit.scoreboard.DisplaySlot;
    9. import org.bukkit.scoreboard.Objective;
    10. import org.bukkit.scoreboard.Score;
    11. import org.bukkit.scoreboard.Scoreboard;
    12. import org.bukkit.scoreboard.Team;
    13.  
    14. public class ScoreboardManager {
    15. public Scoreboard sb;
    16. public Objective obj;
    17.  
    18. public HashMap<String, Score> score = new HashMap<String, Score>();
    19. public HashMap<String, Team> team = new HashMap<String, Team>();
    20.  
    21. public void update() {
    22. for (Player p : Bukkit.getOnlinePlayers())
    23. p.setScoreboard(sb);
    24. }
    25.  
    26. public void resetScoreboard(String objName) {
    27. sb = null;
    28. obj = null;
    29.  
    30. score.clear();
    31. team.clear();
    32.  
    33. for (Player p : Bukkit.getOnlinePlayers())
    34. p.setScoreboard(Bukkit.getScoreboardManager().getNewScoreboard());
    35.  
    36. sb = Bukkit.getScoreboardManager().getNewScoreboard();
    37. obj = sb.registerNewObjective("anni", "dummy");
    38.  
    39. obj.setDisplaySlot(DisplaySlot.SIDEBAR);
    40. obj.setDisplayName(objName);
    41.  
    42. setTeam(GameTeam.RED);
    43. setTeam(GameTeam.BLUE);
    44. setTeam(GameTeam.GREEN);
    45. setTeam(GameTeam.YELLOW);
    46. }
    47.  
    48. public void setTeam(GameTeam t) {
    49. team.put(t.name(), sb.registerNewTeam(t.name()));
    50. Team sbt = team.get(t.name());
    51. sbt.setAllowFriendlyFire(false);
    52. sbt.setCanSeeFriendlyInvisibles(true);
    53. sbt.setPrefix(t.color().toString());
    54. }
    55. }
    56.  


    CODE: JoinListener:

    Code:java
    1.  
    2.  
    3. import java.io.File;
    4. import net.coasterman10.Annihilation.Annihilation;
    5. import net.coasterman10.Annihilation.Translator;
    6. import net.coasterman10.Annihilation.Util;
    7. import net.coasterman10.Annihilation.bar.BarUtil;
    8. import net.coasterman10.Annihilation.manager.PlayerSerializer;
    9. import net.coasterman10.Annihilation.object.GameTeam;
    10. import net.coasterman10.Annihilation.object.PlayerMeta;
    11. import org.bukkit.Bukkit;
    12. import org.bukkit.ChatColor;
    13. import org.bukkit.GameMode;
    14. import org.bukkit.Sound;
    15. import org.bukkit.configuration.file.FileConfiguration;
    16. import org.bukkit.configuration.file.YamlConfiguration;
    17. import org.bukkit.entity.Player;
    18. import org.bukkit.event.EventHandler;
    19. import org.bukkit.event.Listener;
    20. import org.bukkit.event.player.PlayerJoinEvent;
    21. import org.bukkit.inventory.PlayerInventory;
    22. import org.bukkit.potion.PotionEffect;
    23.  
    24. public class JoinListener implements Listener {
    25.  
    26. private Annihilation plugin;
    27.  
    28. private static String prefix;
    29. public JoinListener(Annihilation pl) {
    30. plugin = pl;
    31. prefix = plugin.prefix;
    32. }
    33.  
    34. @EventHandler
    35. public void onPlayerJoin(final PlayerJoinEvent e) {
    36. e.setJoinMessage("");
    37. final Player player = e.getPlayer();
    38. String uuid = player.getName();
    39. if (plugin.getNpcPlayers().containsKey(uuid)) {
    40. player.kickPlayer(ChatColor.RED + "Tu NCP aun sigue VIVO");
    41. return;
    42. }
    43. if (!plugin.getJoiningPlayers().containsKey(player)) {
    44. plugin.getJoiningPlayers().put(player, uuid);
    45. }
    46. player.sendMessage("");
    47. player.sendMessage("");
    48. player.sendMessage(ChatColor.AQUA + "◄▬▬▬" + ChatColor.GRAY + "Welcom a Annihilation" + ChatColor.DARK_PURPLE + " 2.0 ALPHA" + ChatColor.AQUA + "▬▬▬►");
    49. player.sendMessage("");
    50. player.sendMessage(ChatColor.AQUA + "◄▬▬▬" + ChatColor.GRAY + "Desarrollado por " + ChatColor.DARK_PURPLE + "DemonFire Network" + ChatColor.AQUA + "▬▬▬►");
    51. player.sendMessage("");
    52. player.performCommand("p me");
    53. //String uuid = String.valueOf(Bukkit.getOfflinePlayer(player.getName()).getUniqueId());
    54. if (plugin.useMysql) {
    55. plugin.getDatabaseHandler()
    56. .query("INSERT IGNORE INTO `annihilation` (`username`, `kills`, "
    57. + "`deaths`, `wins`, `losses`, `nexus_damage`) VALUES "
    58. + "('"
    59. + uuid
    60. + "', '0', '0', '0', '0', '0');");
    61. }
    62. if (plugin.getPhase() == 0 && plugin.getVotingManager().isRunning()) {
    63. BarUtil.setMessageAndPercent(player, ChatColor.GRAY + "Bienvenidos al Annihilation DemonFire", 0.01f);
    64. plugin.checkStarting();
    65. }
    66. PlayerMeta meta = PlayerMeta.getMeta(player);
    67. player.teleport(plugin.getMapManager().getLobbySpawnPoint());
    68. PlayerInventory inv = player.getInventory();
    69. inv.setHelmet(null);
    70. inv.setChestplate(null);
    71. inv.setLeggings(null);
    72. inv.setBoots(null);
    73. player.getInventory().clear();
    74. for (PotionEffect effect : player.getActivePotionEffects()) {
    75. player.removePotionEffect(effect.getType());
    76. }
    77. player.setLevel(0);
    78. player.setExp(0);
    79. player.setSaturation(20F);
    80. Util.giveClassSelector(player);
    81. player.updateInventory();
    82. plugin.getSignHandler().updateSigns(meta.getTeam());
    83. plugin.getScoreboardHandler().update();
    84. Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() {
    85. @Override
    86. public void run() {
    87. if (player.isOnline()) {
    88. reJoinPlayer(player);
    89. }
    90. }
    91. }, 20L * 1);
    92. }
    93.  
    94. public void reJoinPlayer(final Player p) {
    95. if (p == null) {
    96. return;
    97. }
    98. if (!p.isOnline()) {
    99. return;
    100. }
    101. final String playerName = p.getName();
    102. if (!Util.playerPlayed(p)) {
    103. if (plugin.getPhase() > plugin.lastJoinPhase) {
    104. if (!p.isOp() || !p.getName().equals("ANON_SvS")) {
    105. if (p != null && p.isOnline()) {
    106. p.kickPlayer((ChatColor.RED + "ANNIHILATION-TRIGGER-KICK-01"));
    107. return;
    108. }
    109. return;
    110. }
    111. return;
    112. }
    113. if (plugin.getJoiningPlayers().containsKey(p)) {
    114. plugin.getJoiningPlayers().remove(p);
    115. }
    116. p.updateInventory();
    117. return;
    118. }
    119. File playerdataFile = new File("plugins/Anni/users/" + playerName + ".yml");
    120. FileConfiguration playerConfig = YamlConfiguration.loadConfiguration(playerdataFile);
    121. p.getInventory().clear();
    122. PlayerSerializer.ConfigToPlayer(p, playerConfig);
    123. PlayerMeta meta = PlayerMeta.getMeta(p);
    124. if (PlayerSerializer.isKilled(playerName)) {
    125. if (plugin.kitsToGive.containsKey(p.getName())) {
    126. meta.setKit(plugin.kitsToGive.get(p.getName()));
    127. plugin.kitsToGive.remove(p.getName());
    128. }
    129. meta.getKit().give(p, meta.getTeam());
    130. meta.setAlive(true);
    131. p.setCompassTarget(meta.getTeam().getNexus().getLocation());
    132. p.setGameMode(GameMode.ADVENTURE);
    133. p.setHealth(p.getMaxHealth());
    134. p.setFoodLevel(20);
    135. p.setSaturation(20F);
    136. p.updateInventory();
    137. p.teleport(meta.getTeam().getRandomSpawn());
    138. p.sendMessage("NPC MUERTO ENTRA");
    139. if (plugin.getJoiningPlayers().containsKey(p)) {
    140. plugin.getJoiningPlayers().remove(p);
    141. }
    142. return;
    143. }
    144. PlayerSerializer.RetorePlayer(p);
    145. p.updateInventory();
    146. meta = PlayerMeta.getMeta(p);
    147. if (p == null) {
    148. return;
    149. }
    150. if (meta == null) {
    151. p.kickPlayer(ChatColor.RED + "Error el jugador no existe");
    152. return;
    153. }
    154. if (meta.getTeam() == GameTeam.NONE) {
    155. p.kickPlayer(ChatColor.RED + "El equipo esta destruido o esta lleno!");
    156. return;
    157. }
    158. p.teleport(meta.getTeam().getRandomSpawn());
    159. p.sendMessage("Se devuelven todas las cosas");
    160. p.playSound(p.getLocation(), Sound.LEVEL_UP, 1, 1);
    161. plugin.getSignHandler().updateSigns(meta.getTeam());
    162. plugin.getScoreboardHandler().update();
    163. p.setGameMode(GameMode.ADVENTURE);
    164. p.updateInventory();
    165. if (plugin.getJoiningPlayers().containsKey(p)) {
    166. plugin.getJoiningPlayers().remove(p);
    167. }
    168. }
    169. }
    170.  
     
  2. Offline

    Forseth11

    The stack trace says it was caused at ScoreboardManager line 24. Since the code you showed at line 24 is a } I assume you did not post the full code. Can you post the whole thing or just line 24.
     
  3. Offline

    ToPoEdiTs

    you want them to pass all code? to the scoreboard esque plugin manager or took months looking for someone to help me because my server 500 people will bug the shit
     
  4. Offline

    Forseth11

    No post line 24 or you full class called ScoreboardManager.
    I need to see it to help you find and fix the error.
     
  5. Offline

    ToPoEdiTs

    Ok
    ScoreBoardManager Class:
    Code:
    package net.coasterman10.Annihilation.manager;
     
    import java.util.HashMap;
     
    import net.coasterman10.Annihilation.object.GameTeam;
     
    import org.bukkit.Bukkit;
    import org.bukkit.entity.Player;
    import org.bukkit.scoreboard.DisplaySlot;
    import org.bukkit.scoreboard.Objective;
    import org.bukkit.scoreboard.Score;
    import org.bukkit.scoreboard.Scoreboard;
    import org.bukkit.scoreboard.Team;
     
    public class ScoreboardManager {
        public Scoreboard sb;
        public Objective obj;
       
        public HashMap<String, Score> score = new HashMap<String, Score>();
        public HashMap<String, Team> team = new HashMap<String, Team>();
       
        public void update() {
            for (Player p : Bukkit.getOnlinePlayers())
                p.setScoreboard(sb);
        }
       
        public void resetScoreboard(String objName) {
            sb = null;
            obj = null;
           
            score.clear();
            team.clear();
           
            for (Player p : Bukkit.getOnlinePlayers())
                p.setScoreboard(Bukkit.getScoreboardManager().getNewScoreboard());
           
            sb = Bukkit.getScoreboardManager().getNewScoreboard();
            obj = sb.registerNewObjective("anni", "dummy");
           
            obj.setDisplaySlot(DisplaySlot.SIDEBAR);
            obj.setDisplayName(objName);
           
            setTeam(GameTeam.RED);
            setTeam(GameTeam.BLUE);
            setTeam(GameTeam.GREEN);
            setTeam(GameTeam.YELLOW);
        }
       
        public void setTeam(GameTeam t) {
            team.put(t.name(), sb.registerNewTeam(t.name()));
            Team sbt = team.get(t.name());
            sbt.setAllowFriendlyFire(false);
            sbt.setCanSeeFriendlyInvisibles(true);
            sbt.setPrefix(t.color().toString());
        }
    }
    
     
  6. Offline

    Forseth11

    According to the error it says that p.setScoreboard(p); is trying to set it to an invalid craftplayer:
    Code:
    Caused by: java.lang.IllegalStateException: Cannot set scoreboard for invalid CraftPlayer
    I don't know why it is doing this. I am just saying where the error is. Maybe you have a wrong import or you are using a version of craftbukkit that is not working. Or maybe your scoreboard is not setup right. Try checking if the scoreboard is null in the update method.
     
  7. Offline

    ZodiacTheories

  8. Offline

    Forseth11

    ZodiacTheories That is what I thought, but then I saw the resetScoreboard method and thought he would call that first before the update.
     
  9. Offline

    ZodiacTheories

  10. Offline

    ToPoEdiTs

    l
    look skype plz
     
Thread Status:
Not open for further replies.

Share This Page