Fix dangling else in the listener, and no more NPEs for setclass command.

This commit is contained in:
garbagemule 2012-09-14 20:16:37 +02:00
parent a94370deec
commit 80018504bc
4 changed files with 15 additions and 12 deletions

Binary file not shown.

View File

@ -1,7 +1,7 @@
name: MobArena
author: garbagemule
main: com.garbagemule.MobArena.MobArena
version: 0.94.4.80
version: 0.94.4.81
softdepend: [Spout,MultiVerse,MultiWorld,XcraftGate,Towny,Heroes,MagicSpells,Vault]
commands:
ma:

View File

@ -607,19 +607,22 @@ public class ArenaListener
}
else if (monsters.getMonsters().contains(event.getEntity())) {
if (event.getReason() == TargetReason.FORGOT_TARGET)
if (event.getReason() == TargetReason.FORGOT_TARGET) {
event.setTarget(MAUtils.getClosestPlayer(plugin, event.getEntity(), arena));
else if (event.getReason() == TargetReason.TARGET_DIED)
}
else if (event.getReason() == TargetReason.TARGET_DIED) {
event.setTarget(MAUtils.getClosestPlayer(plugin, event.getEntity(), arena));
else if (event.getReason() == TargetReason.TARGET_ATTACKED_ENTITY)
if (arena.hasPet(event.getTarget()))
}
else if (event.getReason() == TargetReason.TARGET_ATTACKED_ENTITY) {
if (arena.hasPet(event.getTarget())) {
event.setCancelled(true);
else if (event.getReason() == TargetReason.CLOSEST_PLAYER)
if (!arena.inArena((Player) event.getTarget()))
event.setCancelled(true);
}
}
else if (event.getReason() == TargetReason.CLOSEST_PLAYER) {
if (!arena.inArena((Player) event.getTarget())) {
event.setCancelled(true);
}
}
}
}

View File

@ -390,7 +390,7 @@ public class ArenaMasterImpl implements ArenaMaster
// If the helmet isn't a real helmet, set it explicitly.
ItemStack helmet = inv.getHelmet();
if (helmet.getTypeId() != 0 && ArmorType.getType(helmet) != ArmorType.HELMET) {
if (helmet != null && ArmorType.getType(helmet) != ArmorType.HELMET) {
section.set("helmet", ItemParser.parseString(helmet));
}