From 624e04393fc7331d416cbc7fd6ccbe549a45a513 Mon Sep 17 00:00:00 2001 From: Evenprime Date: Sat, 20 Aug 2011 20:00:43 +0200 Subject: [PATCH] Fixed behaviour of ladders that don't fully connect to the ground --- plugin.yml | 2 +- .../nocheat/checks/MovingEventHelper.java | 25 +++++++++++++------ 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/plugin.yml b/plugin.yml index 9495265b..f5cdef44 100644 --- a/plugin.yml +++ b/plugin.yml @@ -3,7 +3,7 @@ name: NoCheat author: Evenprime main: cc.co.evenprime.bukkit.nocheat.NoCheat -version: 1.13b +version: 1.13c softdepend: [ Permissions, CraftIRC ] diff --git a/src/cc/co/evenprime/bukkit/nocheat/checks/MovingEventHelper.java b/src/cc/co/evenprime/bukkit/nocheat/checks/MovingEventHelper.java index 24d807b0..1921dab6 100644 --- a/src/cc/co/evenprime/bukkit/nocheat/checks/MovingEventHelper.java +++ b/src/cc/co/evenprime/bukkit/nocheat/checks/MovingEventHelper.java @@ -130,7 +130,10 @@ public class MovingEventHelper { if(isLiquid(standingIn) || isLiquid(headIn)) { return LIQUID; } - + + if(isLadder(standingIn) || isLadder(headIn)) { + return LADDER; + } int standingOn = types[world.getBlockTypeIdAt(x, y - 1, z)]; @@ -140,7 +143,7 @@ public class MovingEventHelper { } // Player standing on a block? - if((isSolid(standingOn) || types[world.getBlockTypeIdAt(x, y - 2, z)] == FENCE) && isNonSolid(standingIn) && standingOn != FENCE) { + if((isLadder(headIn) || isLadder(standingIn)) || ((isSolid(standingOn) || types[world.getBlockTypeIdAt(x, y - 2, z)] == FENCE) && isNonSolid(standingIn) && standingOn != FENCE)) { result |= ONGROUND; } @@ -158,7 +161,19 @@ public class MovingEventHelper { private final boolean isNonSolid(int value) { return((value & NONSOLID) == NONSOLID); } + + public final boolean isLadder(int value) { + return((value & LADDER) == LADDER); + } + public boolean isOnGround(int fromType) { + return isLadder(fromType) || (fromType & ONGROUND) == ONGROUND; + } + + public boolean isInGround(int fromType) { + return isLadder(fromType) || isLiquid(fromType) || (fromType & INGROUND) == INGROUND; + } + /** * Personal Rounding function to determine if a player is still touching a * block or not @@ -199,11 +214,5 @@ public class MovingEventHelper { return (int) (floor - d4); } - public boolean isOnGround(int fromType) { - return (fromType & ONGROUND) == ONGROUND; - } - public boolean isInGround(int fromType) { - return isLiquid(fromType) || (fromType & INGROUND) == INGROUND; - } }