diff options
author | md_5 <md_5@bigpond.com> | 2012-04-05 20:37:20 +1000 |
---|---|---|
committer | md_5 <md_5@bigpond.com> | 2012-04-05 20:37:20 +1000 |
commit | 3d3b57cb1b10b5e3215f52a3015b830c57111f85 (patch) | |
tree | 6c7b1b597c05b8f508b3e740f7727a3ac05ae501 /EssentialsAntiCheat/src | |
parent | 530c2c4c11f80a1a935c38d6c7faa5aaba697591 (diff) | |
download | Essentials-3d3b57cb1b10b5e3215f52a3015b830c57111f85.tar Essentials-3d3b57cb1b10b5e3215f52a3015b830c57111f85.tar.gz Essentials-3d3b57cb1b10b5e3215f52a3015b830c57111f85.tar.lz Essentials-3d3b57cb1b10b5e3215f52a3015b830c57111f85.tar.xz Essentials-3d3b57cb1b10b5e3215f52a3015b830c57111f85.zip |
Hopefully get the basis of a speed check. This whole idea of checks needs to be cleaned up.
Diffstat (limited to 'EssentialsAntiCheat/src')
6 files changed, 41 insertions, 1 deletions
diff --git a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/blockplace/BlockPlaceCheckListener.java b/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/blockplace/BlockPlaceCheckListener.java index 6896e36c9..501403654 100644 --- a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/blockplace/BlockPlaceCheckListener.java +++ b/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/blockplace/BlockPlaceCheckListener.java @@ -21,6 +21,7 @@ public class BlockPlaceCheckListener implements Listener, EventManager { private final ReachCheck reachCheck; private final DirectionCheck directionCheck; + private final SpeedCheck speedCheck; private final NoCheat plugin; public BlockPlaceCheckListener(NoCheat plugin) @@ -28,6 +29,7 @@ public class BlockPlaceCheckListener implements Listener, EventManager this.plugin = plugin; + speedCheck = new SpeedCheck(plugin); reachCheck = new ReachCheck(plugin); directionCheck = new DirectionCheck(plugin); } @@ -69,6 +71,11 @@ public class BlockPlaceCheckListener implements Listener, EventManager cancelled = directionCheck.check(player, data, cc); } + // Third the speed + if (!cancelled && cc.speedCheck && !player.hasPermission(Permissions.BLOCKPLACE_SPEED)) + { + cancelled = speedCheck.check(player, data, cc); + } // If one of the checks requested to cancel the event, do so if (cancelled) { @@ -76,6 +83,7 @@ public class BlockPlaceCheckListener implements Listener, EventManager } } + @Override public List<String> getActiveChecks(ConfigurationCacheStore cc) { LinkedList<String> s = new LinkedList<String>(); @@ -90,7 +98,10 @@ public class BlockPlaceCheckListener implements Listener, EventManager { s.add("blockplace.direction"); } - + if (bp.speedCheck) + { + s.add("blockplace.speed"); + } return s; } } diff --git a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/blockplace/BlockPlaceConfig.java b/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/blockplace/BlockPlaceConfig.java index 26c8d0f6d..27f1182dd 100644 --- a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/blockplace/BlockPlaceConfig.java +++ b/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/blockplace/BlockPlaceConfig.java @@ -21,9 +21,13 @@ public class BlockPlaceConfig implements ConfigItem public final ActionList directionActions; public final long directionPenaltyTime; public final double directionPrecision; + public final boolean speedCheck; + public final ActionList speedActions; public BlockPlaceConfig(NoCheatConfiguration data) { + speedCheck = data.getBoolean(ConfPaths.BLOCKPLACE_SPEED_CHECK); + speedActions = data.getActionList(ConfPaths.BLOCKPLACE_SPEED_ACTIONS, Permissions.BLOCKPLACE_SPEED); reachCheck = data.getBoolean(ConfPaths.BLOCKPLACE_REACH_CHECK); reachDistance = 535D / 100D; diff --git a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/blockplace/SpeedCheck.java b/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/blockplace/SpeedCheck.java new file mode 100644 index 000000000..405de36bd --- /dev/null +++ b/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/blockplace/SpeedCheck.java @@ -0,0 +1,18 @@ +package com.earth2me.essentials.anticheat.checks.blockplace; + +import com.earth2me.essentials.anticheat.NoCheat; +import com.earth2me.essentials.anticheat.NoCheatPlayer; + + +public class SpeedCheck extends BlockPlaceCheck +{ + public SpeedCheck(NoCheat plugin) + { + super(plugin, "blockplace.speed"); + } + + public boolean check(NoCheatPlayer player, BlockPlaceData data, BlockPlaceConfig cc) + { + return false; + } +} diff --git a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/config/ConfPaths.java b/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/config/ConfPaths.java index c830b390b..747eecad3 100644 --- a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/config/ConfPaths.java +++ b/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/config/ConfPaths.java @@ -84,6 +84,9 @@ public abstract class ConfPaths private final static String BLOCKPLACE = CHECKS + "blockplace."; + public final static String BLOCKPLACE_SPEED = BLOCKPLACE + "speed."; + public final static String BLOCKPLACE_SPEED_CHECK = BLOCKPLACE_SPEED + "active"; + public final static String BLOCKPLACE_SPEED_ACTIONS = BLOCKPLACE_SPEED + "actions"; private final static String BLOCKPLACE_REACH = BLOCKPLACE + "reach."; public final static String BLOCKPLACE_REACH_CHECK = BLOCKPLACE_REACH + "active"; public final static String BLOCKPLACE_REACH_ACTIONS = BLOCKPLACE_REACH + "actions"; diff --git a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/config/Permissions.java b/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/config/Permissions.java index cdd4ba6cd..1551f6f21 100644 --- a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/config/Permissions.java +++ b/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/config/Permissions.java @@ -25,6 +25,7 @@ public class Permissions public static final String BLOCKPLACE = CHECKS + ".blockplace"; public static final String BLOCKPLACE_REACH = BLOCKPLACE + ".reach"; public static final String BLOCKPLACE_DIRECTION = BLOCKPLACE + ".direction"; + public static final String BLOCKPLACE_SPEED = BLOCKPLACE + ".speed"; public static final String CHAT = CHECKS + ".chat"; public static final String CHAT_SPAM = CHAT + ".spam"; public static final String CHAT_COLOR = CHAT + ".color"; diff --git a/EssentialsAntiCheat/src/config.yml b/EssentialsAntiCheat/src/config.yml index ecbbb17c2..b482daf16 100644 --- a/EssentialsAntiCheat/src/config.yml +++ b/EssentialsAntiCheat/src/config.yml @@ -53,6 +53,9 @@ checks: active: true actions: log:bbnoswing:3:2:if cancel blockplace: + speed: + active: true + actions: TODO reach: active: true actions: cancel vl>5 log:bpreach:0:2:if cancel |