diff --git a/plugin.yml b/plugin.yml index 04caffa0..3421d039 100644 --- a/plugin.yml +++ b/plugin.yml @@ -3,7 +3,7 @@ name: NoCheat author: Evenprime main: cc.co.evenprime.bukkit.nocheat.NoCheat -version: 2.08 +version: 2.08a commands: nocheat: diff --git a/src/cc/co/evenprime/bukkit/nocheat/DefaultConfiguration.java b/src/cc/co/evenprime/bukkit/nocheat/DefaultConfiguration.java index 672728dd..0f28f7e1 100644 --- a/src/cc/co/evenprime/bukkit/nocheat/DefaultConfiguration.java +++ b/src/cc/co/evenprime/bukkit/nocheat/DefaultConfiguration.java @@ -58,6 +58,8 @@ public class DefaultConfiguration { root.add(movingNode); movingNode.add(new BooleanOption("check", true, true)); + + movingNode.add(new BooleanOption("identifycreativemode", true, false)); /**** MOVING.WALKING ****/ { @@ -158,6 +160,8 @@ public class DefaultConfiguration { interactNode.add(directionNode); directionNode.add(new BooleanOption("check", true, true)); + + directionNode.add(new BooleanOption("checkinstabreakblocks", false, false)); ActionListOption actions = new ActionListOption("actions"); diff --git a/src/cc/co/evenprime/bukkit/nocheat/Explainations.java b/src/cc/co/evenprime/bukkit/nocheat/Explainations.java index a1a92ff6..0ba620e5 100644 --- a/src/cc/co/evenprime/bukkit/nocheat/Explainations.java +++ b/src/cc/co/evenprime/bukkit/nocheat/Explainations.java @@ -26,8 +26,8 @@ public class Explainations { set("debug.showactivechecks", "Print to the console an overview of all checks that are enabled when NoCheat gets loaded."); set("moving.check", "If true, do various checks on PlayerMove events."); - - + set("moving.identifycreativemode", "If true, NoCheat will automatically identify if players are in creative mode and will allow them to fly, avoid fall damage etc."); + set("moving.runfly.check", "If true, check if a player is walking/sprinting/sneaking/swimming too fast/high."); set("moving.runfly.walkingspeedlimit", "Set the speed limit for moving horizontal under 'normal' conditions.\nUnit is 1/100 of a block, default is 22."); set("moving.runfly.sprintingspeedlimit", "Set the speed limit for moving horizontal while sprinting.\nUnit is 1/100 of a block, default is 40."); @@ -61,6 +61,7 @@ public class Explainations { set("blockbreak.reach.actions", "What should be done if a player is breaking blocks that are too far away.\nUnit is number of break(attempt)s beyond the limit."); set("blockbreak.direction.check", "If true, check if a player is looking at the block that he's breaking."); + set("blockbreak.direction.checkinstabreakblocks", "If true, NoCheat will also check for direction for Instant-Breaking blocks.\nTHIS WILL CAUSE FALSE POSITIVES, when a player keeps his mouse button pressed and moves the mouse fast over the screen."); set("blockbreak.direction.actions", "What should be done if a player is breaking blocks that are not in his line of sight.\nUnit is number of break(attempt)s outside the line of sight."); set("blockplace.check", "If true, do various checks on BlockPlace events."); diff --git a/src/cc/co/evenprime/bukkit/nocheat/checks/blockbreak/BlockBreakCheck.java b/src/cc/co/evenprime/bukkit/nocheat/checks/blockbreak/BlockBreakCheck.java index e52da1ce..72d2f305 100644 --- a/src/cc/co/evenprime/bukkit/nocheat/checks/blockbreak/BlockBreakCheck.java +++ b/src/cc/co/evenprime/bukkit/nocheat/checks/blockbreak/BlockBreakCheck.java @@ -51,8 +51,8 @@ public class BlockBreakCheck { cancel = reachCheck.check(player, factor, data, cc); } - if(!cancel && direction && !brokenBlock.getLocation().equals(data.instaBrokeBlockLocation)) { - cancel = directionCheck.check(player, factor, x1, y1, z1, data, cc); + if(!cancel && direction) { + cancel = directionCheck.check(player, factor, x1, y1, z1, brokenBlock, data, cc); } } return cancel; diff --git a/src/cc/co/evenprime/bukkit/nocheat/checks/blockbreak/DirectionCheck.java b/src/cc/co/evenprime/bukkit/nocheat/checks/blockbreak/DirectionCheck.java index fb133b61..a6cd83ef 100644 --- a/src/cc/co/evenprime/bukkit/nocheat/checks/blockbreak/DirectionCheck.java +++ b/src/cc/co/evenprime/bukkit/nocheat/checks/blockbreak/DirectionCheck.java @@ -2,6 +2,7 @@ package cc.co.evenprime.bukkit.nocheat.checks.blockbreak; import java.util.HashMap; +import org.bukkit.block.Block; import org.bukkit.entity.Player; import org.bukkit.util.Vector; @@ -27,10 +28,15 @@ public class DirectionCheck { this.action = new ActionExecutorWithHistory(plugin); } - public boolean check(Player player, double factor, double x1, double y1, double z1, BlockBreakData data, ConfigurationCache cc) { + public boolean check(Player player, double factor, double x1, double y1, double z1, Block brokenBlock, BlockBreakData data, ConfigurationCache cc) { + // If the block is instabreak and we don't check instabreak, return + if(!cc.blockbreak.checkinstabreakblocks && brokenBlock.getLocation().equals(data.instaBrokeBlockLocation)) { + return false; + } + boolean cancel = false; - + Vector direction = player.getEyeLocation().getDirection(); final double x2 = x1 + 2; final double y2 = y1 + 2; diff --git a/src/cc/co/evenprime/bukkit/nocheat/checks/moving/RunFlyCheck.java b/src/cc/co/evenprime/bukkit/nocheat/checks/moving/RunFlyCheck.java index 5984b5c7..f20a6894 100644 --- a/src/cc/co/evenprime/bukkit/nocheat/checks/moving/RunFlyCheck.java +++ b/src/cc/co/evenprime/bukkit/nocheat/checks/moving/RunFlyCheck.java @@ -72,7 +72,7 @@ public class RunFlyCheck { /************* DECIDE WHICH CHECKS NEED TO BE RUN *************/ final boolean runflyCheck = cc.moving.runflyCheck && !player.hasPermission(Permissions.MOVE_RUNFLY); - final boolean flyAllowed = cc.moving.allowFlying || player.hasPermission(Permissions.MOVE_FLY) || (player.getGameMode() == GameMode.CREATIVE); + final boolean flyAllowed = cc.moving.allowFlying || player.hasPermission(Permissions.MOVE_FLY) || (player.getGameMode() == GameMode.CREATIVE && cc.moving.identifyCreativeMode); final boolean morepacketsCheck = cc.moving.morePacketsCheck && !player.hasPermission(Permissions.MOVE_MOREPACKETS); final boolean noclipCheck = cc.moving.noclipCheck && !player.hasPermission(Permissions.MOVE_NOCLIP); diff --git a/src/cc/co/evenprime/bukkit/nocheat/config/cache/CCBlockBreak.java b/src/cc/co/evenprime/bukkit/nocheat/config/cache/CCBlockBreak.java index a8f0fbac..612c38e5 100644 --- a/src/cc/co/evenprime/bukkit/nocheat/config/cache/CCBlockBreak.java +++ b/src/cc/co/evenprime/bukkit/nocheat/config/cache/CCBlockBreak.java @@ -13,6 +13,7 @@ import cc.co.evenprime.bukkit.nocheat.config.Configuration; public class CCBlockBreak { public final boolean check; + public final boolean checkinstabreakblocks; public final boolean reachCheck; public final double reachDistance; public final ActionList reachActions; @@ -22,11 +23,13 @@ public class CCBlockBreak { public CCBlockBreak(Configuration data) { check = data.getBoolean("blockbreak.check"); + reachCheck = data.getBoolean("blockbreak.reach.check"); reachDistance = ((double) data.getInteger("blockbreak.reach.reachlimit")) / 100D; reachActions = data.getActionList("blockbreak.reach.actions"); directionCheck = data.getBoolean("blockbreak.direction.check"); directionActions = data.getActionList("blockbreak.direction.actions"); + checkinstabreakblocks = data.getBoolean("blockbreak.direction.checkinstabreakblocks"); } } diff --git a/src/cc/co/evenprime/bukkit/nocheat/config/cache/CCMoving.java b/src/cc/co/evenprime/bukkit/nocheat/config/cache/CCMoving.java index d013848a..0721ab19 100644 --- a/src/cc/co/evenprime/bukkit/nocheat/config/cache/CCMoving.java +++ b/src/cc/co/evenprime/bukkit/nocheat/config/cache/CCMoving.java @@ -15,6 +15,7 @@ public class CCMoving { public final boolean check; public final boolean runflyCheck; + public final boolean identifyCreativeMode; public final double walkingSpeedLimit; public final double sprintingSpeedLimit; public final double jumpheight; @@ -41,8 +42,10 @@ public class CCMoving { public CCMoving(Configuration data) { check = data.getBoolean("moving.check"); + identifyCreativeMode = data.getBoolean("moving.identifycreativemode"); runflyCheck = data.getBoolean("moving.runfly.check"); + walkingSpeedLimit = ((double) data.getInteger("moving.runfly.walkingspeedlimit")) / 100D; sprintingSpeedLimit = ((double) data.getInteger("moving.runfly.sprintingspeedlimit")) / 100D; jumpheight = ((double) data.getInteger("moving.runfly.jumpheight")) / 100D;