I Cant fix this error!

Discussion in 'Plugin Development' started by DividedByZero, Feb 5, 2014.

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

    DividedByZero

    Guys im working on a minigame and this error will not go away out of my lobby loop. Ive been trying to work on this for about a week now and cant seem to crack it. All that I know is it has something to do with my main lobby loop.

    Code:
    [10:01:08 INFO]: [PvpParkour] Disabling PvpParkour v1.0
    [10:01:08 INFO]: [PvpParkour] PvpParkour has been disabled.
    [10:01:08 INFO]: [PvpParkour] Loading PvpParkour v1.0
    [10:01:08 INFO]: [PvpParkour] Enabling PvpParkour v1.0
    [10:01:08 INFO]: [PvpParkour] PvpParkour has been enabled.
    [10:01:08 INFO]: Server permissions file permissions.yml is empty, ignoring it
    [10:01:08 INFO]: CONSOLE: Reload complete.
    [10:01:14 INFO]: HiROs15 issued server command: /pvpp joinhub
    [10:01:20 WARN]: Can't keep up! Did the system time change, or is the server ove
    rloaded? Running 2717ms behind, skipping 54 tick(s)
    [10:01:21 INFO]: HiROs15 issued server command: /pvpp join Test
    [10:01:21 ERROR]: null
    org.bukkit.command.CommandException: Unhandled exception executing command 'pvpp
    ' in plugin PvpParkour v1.0
            at org.bukkit.command.PluginCommand.execute(PluginCommand.java:46) ~[cra
    ftbukkit.jar:git-Bukkit-1.7.2-R0.2-b2974jnks]
            at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:19
    6) ~[craftbukkit.jar:git-Bukkit-1.7.2-R0.2-b2974jnks]
            at org.bukkit.craftbukkit.v1_7_R1.CraftServer.dispatchCommand(CraftServe
    r.java:542) ~[craftbukkit.jar:git-Bukkit-1.7.2-R0.2-b2974jnks]
            at net.minecraft.server.v1_7_R1.PlayerConnection.handleCommand(PlayerCon
    nection.java:932) [craftbukkit.jar:git-Bukkit-1.7.2-R0.2-b2974jnks]
            at net.minecraft.server.v1_7_R1.PlayerConnection.a(PlayerConnection.java
    :814) [craftbukkit.jar:git-Bukkit-1.7.2-R0.2-b2974jnks]
            at net.minecraft.server.v1_7_R1.PacketPlayInChat.a(PacketPlayInChat.java
    :28) [craftbukkit.jar:git-Bukkit-1.7.2-R0.2-b2974jnks]
            at net.minecraft.server.v1_7_R1.PacketPlayInChat.handle(PacketPlayInChat
    .java:47) [craftbukkit.jar:git-Bukkit-1.7.2-R0.2-b2974jnks]
            at net.minecraft.server.v1_7_R1.NetworkManager.a(NetworkManager.java:146
    ) [craftbukkit.jar:git-Bukkit-1.7.2-R0.2-b2974jnks]
            at net.minecraft.server.v1_7_R1.ServerConnection.c(SourceFile:134) [craf
    tbukkit.jar:git-Bukkit-1.7.2-R0.2-b2974jnks]
            at net.minecraft.server.v1_7_R1.MinecraftServer.u(MinecraftServer.java:6
    55) [craftbukkit.jar:git-Bukkit-1.7.2-R0.2-b2974jnks]
            at net.minecraft.server.v1_7_R1.DedicatedServer.u(DedicatedServer.java:2
    50) [craftbukkit.jar:git-Bukkit-1.7.2-R0.2-b2974jnks]
            at net.minecraft.server.v1_7_R1.MinecraftServer.t(MinecraftServer.java:5
    45) [craftbukkit.jar:git-Bukkit-1.7.2-R0.2-b2974jnks]
            at net.minecraft.server.v1_7_R1.MinecraftServer.run(MinecraftServer.java
    :457) [craftbukkit.jar:git-Bukkit-1.7.2-R0.2-b2974jnks]
            at net.minecraft.server.v1_7_R1.ThreadServerApplication.run(SourceFile:6
    17) [craftbukkit.jar:git-Bukkit-1.7.2-R0.2-b2974jnks]
    Caused by: java.lang.IllegalArgumentException: Plugin cannot be null
            at org.apache.commons.lang.Validate.notNull(Validate.java:203) ~[craftbu
    kkit.jar:git-Bukkit-1.7.2-R0.2-b2974jnks]
            at org.bukkit.craftbukkit.v1_7_R1.scheduler.CraftScheduler.validate(Craf
    tScheduler.java:391) ~[craftbukkit.jar:git-Bukkit-1.7.2-R0.2-b2974jnks]
            at org.bukkit.craftbukkit.v1_7_R1.scheduler.CraftScheduler.runTaskTimer(
    CraftScheduler.java:120) ~[craftbukkit.jar:git-Bukkit-1.7.2-R0.2-b2974jnks]
            at org.bukkit.scheduler.BukkitRunnable.runTaskTimer(BukkitRunnable.java:
    100) ~[craftbukkit.jar:git-Bukkit-1.7.2-R0.2-b2974jnks]
            at Lobby.Lobby.lobbyLoop(Lobby.java:70) ~[?:?]
            at Commands.Commands.onCommand(Commands.java:115) ~[?:?]
            at org.bukkit.command.PluginCommand.execute(PluginCommand.java:44) ~[cra
    ftbukkit.jar:git-Bukkit-1.7.2-R0.2-b2974jnks]
            ... 13 more
    [10:03:17 WARN]: Can't keep up! Did the system time change, or is the server ove
    rloaded? Running 2265ms behind, skipping 45 tick(s)
    [10:08:18 WARN]: Can't keep up! Did the system time change, or is the server ove
    rloaded? Running 2850ms behind, skipping 57 tick(s)
    >reload
    [10:10:14 INFO]: [PvpParkour] Disabling PvpParkour v1.0
    [10:10:14 INFO]: [PvpParkour] PvpParkour has been disabled.
    [10:10:14 INFO]: [PvpParkour] Loading PvpParkour v1.0
    [10:10:14 INFO]: [PvpParkour] Enabling PvpParkour v1.0
    [10:10:14 INFO]: [PvpParkour] PvpParkour has been enabled.
    [10:10:14 INFO]: Server permissions file permissions.yml is empty, ignoring it
    [10:10:14 INFO]: CONSOLE: Reload complete.
    [10:10:19 INFO]: HiROs15 issued server command: /pvpp joinhub
    [10:10:22 WARN]: Can't keep up! Did the system time change, or is the server ove
    rloaded? Running 2155ms behind, skipping 43 tick(s)
    [10:10:23 INFO]: HiROs15 issued server command: /pvpp join Test
    [10:10:23 ERROR]: null
    org.bukkit.command.CommandException: Unhandled exception executing command 'pvpp
    ' in plugin PvpParkour v1.0
            at org.bukkit.command.PluginCommand.execute(PluginCommand.java:46) ~[cra
    ftbukkit.jar:git-Bukkit-1.7.2-R0.2-b2974jnks]
            at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:19
    6) ~[craftbukkit.jar:git-Bukkit-1.7.2-R0.2-b2974jnks]
            at org.bukkit.craftbukkit.v1_7_R1.CraftServer.dispatchCommand(CraftServe
    r.java:542) ~[craftbukkit.jar:git-Bukkit-1.7.2-R0.2-b2974jnks]
            at net.minecraft.server.v1_7_R1.PlayerConnection.handleCommand(PlayerCon
    nection.java:932) [craftbukkit.jar:git-Bukkit-1.7.2-R0.2-b2974jnks]
            at net.minecraft.server.v1_7_R1.PlayerConnection.a(PlayerConnection.java
    :814) [craftbukkit.jar:git-Bukkit-1.7.2-R0.2-b2974jnks]
            at net.minecraft.server.v1_7_R1.PacketPlayInChat.a(PacketPlayInChat.java
    :28) [craftbukkit.jar:git-Bukkit-1.7.2-R0.2-b2974jnks]
            at net.minecraft.server.v1_7_R1.PacketPlayInChat.handle(PacketPlayInChat
    .java:47) [craftbukkit.jar:git-Bukkit-1.7.2-R0.2-b2974jnks]
            at net.minecraft.server.v1_7_R1.NetworkManager.a(NetworkManager.java:146
    ) [craftbukkit.jar:git-Bukkit-1.7.2-R0.2-b2974jnks]
            at net.minecraft.server.v1_7_R1.ServerConnection.c(SourceFile:134) [craf
    tbukkit.jar:git-Bukkit-1.7.2-R0.2-b2974jnks]
            at net.minecraft.server.v1_7_R1.MinecraftServer.u(MinecraftServer.java:6
    55) [craftbukkit.jar:git-Bukkit-1.7.2-R0.2-b2974jnks]
            at net.minecraft.server.v1_7_R1.DedicatedServer.u(DedicatedServer.java:2
    50) [craftbukkit.jar:git-Bukkit-1.7.2-R0.2-b2974jnks]
            at net.minecraft.server.v1_7_R1.MinecraftServer.t(MinecraftServer.java:5
    45) [craftbukkit.jar:git-Bukkit-1.7.2-R0.2-b2974jnks]
            at net.minecraft.server.v1_7_R1.MinecraftServer.run(MinecraftServer.java
    :457) [craftbukkit.jar:git-Bukkit-1.7.2-R0.2-b2974jnks]
            at net.minecraft.server.v1_7_R1.ThreadServerApplication.run(SourceFile:6
    17) [craftbukkit.jar:git-Bukkit-1.7.2-R0.2-b2974jnks]
    Caused by: java.lang.NullPointerException
            at Lobby.Lobby.lobbyLoop(Lobby.java:66) ~[?:?]
            at Commands.Commands.onCommand(Commands.java:115) ~[?:?]
            at org.bukkit.command.PluginCommand.execute(PluginCommand.java:44) ~[cra
    ftbukkit.jar:git-Bukkit-1.7.2-R0.2-b2974jnks]
            ... 13 more
    And here is my lobby code.
    Code:java
    1. package Lobby;
    2.  
    3. import java.util.HashMap;
    4. import java.util.Map;
    5.  
    6. import org.bukkit.Bukkit;
    7. import org.bukkit.ChatColor;
    8. import org.bukkit.Location;
    9. import org.bukkit.entity.Player;
    10. import org.bukkit.scheduler.BukkitRunnable;
    11. import org.bukkit.scoreboard.Objective;
    12. import org.hiros.pvpparkour.PvpParkour;
    13.  
    14. import DataConfig.DataConfig;
    15. import Hub.Hub;
    16.  
    17. public class Lobby {
    18. public static int maxPlayers = 10;
    19. public static int i = 0;
    20.  
    21. @SuppressWarnings("unused")
    22. private static PvpParkour plugin;
    23. public Lobby(PvpParkour plugin) {
    24. Lobby.plugin = plugin;
    25. }
    26.  
    27. public static HashMap<Player, String> lobby = new HashMap<Player, String>();
    28.  
    29.  
    30. public static void joinLobby(final Player player, final String lob) {
    31. player.getInventory().clear();
    32. Hub.leaveHub(player);
    33.  
    34. Location loc = player.getLocation();
    35. loc.setX(DataConfig.getConfig().getDouble("arenas."+lob+".spawn.x"));
    36. loc.setY(DataConfig.getConfig().getDouble("arenas."+lob+".spawn.y"));
    37. loc.setZ(DataConfig.getConfig().getDouble("arenas."+lob+".spawn.z"));
    38. loc.setWorld(Bukkit.getServer().getWorld(DataConfig.getConfig().getString("arenas."+lob+".spawn.world")));
    39.  
    40. player.teleport(loc);
    41. lobby.put(player, lob);
    42.  
    43. sendMessageToLobby(ChatColor.RED+""+ChatColor.BOLD+""+player.getName()+" "+ChatColor.BLUE+" has joined.", lob);
    44. LobbyScoreboard.showStats(player, lob);
    45. }
    46.  
    47. public static int countPlayersInLobby(String lob) {
    48. int count = 0;
    49. for(Map.Entry<Player, String> entry : lobby.entrySet()) {
    50. if(entry.getValue() == lob) {
    51. count++;
    52. }
    53. }
    54. return count;
    55. }
    56.  
    57. public static void sendMessageToLobby(String msg, String lob) {
    58. for(Map.Entry<Player, String> entry : lobby.entrySet()) {
    59. if(entry.getValue() == lob) {
    60. entry.getKey().sendMessage(msg);
    61. }
    62. }
    63. }
    64.  
    65. public static void lobbyLoop(final Player player, String lob) {
    66. plugin.getServer().getScheduler().scheduleSyncRepeatingTask(plugin, new Runnable() {
    67. public void run() {
    68. player.sendMessage("WTF WORK!");
    69. }
    70. }, 20L, 20L);
    71. }
    72. }
    73.  
     
  2. Offline

    1Rogue

    Remove your static modifiers and make your fields private
     
  3. Offline

    DividedByZero

    Static modifiers to what everything in that file is static.
     
  4. Offline

    Techy4198

    1Rogue likes this.
  5. Offline

    DividedByZero

    Alright i did that and it didnt make a differance. Still the same error.
     
  6. Offline

    Aqua

    Did you instantiate Lobby in your PvpParkour class?
     
  7. Offline

    DividedByZero

    Yes would it be easier to see my whole source on github?
     
  8. Offline

    Aqua

  9. Offline

    DividedByZero

    Alright let me create a github acount and get back to you in a few alright.

    https://github.com/DividedByZeros/PvpParkour/tree/master/PvpParkour/src
    Here is my github respitory

    https://github.com/DividedByZeros/PvpParkour/tree/master/PvpParkour/src

    Here is my github could you tell me what is wrong with it please.

    Anyone gonna try to help?

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 6, 2016
  10. Offline

    1Rogue

  11. Offline

    DividedByZero

    If i remove them i get an error in my compiler because im trying to access them from other classes

    if i change them from static i cant access them from the other classes.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 6, 2016
  12. Offline

    mattibijnens

    DividedByZero Please give everyone some time to respond! Don't bump your thread within 12 Hours, they will be noticed if they are Tagged or if you Quote some of their text!
     
  13. Offline

    1Rogue

Thread Status:
Not open for further replies.

Share This Page