fixed npe for onPlayerRespawn

This commit is contained in:
Redecouverte 2011-02-26 12:00:02 +01:00
parent d02c5057c6
commit a258400443

View File

@ -260,17 +260,22 @@ public void onPlayerRespawn(PlayerRespawnEvent event) {
String spawnconfig = regions.getAreaFlag("spawn", "settings", true, null); String spawnconfig = regions.getAreaFlag("spawn", "settings", true, null);
Location spawn = regions.getLocationAreaFlag("spawn", player.getServer(), true, null); Location spawn = regions.getLocationAreaFlag("spawn", player.getServer(), true, null);
if (spawnconfig.equals("owner")) { if (spawn != null) {
if (regions.isOwner(localPlayer)) { if (spawnconfig != null) {
if (spawnconfig.equals("owner")) {
if (regions.isOwner(localPlayer)) {
player.teleportTo(spawn);
}
} else if (spawnconfig.equals("member")) {
if (regions.isMember(localPlayer)) {
player.teleportTo(spawn);
}
} else {
player.teleportTo(spawn);
}
} else {
player.teleportTo(spawn); player.teleportTo(spawn);
} }
} else if (spawnconfig.equals("member")) {
if (regions.isMember(localPlayer)) {
player.teleportTo(spawn);
}
} else {
player.teleportTo(spawn);
} }
} }
} }