0

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.

Kondax Design
  • 175
  • 1
  • 1
  • 15
  • 2
    Have you tried using a debugger? You'd probably figure why `arena` doesn't get initialized properly. – kviiri Nov 17 '13 at 08:44
  • 2
    You are missing code. `getState` is never called. – Paul Draper Nov 17 '13 at 08:45
  • You're calling `getState` with a `null` argument. Post the code that is calling `getState` (and the code that computes the argument to the call). – Ted Hopp Nov 17 '13 at 08:45
  • public static void start(Arena arena){ if((Arena.getState(arena) != ArenaState.STARTED)){ Arena.setState(arena, ArenaState.COUNTING_DOWN); startSecondsarenacountdown(arena); return; } return; } – Kondax Design Nov 17 '13 at 08:50
  • Possible duplicate of [What is a Null Pointer Exception, and how do I fix it?](http://stackoverflow.com/questions/218384/what-is-a-null-pointer-exception-and-how-do-i-fix-it) – Ferrybig Jan 11 '16 at 15:09

1 Answers1

0

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.

ms03
  • 101
  • 4