Added Entity damage checking to the Forcefield check

This commit is contained in:
H31IX committed 2012-09-03 21:07:12 -04:00
1 parent 16aa24d37d
commit 96692b5bbb
2 files changed
+15

No files matched your search

@@ -165,6 +165,15 @@ public class EntityListener extends EventListener
noHack = false;
}
}
if (checkManager.willCheck(player, CheckType.FORCEFIELD))
{
if(!backend.checkSight(player, e.getEntity()))
{
event.setCancelled(!config.silentMode());
log("tried to damage an entity that they couldn't see.", player, CheckType.FORCEFIELD);
noHack = false;
}
}
if (noHack)
{
decrease(player);
@@ -32,6 +32,7 @@ import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.event.player.PlayerToggleSprintEvent;
import org.bukkit.potion.PotionEffectType;
@@ -648,6 +649,11 @@ public class Backend
}*/
return false;
}
public boolean checkSight(Player player, Entity entity)
{
return player.hasLineOfSight(entity);
}
public boolean checkFlight(Player player, Distance distance)
{