Don't allow non-entites to damage players in spawn. Fixes #696

This commit is contained in:
cmastudios 2013-10-27 16:10:34 -05:00
parent a039e65a8a
commit 215551ec15

View File

@ -254,6 +254,11 @@ public class WarEntityListener implements Listener {
Player d = (Player) defender; Player d = (Player) defender;
Warzone defenderWarzone = Warzone.getZoneByPlayerName(d.getName()); Warzone defenderWarzone = Warzone.getZoneByPlayerName(d.getName());
if (d != null && defenderWarzone != null && event.getDamage() >= d.getHealth()) { if (d != null && defenderWarzone != null && event.getDamage() >= d.getHealth()) {
LoadoutSelection defenderLoadoutState = defenderWarzone.getLoadoutSelections().get(d.getName());
if (defenderLoadoutState != null && defenderLoadoutState.isStillInSpawn()) {
event.setCancelled(true);
return;
}
if (defenderWarzone.getReallyDeadFighters().contains(d.getName())) { if (defenderWarzone.getReallyDeadFighters().contains(d.getName())) {
// don't re-kill a dead person // don't re-kill a dead person
if (d.getHealth() != 0) { if (d.getHealth() != 0) {