diff --git a/plugin.yml b/plugin.yml index 622b91c9..57c1cb1b 100644 --- a/plugin.yml +++ b/plugin.yml @@ -3,7 +3,7 @@ name: NoCheatPlugin author: Evenprime main: cc.co.evenprime.bukkit.nocheat.NoCheatPlugin -version: 0.6.9a +version: 0.6.9b commands: nocheat: diff --git a/src/cc/co/evenprime/bukkit/nocheat/NoCheatData.java b/src/cc/co/evenprime/bukkit/nocheat/NoCheatData.java index 7befd615..5259ae38 100644 --- a/src/cc/co/evenprime/bukkit/nocheat/NoCheatData.java +++ b/src/cc/co/evenprime/bukkit/nocheat/NoCheatData.java @@ -19,6 +19,8 @@ public class NoCheatData { public int movingMinorViolationsInARow = 0; public int movingNormalViolationsInARow = 0; public int movingHeavyViolationsInARow = 0; + + public int movingHorizFreeMoves = 4; public Location movingSetBackPoint = null; public long speedhackLastCheck = System.currentTimeMillis(); // timestamp of last check for speedhacks diff --git a/src/cc/co/evenprime/bukkit/nocheat/NoCheatPlugin.java b/src/cc/co/evenprime/bukkit/nocheat/NoCheatPlugin.java index ae9ac57e..fbee470b 100644 --- a/src/cc/co/evenprime/bukkit/nocheat/NoCheatPlugin.java +++ b/src/cc/co/evenprime/bukkit/nocheat/NoCheatPlugin.java @@ -16,7 +16,6 @@ import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.PluginManager; import cc.co.evenprime.bukkit.nocheat.listeners.NoCheatBlockListener; -import cc.co.evenprime.bukkit.nocheat.listeners.NoCheatEntityListener; import cc.co.evenprime.bukkit.nocheat.listeners.NoCheatPlayerListener; import com.ensifera.animosity.craftirc.CraftIRC; @@ -37,7 +36,6 @@ public class NoCheatPlugin extends JavaPlugin { // Various listeners needed for different Checks private NoCheatPlayerListener playerListener; private NoCheatBlockListener blockListener; - private NoCheatEntityListener entityListener; // My main logger private static Logger consoleLogger; @@ -138,7 +136,6 @@ public class NoCheatPlugin extends JavaPlugin { // Create our listeners and feed them with neccessary information playerListener = new NoCheatPlayerListener(); blockListener = new NoCheatBlockListener(); - entityListener = new NoCheatEntityListener(); fileLogger = NoCheatConfiguration.logger; consoleLogger = Logger.getLogger("Minecraft"); @@ -148,7 +145,6 @@ public class NoCheatPlugin extends JavaPlugin { pm.registerEvent(Event.Type.PLAYER_QUIT, playerListener, Priority.Monitor, this); // used to delete old data of users pm.registerEvent(Event.Type.BLOCK_PLACED, blockListener, Priority.Low, this); // used for airbuild check pm.registerEvent(Event.Type.PLAYER_TELEPORT, playerListener, Priority.Lowest, this); // used for moving, speedhack and teleportfrombed check - pm.registerEvent(Event.Type.ENTITY_DAMAGED, entityListener, Priority.Lowest, this); // used for moving check to reset jumping phase PluginDescriptionFile pdfFile = this.getDescription(); diff --git a/src/cc/co/evenprime/bukkit/nocheat/checks/MovingCheck.java b/src/cc/co/evenprime/bukkit/nocheat/checks/MovingCheck.java index 6e55f88b..5d5556a1 100644 --- a/src/cc/co/evenprime/bukkit/nocheat/checks/MovingCheck.java +++ b/src/cc/co/evenprime/bukkit/nocheat/checks/MovingCheck.java @@ -175,7 +175,13 @@ public class MovingCheck { vl = max(vl, Level.WARNING); } else if(combined > movingDistanceLow) { - vl = max(vl, Level.INFO); + if(data.movingHorizFreeMoves > 0) { + data.movingHorizFreeMoves--; + } + else vl = max(vl, Level.INFO); + } + else{ + data.movingHorizFreeMoves = 4; } // pre-calculate boundary values that are needed multiple times in the following checks diff --git a/src/cc/co/evenprime/bukkit/nocheat/listeners/NoCheatEntityListener.java b/src/cc/co/evenprime/bukkit/nocheat/listeners/NoCheatEntityListener.java deleted file mode 100644 index f5f05174..00000000 --- a/src/cc/co/evenprime/bukkit/nocheat/listeners/NoCheatEntityListener.java +++ /dev/null @@ -1,22 +0,0 @@ -package cc.co.evenprime.bukkit.nocheat.listeners; - - -import org.bukkit.entity.Player; -import org.bukkit.event.entity.EntityDamageEvent; -import org.bukkit.event.entity.EntityListener; - -import cc.co.evenprime.bukkit.nocheat.NoCheatPlugin; - - -public class NoCheatEntityListener extends EntityListener { - - @Override - public void onEntityDamage(EntityDamageEvent event) { - - if(event.getEntity() instanceof Player) { - Player p = (Player)event.getEntity(); - - NoCheatPlugin.getPlayerData(p).movingJumpPhase = 0; - } - } -} diff --git a/src/cc/co/evenprime/bukkit/nocheat/listeners/NoCheatPlayerListener.java b/src/cc/co/evenprime/bukkit/nocheat/listeners/NoCheatPlayerListener.java index 38ed7706..17f9e329 100644 --- a/src/cc/co/evenprime/bukkit/nocheat/listeners/NoCheatPlayerListener.java +++ b/src/cc/co/evenprime/bukkit/nocheat/listeners/NoCheatPlayerListener.java @@ -49,6 +49,7 @@ public class NoCheatPlayerListener extends PlayerListener { if(!event.isCancelled()) { NoCheatData data = NoCheatPlugin.getPlayerData(event.getPlayer()); + // If it wasn't our plugin that ordered the teleport, forget all our information to start from scratch at the new location if(!event.getTo().equals(data.movingSetBackPoint) && !event.getTo().equals(data.speedhackSetBackPoint)) { data.speedhackSetBackPoint = null; data.movingSetBackPoint = null;