fix an NPE, order matters!

This commit is contained in:
Brian
2012-06-07 21:17:02 -04:00
parent cb06e2cb1e
commit dd2ec4c157
2 changed files with 7 additions and 8 deletions
BIN
View File
Binary file not shown.
@@ -792,9 +792,13 @@ public class ArenaListener
ArenaClass oldAC = arena.getArenaPlayer(p).getArenaClass(); ArenaClass oldAC = arena.getArenaPlayer(p).getArenaClass();
ArenaClass newAC = arena.getClasses().get(className); ArenaClass newAC = arena.getClasses().get(className);
// If they picked the same sign, don't do anything // If they already had a class, make sure to change the "in use" in the Class Limit Manager
if (oldAC.equals(newAC)) { if (oldAC != null) {
return; // If they picked the same sign, don't do anything
if (oldAC.equals(newAC)) {
return;
}
classLimits.playerChangedClass(oldAC);
} }
// If they can not join the class, deny them // If they can not join the class, deny them
@@ -803,11 +807,6 @@ public class ArenaListener
return; return;
} }
// If they already had a class, make sure to change the "in use" in the Class Limit Manager
if (oldAC != null) {
classLimits.playerChangedClass(oldAC);
}
// Increment the "in use" in the Class Limit Manager // Increment the "in use" in the Class Limit Manager
classLimits.playerPickedClass(newAC); classLimits.playerPickedClass(newAC);