Fixed issues with columns up/down in mid-air while jumping

This commit is contained in:
h31ix committed 2012-09-30 14:35:48 -04:00
1 parent 8405f4a15e
commit 08a6d29c9e
1 file changed
+29 -29
@@ -80,7 +80,7 @@ public class Backend
private Map<String, Long> movingExempt = new HashMap<String, Long>(); private Map<String, Long> movingExempt = new HashMap<String, Long>();
private Map<String, Long> blockTime = new HashMap<String, Long>(); private Map<String, Long> blockTime = new HashMap<String, Long>();
private Map<String, Integer> blocksDropped = new HashMap<String, Integer>(); private Map<String, Integer> blocksDropped = new HashMap<String, Integer>();
private Magic magic; private Magic magic;
private AnticheatManager micromanage = null; private AnticheatManager micromanage = null;
@@ -137,17 +137,17 @@ public class Backend
velocitytrack.remove(pN); velocitytrack.remove(pN);
animated.remove(pN); animated.remove(pN);
} }
public boolean checkFastBow(Player player, float force) public boolean checkFastBow(Player player, float force)
{ {
int ticks = (int)((((System.currentTimeMillis()-bowWindUp.get(player.getName()))*20)/1000)+3); int ticks = (int)((((System.currentTimeMillis()-bowWindUp.get(player.getName()))*20)/1000)+3);
bowWindUp.remove(player.getName()); bowWindUp.remove(player.getName());
float f = (float) ticks / 20.0F; float f = (float) ticks / 20.0F;
f = (f * f + f * 2.0F) / 3.0F; f = (f * f + f * 2.0F) / 3.0F;
f = f > 1.0F ? 1.0F : f; f = f > 1.0F ? 1.0F : f;
return Math.abs(force-f) > magic.BOW_ERROR; return Math.abs(force-f) > magic.BOW_ERROR;
} }
public boolean checkProjectile(Player player) public boolean checkProjectile(Player player)
{ {
increment(player, projectilesShot, 10); increment(player, projectilesShot, 10);
@@ -164,8 +164,8 @@ public class Backend
return time < magic.PROJECTILE_TIME_MIN; return time < magic.PROJECTILE_TIME_MIN;
} }
return false; return false;
} }
public boolean checkFastDrop(Player player) public boolean checkFastDrop(Player player)
{ {
increment(player, blocksDropped, 10); increment(player, blocksDropped, 10);
@@ -181,7 +181,7 @@ public class Backend
blocksDropped.remove(player.getName()); blocksDropped.remove(player.getName());
return time < magic.DROP_TIME_MIN; return time < magic.DROP_TIME_MIN;
} }
return false; return false;
} }
public boolean checkLongReachBlock(Player player, double x, double y, double z) public boolean checkLongReachBlock(Player player, double x, double y, double z)
@@ -215,7 +215,7 @@ public class Backend
public boolean checkNoFall(Player player, double y) public boolean checkNoFall(Player player, double y)
{ {
String name = player.getName(); String name = player.getName();
if (player.getGameMode() != GameMode.CREATIVE && player.getVehicle() == null && !isMovingExempt(player) && !Utilities.isInWater(player)) if (player.getGameMode() != GameMode.CREATIVE && player.getVehicle() == null && !isMovingExempt(player) && !justPlaced(player) && !Utilities.isInWater(player))
{ {
if (player.getFallDistance() == 0) if (player.getFallDistance() == 0)
{ {
@@ -253,15 +253,15 @@ public class Backend
{ {
boolean speed = false; boolean speed = false;
if (player.isFlying()) if (player.isFlying())
{ {
speed = x > magic.XZ_SPEED_MAX_FLY || z > magic.XZ_SPEED_MAX_FLY; speed = x > magic.XZ_SPEED_MAX_FLY || z > magic.XZ_SPEED_MAX_FLY;
} }
else if (player.hasPotionEffect(PotionEffectType.SPEED)) else if (player.hasPotionEffect(PotionEffectType.SPEED))
{ {
speed = x > magic.XZ_SPEED_MAX_POTION || z > magic.XZ_SPEED_MAX_POTION; speed = x > magic.XZ_SPEED_MAX_POTION || z > magic.XZ_SPEED_MAX_POTION;
} }
else if (player.isSprinting()) else if (player.isSprinting())
{ {
speed = x > magic.XZ_SPEED_MAX_SPRINT || z > magic.XZ_SPEED_MAX_SPRINT; speed = x > magic.XZ_SPEED_MAX_SPRINT || z > magic.XZ_SPEED_MAX_SPRINT;
} }
else else
@@ -416,7 +416,7 @@ public class Backend
return 0; return 0;
} }
if (from == to || from < to) if (from == to || from < to)
{ {
return 0; return 0;
} }
if (Math.round(distance.getYDifference()) < 2) if (Math.round(distance.getYDifference()) < 2)
@@ -506,7 +506,7 @@ public class Backend
//Fix Y axis spam //Fix Y axis spam
return false; return false;
} }
public boolean checkTimer(Player player) public boolean checkTimer(Player player)
{ {
/* /*
@@ -532,7 +532,7 @@ public class Backend
}*/ }*/
return false; return false;
} }
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
@@ -547,22 +547,22 @@ public class Backend
if(head.getRelative(BlockFace.SOUTH).getTypeId() != 0) if(head.getRelative(BlockFace.SOUTH).getTypeId() != 0)
{ {
solid = net.minecraft.server.Block.byId[head.getRelative(BlockFace.SOUTH).getTypeId()].material.isSolid(); solid = net.minecraft.server.Block.byId[head.getRelative(BlockFace.SOUTH).getTypeId()].material.isSolid();
} }
} }
if(!solid) if(!solid)
{ {
if(head.getRelative(BlockFace.EAST).getTypeId() != 0) if(head.getRelative(BlockFace.EAST).getTypeId() != 0)
{ {
solid = net.minecraft.server.Block.byId[head.getRelative(BlockFace.EAST).getTypeId()].material.isSolid(); solid = net.minecraft.server.Block.byId[head.getRelative(BlockFace.EAST).getTypeId()].material.isSolid();
} }
} }
if(!solid) if(!solid)
{ {
if(head.getRelative(BlockFace.WEST).getTypeId() != 0) if(head.getRelative(BlockFace.WEST).getTypeId() != 0)
{ {
solid = net.minecraft.server.Block.byId[head.getRelative(BlockFace.WEST).getTypeId()].material.isSolid(); solid = net.minecraft.server.Block.byId[head.getRelative(BlockFace.WEST).getTypeId()].material.isSolid();
} }
} }
return solid ? true : player.hasLineOfSight(entity); return solid ? true : player.hasLineOfSight(entity);
} }
@@ -579,7 +579,7 @@ public class Backend
if(!isMovingExempt(player) && !Utilities.isInWater(player) && !Utilities.canStand(player.getLocation().getBlock()) && Utilities.cantStandAt(player.getLocation().add(0, -1, 0).getBlock()) && Utilities.cantStandAt(player.getLocation().add(0, -2, 0).getBlock())) if(!isMovingExempt(player) && !Utilities.isInWater(player) && !Utilities.canStand(player.getLocation().getBlock()) && Utilities.cantStandAt(player.getLocation().add(0, -1, 0).getBlock()) && Utilities.cantStandAt(player.getLocation().add(0, -2, 0).getBlock()))
{ {
Block block = player.getLocation().getBlock(); Block block = player.getLocation().getBlock();
//Check if the player is climbing up water. //Check if the player is climbing up water.
if(block.getRelative(BlockFace.NORTH).isLiquid() || block.getRelative(BlockFace.SOUTH).isLiquid() || block.getRelative(BlockFace.EAST).isLiquid() || block.getRelative(BlockFace.WEST).isLiquid()) if(block.getRelative(BlockFace.NORTH).isLiquid() || block.getRelative(BlockFace.SOUTH).isLiquid() || block.getRelative(BlockFace.EAST).isLiquid() || block.getRelative(BlockFace.WEST).isLiquid())
{ {
if(y1 < y2) if(y1 < y2)
@@ -635,7 +635,7 @@ public class Backend
max += 12; max += 12;
} }
Block block = player.getLocation().getBlock(); Block block = player.getLocation().getBlock();
if (!isMovingExempt(player) && !Utilities.isInWater(player) && !Utilities.isClimbableBlock(player.getLocation().getBlock()) && !player.isInsideVehicle()) if (!isMovingExempt(player) && !Utilities.isInWater(player) && !justBroke(player) && !Utilities.isClimbableBlock(player.getLocation().getBlock()) && !player.isInsideVehicle())
{ {
String name = player.getName(); String name = player.getName();
if (y1 < y2) if (y1 < y2)
@@ -831,7 +831,7 @@ public class Backend
{ {
long l = lastHeal.get(player.getName()); long l = lastHeal.get(player.getName());
lastHeal.remove(player.getName()); lastHeal.remove(player.getName());
return (System.currentTimeMillis()-l) < magic.HEAL_TIME_MIN; return (System.currentTimeMillis()-l) < magic.HEAL_TIME_MIN;
} }
return false; return false;
} }
@@ -996,17 +996,17 @@ public class Backend
case 2: case 2:
time = magic.KNOCKBACK_DAMAGE_TIME; time = magic.KNOCKBACK_DAMAGE_TIME;
break; break;
case 3: case 3:
time = magic.EXPLOSION_DAMAGE_TIME; time = magic.EXPLOSION_DAMAGE_TIME;
break; break;
default: default:
time = magic.DAMAGE_TIME; time = magic.DAMAGE_TIME;
break; break;
} }
movingExempt.put(player.getName(), System.currentTimeMillis()+time); movingExempt.put(player.getName(), System.currentTimeMillis()+time);
// Only map in which termination time is calculated beforehand. // Only map in which termination time is calculated beforehand.
} }
public void logEnterExit(final Player player) public void logEnterExit(final Player player)
{ {
@@ -1059,7 +1059,7 @@ public class Backend
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
private void logEvent(@SuppressWarnings("rawtypes") final Map map, final Player player, final Object obj, long time) private void logEvent(@SuppressWarnings("rawtypes") final Map map, final Player player, final Object obj, long time)
{ {
map.put(player.getName(), obj); map.put(player.getName(), obj);
micromanage.getPlugin().getServer().getScheduler().scheduleSyncDelayedTask(micromanage.getPlugin(), new Runnable() micromanage.getPlugin().getServer().getScheduler().scheduleSyncDelayedTask(micromanage.getPlugin(), new Runnable()
{ {
@@ -1077,7 +1077,7 @@ public class Backend
} }
}, time); }, time);
} }
private boolean isDoing(Player player, Map<String, Long> map, double max) private boolean isDoing(Player player, Map<String, Long> map, double max)
{ {
if(map.containsKey(player.getName())) if(map.containsKey(player.getName()))
@@ -1100,7 +1100,7 @@ public class Backend
if(map.get(player.getName()) < System.currentTimeMillis()) if(map.get(player.getName()) < System.currentTimeMillis())
{ {
map.remove(player.getName()); map.remove(player.getName());
return false; return false;
} }
else else
{ {
@@ -1111,7 +1111,7 @@ public class Backend
else else
{ {
return false; return false;
} }
} }
private void checkChatLevel(Player player, int amount) private void checkChatLevel(Player player, int amount)