I seem to get NullPointerExceptions in this piece of code. I seriously tried to fix it from many ways, but here i go: This is onEnable: Code:java for (Player player : getServer().getOnlinePlayers()) {this.players.put(player.getName(),new User(this, player.getName()));} And then i call this method: Code:java public static User getUser(Player player) {return players.containsKey(player.getName()) ? (User) players.get(player.getName()) : null;} And that method points a NullPointer
es359 Code:java Caused by: java.lang.NullPointerExceptionat com.piko.minigame.Main.getUser(Main.java:47) ~[?:?]at com.piko.minigame.Commands.onCommand(Commands.java:183) ~[?:?]at org.bukkit.command.PluginCommand.execute(PluginCommand.java:44) ~[minecraft_server.jar:git-Bukkit-1.7.2-R0.3-14-g8f8716c-b3042jnks]... 13 more The command simply tries to get the user
es359 Code:java return players.containsKey(player.getName()) ? (User) players That line is in the getUser method