NullPointerException.. My favourite
-
21-12-2019 - |
Question
EDIT: I would just like to apologize for my simple mistake.. I'm only 12 :P
I seem to be having the great NullPointerException.. I'm using the Bukkit API, just in case that changed anything ;P Anyway, here's my error:
me.MCMedia.PresidentAssassination.Arena.Arena.getState(Arena.java:52) 17.11 03:29:02 [Server] INFO Caused by: java.lang.NullPointerException
Here's the Arena class..
public Arena(String name) {
this.data = new ArrayList<PlayerData>();
this.name = name;
this.players = Integer.valueOf(Main.getPlugin().getConfig().getString("MaxUsers"));
this.MinPlayers = Integer.valueOf(Main.getPlugin().getConfig().getString("MinUsers"));
this.TaskID = TaskID;
ConfigurationSection spawn = Main.getPlugin().getConfig().getConfigurationSection("Arenas."+name+".spawn");
this.spawnPoint = LocationUtil.locationFromConfig(spawn, true);
this.state = ArenaState.WAITING;
this.playerManager = new PlayerManager(this);
}
public static ArenaState getState(Arena arena) {
>>>> Line 52 <<<< return arena.state;
}
Any help would be greatly appreciated.
Solution
Looks like instance of Arena being passed to static function is NULL.
Try removing static from "public static ArenaState getState()". I think it should be a instance level method. Anyways we have to pass an instance of Arena to this method.
Thanks.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow