From c4cbff5bef7087d31d754546da58f15e9eaffba3 Mon Sep 17 00:00:00 2001 From: Evenprime Date: Sat, 12 Mar 2011 17:12:26 +0100 Subject: [PATCH] Set minimum "freemoves" to 1 and made neccessary codechanges to support that. --- plugin.yml | 2 +- .../evenprime/bukkit/nocheat/NoCheatConfiguration.java | 4 ++++ .../evenprime/bukkit/nocheat/checks/MovingCheck.java | 10 +++++----- .../nocheat/listeners/NoCheatEntityListener.java | 4 ---- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/plugin.yml b/plugin.yml index 618a57a0..3c081904 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.7a +version: 0.6.7b commands: nocheat: diff --git a/src/cc/co/evenprime/bukkit/nocheat/NoCheatConfiguration.java b/src/cc/co/evenprime/bukkit/nocheat/NoCheatConfiguration.java index 21f8c779..6cd96be0 100644 --- a/src/cc/co/evenprime/bukkit/nocheat/NoCheatConfiguration.java +++ b/src/cc/co/evenprime/bukkit/nocheat/NoCheatConfiguration.java @@ -119,6 +119,9 @@ public class NoCheatConfiguration { airbuildAction = c.getString("airbuild.action", "logmed deny"); + // 1 is minimum. This is needed to smooth over some minecraft bugs like + // when a minecart gets broken while a player is inside it (which causes the player to "move" + // up 1.0D which is much more than a usual jump would allow in 1 event if(movingFreeMoves < 1) movingFreeMoves = 1; } @@ -175,6 +178,7 @@ public class NoCheatConfiguration { w.write(" high: loghigh reset"); w.newLine(); w.write("# Moving specific optionse") ;w.newLine(); w.write("moving:"); w.newLine(); + w.write("# After how many minor violations should the plugin react (minimum 1)"); w.newLine(); w.write(" freemoves: 5"); w.newLine(); w.write("# Moving Action, one or more of 'loglow logmed loghigh reset'"); w.newLine(); w.write(" action:"); w.newLine(); diff --git a/src/cc/co/evenprime/bukkit/nocheat/checks/MovingCheck.java b/src/cc/co/evenprime/bukkit/nocheat/checks/MovingCheck.java index e307f701..034e7091 100644 --- a/src/cc/co/evenprime/bukkit/nocheat/checks/MovingCheck.java +++ b/src/cc/co/evenprime/bukkit/nocheat/checks/MovingCheck.java @@ -290,17 +290,17 @@ public class MovingCheck { actions = NoCheatConfiguration.movingActionMinor; // React only after the freebee illegal moves have all been used - if(data.movingMinorViolationsInARow % (NoCheatConfiguration.movingFreeMoves) != 0) { + if(data.movingMinorViolationsInARow <= NoCheatConfiguration.movingFreeMoves) { vl = null; actions = null; } - if(data.movingMinorViolationsInARow != NoCheatConfiguration.movingFreeMoves) { + if(data.movingMinorViolationsInARow > NoCheatConfiguration.movingFreeMoves+1) { log = false; } - // using up all free moves 4 times in a row counts as one normal violation - if(data.movingMinorViolationsInARow % (NoCheatConfiguration.movingFreeMoves * 4) == 0) { + // after a set number of minor violations a normal violation gets thrown + if(data.movingMinorViolationsInARow % 40 == 0) { vl = Level.WARNING; log = true; } @@ -361,7 +361,7 @@ public class MovingCheck { NoCheatPlugin.logAction(NoCheatConfiguration.movingActionNormal, "Moving violation ended: "+event.getPlayer().getName()+ " total Events: "+ data.movingNormalViolationsInARow); data.movingNormalViolationsInARow = 0; } - if(data.movingMinorViolationsInARow > NoCheatConfiguration.movingFreeMoves) { + if(data.movingMinorViolationsInARow > NoCheatConfiguration.movingFreeMoves +1) { NoCheatPlugin.logAction(NoCheatConfiguration.movingActionMinor, "Moving violation ended: "+event.getPlayer().getName()+ " total Events: "+ data.movingMinorViolationsInARow); data.movingMinorViolationsInARow = 0; } diff --git a/src/cc/co/evenprime/bukkit/nocheat/listeners/NoCheatEntityListener.java b/src/cc/co/evenprime/bukkit/nocheat/listeners/NoCheatEntityListener.java index 7d318636..f5f05174 100644 --- a/src/cc/co/evenprime/bukkit/nocheat/listeners/NoCheatEntityListener.java +++ b/src/cc/co/evenprime/bukkit/nocheat/listeners/NoCheatEntityListener.java @@ -18,9 +18,5 @@ public class NoCheatEntityListener extends EntityListener { NoCheatPlugin.getPlayerData(p).movingJumpPhase = 0; } - - } - - }