Fixed enderman and other entity forcefield false-positives

This commit is contained in:
h31ix committed 2012-10-05 17:16:38 -04:00
1 parent 246af0b3aa
commit 989540d73b
2 files changed
+3 -2

No files matched your search

@@ -387,7 +387,7 @@ public class PlayerListener extends EventListener
{ {
if (!config.silentMode()) if (!config.silentMode())
{ {
event.setTo(from); player.teleport(player.getLocation().add(0, -1, 0));
} }
log("tried to walk on water.", player, CheckType.WATER_WALK); log("tried to walk on water.", player, CheckType.WATER_WALK);
} }
@@ -32,6 +32,7 @@ import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.block.BlockFace; import org.bukkit.block.BlockFace;
import org.bukkit.craftbukkit.entity.CraftEntity;
import org.bukkit.enchantments.Enchantment; import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@@ -542,7 +543,7 @@ public class Backend
public boolean checkSight(Player player, Entity entity) public boolean checkSight(Player player, Entity entity)
{ {
// Check to make sure the entity's head is not surrounded // Check to make sure the entity's head is not surrounded
Block head = entity.getLocation().add(0, 1, 0).getBlock(); Block head = entity.getWorld().getBlockAt((int)entity.getLocation().getX(), (int)((CraftEntity)entity).getHandle().getHeadHeight(), (int)entity.getLocation().getZ());
boolean solid = false; boolean solid = false;
if(head.getRelative(BlockFace.NORTH).getTypeId() != 0) if(head.getRelative(BlockFace.NORTH).getTypeId() != 0)
{ {