Final changes to moving-check + version bump

This commit is contained in:
Evenprime 2011-03-09 18:32:42 +01:00
parent ad9d14dee1
commit 5df7af20b3
3 changed files with 20 additions and 14 deletions

View File

@ -3,7 +3,7 @@ name: NoCheatPlugin
author: Evenprime
main: cc.co.evenprime.bukkit.nocheat.NoCheatPlugin
version: 0.6.4c
version: 0.6.5
commands:
nocheat:

View File

@ -169,7 +169,7 @@ public class MovingCheck {
// the array each contains [lowerX, higherX, Y, lowerZ, higherZ]
int fromValues[] = {lowerBorder(from.getX()), upperBorder(from.getX()), from.getBlockY(), lowerBorder(from.getZ()),upperBorder(from.getZ()) };
int toValues[] = {lowerBorder(to.getX()), upperBorder(to.getX()), to.getBlockY(), lowerBorder(to.getZ()), upperBorder(to.getZ()) };
// compare locations to the world to guess if the player is standing on the ground, a half-block or next to a ladder
boolean onGroundFrom = playerIsOnGround(from.getWorld(), fromValues, from);
boolean onGroundTo = playerIsOnGround(from.getWorld(), toValues, to);
@ -453,19 +453,27 @@ public class MovingCheck {
return d > (double)i ? i : i - 1;
}
public static int lowerBorder(double d1) {
public static int lowerBorder(double d1) {
double floor = Math.floor(d1);
double d4 = (d1 - floor) - magic;
//System.out.println(d4);
return (int) (floor + d4);
double d4 = floor + magic;
if(d4 <= d1)
d4 = 0;
else
d4 = 1;
return (int) (floor - d4);
}
public static int upperBorder(double d1) {
double floor = Math.floor(d1);
double d4 = (d1 - floor) - magic2;
//System.out.println(d4);
int tmp = (int) (floor - d4);
double d4 = floor + magic2;
return tmp < floor ? tmp + 2 : (int)floor ;
if(d4 < d1)
d4 = -1;
else
d4 = 0;
return (int) (floor - d4);
}
}

View File

@ -11,11 +11,9 @@ import cc.co.evenprime.bukkit.nocheat.NoCheatPlugin;
public class NoCheatEntityListener extends EntityListener {
@Override
public void onEntityDamage(EntityDamageEvent event) {
public void onEntityDamage(EntityDamageEvent event) {
if(event.getEntity() instanceof Player) {
if(event.getEntity() instanceof Player) {
Player p = (Player)event.getEntity();
NoCheatPlugin.getPlayerData(p).movingJumpPhase = 0;