diff --git a/src/fr/neatmonster/nocheatplus/checks/CheckType.java b/src/fr/neatmonster/nocheatplus/checks/CheckType.java index 9f839d9f..0fc02dd9 100644 --- a/src/fr/neatmonster/nocheatplus/checks/CheckType.java +++ b/src/fr/neatmonster/nocheatplus/checks/CheckType.java @@ -40,7 +40,6 @@ public enum CheckType { BLOCKINTERACT(BlockInteractConfig.class, BlockInteractData.class), BLOCKINTERACT_DIRECTION(BLOCKINTERACT, "direction", Permissions.BLOCKINTERACT_DIRECTION), - BLOCKINTERACT_NOSWING(BLOCKINTERACT, "noSwing", Permissions.BLOCKINTERACT_NOSWING), BLOCKINTERACT_REACH(BLOCKINTERACT, "reach", Permissions.BLOCKINTERACT_REACH), BLOCKPLACE(BlockPlaceConfig.class, BlockPlaceData.class), diff --git a/src/fr/neatmonster/nocheatplus/checks/blockbreak/Reach.java b/src/fr/neatmonster/nocheatplus/checks/blockbreak/Reach.java index 061b551a..2e16dfe3 100644 --- a/src/fr/neatmonster/nocheatplus/checks/blockbreak/Reach.java +++ b/src/fr/neatmonster/nocheatplus/checks/blockbreak/Reach.java @@ -46,7 +46,6 @@ public class Reach extends Check { * @return true, if successful */ public boolean check(final Player player, final Location location) { - BlockBreakConfig.getConfig(player); final BlockBreakData data = BlockBreakData.getData(player); boolean cancel = false; diff --git a/src/fr/neatmonster/nocheatplus/checks/blockinteract/BlockInteractConfig.java b/src/fr/neatmonster/nocheatplus/checks/blockinteract/BlockInteractConfig.java index 0a76c1f2..dde5f2a7 100644 --- a/src/fr/neatmonster/nocheatplus/checks/blockinteract/BlockInteractConfig.java +++ b/src/fr/neatmonster/nocheatplus/checks/blockinteract/BlockInteractConfig.java @@ -62,9 +62,6 @@ public class BlockInteractConfig { public final boolean directionCheck; public final ActionList directionActions; - public final boolean noSwingCheck; - public final ActionList noSwingActions; - public final boolean reachCheck; public final ActionList reachActions; @@ -79,9 +76,6 @@ public class BlockInteractConfig { directionActions = data.getActionList(ConfPaths.BLOCKINTERACT_DIRECTION_ACTIONS, Permissions.BLOCKINTERACT_DIRECTION); - noSwingCheck = data.getBoolean(ConfPaths.BLOCKINTERACT_NOSWING_CHECK); - noSwingActions = data.getActionList(ConfPaths.BLOCKINTERACT_NOSWING_ACTIONS, Permissions.BLOCKINTERACT_NOSWING); - reachCheck = data.getBoolean(ConfPaths.BLOCKINTERACT_REACH_CHECK); reachActions = data.getActionList(ConfPaths.BLOCKINTERACT_REACH_ACTIONS, Permissions.BLOCKINTERACT_REACH); } diff --git a/src/fr/neatmonster/nocheatplus/checks/blockinteract/BlockInteractData.java b/src/fr/neatmonster/nocheatplus/checks/blockinteract/BlockInteractData.java index c6a866e8..654bfc78 100644 --- a/src/fr/neatmonster/nocheatplus/checks/blockinteract/BlockInteractData.java +++ b/src/fr/neatmonster/nocheatplus/checks/blockinteract/BlockInteractData.java @@ -44,14 +44,9 @@ public class BlockInteractData { } // Violation levels. - public double directionVL; - public double noSwingVL; - public double reachVL; - - // Data of the no swing check. - public boolean noSwingArmSwung; - public long noSwingLastTime; + public double directionVL; + public double reachVL; // Data of the reach check. - public double reachDistance; + public double reachDistance; } diff --git a/src/fr/neatmonster/nocheatplus/checks/blockinteract/BlockInteractListener.java b/src/fr/neatmonster/nocheatplus/checks/blockinteract/BlockInteractListener.java index cf2d9a87..3ad7b0c3 100644 --- a/src/fr/neatmonster/nocheatplus/checks/blockinteract/BlockInteractListener.java +++ b/src/fr/neatmonster/nocheatplus/checks/blockinteract/BlockInteractListener.java @@ -1,15 +1,11 @@ package fr.neatmonster.nocheatplus.checks.blockinteract; -import java.util.Arrays; - -import org.bukkit.Material; import org.bukkit.block.Block; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; import org.bukkit.event.block.Action; -import org.bukkit.event.player.PlayerAnimationEvent; import org.bukkit.event.player.PlayerInteractEvent; /* @@ -35,37 +31,8 @@ import org.bukkit.event.player.PlayerInteractEvent; * @see BlockInteractEvent */ public class BlockInteractListener implements Listener { - private final Direction direction = new Direction(); - private final NoSwing noSwing = new NoSwing(); - private final Reach reach = new Reach(); - - private final Material[] materials = new Material[] {Material.BED_BLOCK, Material.BURNING_FURNACE, - Material.BREWING_STAND, Material.CAKE_BLOCK, Material.CAULDRON, Material.CHEST, Material.DIODE_BLOCK_OFF, - Material.DIODE_BLOCK_ON, Material.DISPENSER, Material.DRAGON_EGG, Material.ENCHANTMENT_TABLE, - Material.ENDER_CHEST, Material.FENCE_GATE, Material.FURNACE, Material.IRON_DOOR_BLOCK, Material.LEVER, - Material.NOTE_BLOCK, Material.STONE_BUTTON, Material.TRAP_DOOR, Material.WOODEN_DOOR, Material.WORKBENCH}; - - /** - * We listen to PlayerAnimation events because it is (currently) equivalent to "player swings arm" and we want to - * check if he did that between interactions with blocks. - * - * @param event - * the event - */ - @EventHandler( - priority = EventPriority.MONITOR) - public void onPlayerAnimation(final PlayerAnimationEvent event) { - /* - * ____ _ _ _ _ _ - * | _ \| | __ _ _ _ ___ _ __ / \ _ __ (_)_ __ ___ __ _| |_(_) ___ _ __ - * | |_) | |/ _` | | | |/ _ \ '__| / _ \ | '_ \| | '_ ` _ \ / _` | __| |/ _ \| '_ \ - * | __/| | (_| | |_| | __/ | / ___ \| | | | | | | | | | (_| | |_| | (_) | | | | - * |_| |_|\__,_|\__, |\___|_| /_/ \_\_| |_|_|_| |_| |_|\__,_|\__|_|\___/|_| |_| - * |___/ - */ - // Just set a flag to true when the arm was swung. - BlockInteractData.getData(event.getPlayer()).noSwingArmSwung = true; - } + private final Direction direction = new Direction(); + private final Reach reach = new Reach(); /** * We listen to PlayerInteractEvent events for obvious reasons. @@ -94,19 +61,11 @@ public class BlockInteractListener implements Listener { boolean cancelled = false; - // First the no swing check. - if (event.getAction() != Action.RIGHT_CLICK_BLOCK - || Arrays.asList(materials).contains(event.getClickedBlock().getType())) { - if (noSwing.isEnabled(player) && noSwing.check(player)) - cancelled = true; - } else - BlockInteractData.getData(player).noSwingArmSwung = false; - - // Second the reach check. + // First the reach check. if (!cancelled && reach.isEnabled(player) && reach.check(player, block.getLocation())) cancelled = true; - // Third the direction check + // Second the direction check if (!cancelled && direction.isEnabled(player) && direction.check(player, block.getLocation())) cancelled = true; diff --git a/src/fr/neatmonster/nocheatplus/checks/blockinteract/Direction.java b/src/fr/neatmonster/nocheatplus/checks/blockinteract/Direction.java index 24e8f462..8324abde 100644 --- a/src/fr/neatmonster/nocheatplus/checks/blockinteract/Direction.java +++ b/src/fr/neatmonster/nocheatplus/checks/blockinteract/Direction.java @@ -39,7 +39,6 @@ public class Direction extends Check { * @return true, if successful */ public boolean check(final Player player, final Location location) { - BlockInteractConfig.getConfig(player); final BlockInteractData data = BlockInteractData.getData(player); boolean cancel = false; diff --git a/src/fr/neatmonster/nocheatplus/checks/blockinteract/NoSwing.java b/src/fr/neatmonster/nocheatplus/checks/blockinteract/NoSwing.java deleted file mode 100644 index c91f5036..00000000 --- a/src/fr/neatmonster/nocheatplus/checks/blockinteract/NoSwing.java +++ /dev/null @@ -1,64 +0,0 @@ -package fr.neatmonster.nocheatplus.checks.blockinteract; - -import org.bukkit.entity.Player; - -import fr.neatmonster.nocheatplus.checks.Check; -import fr.neatmonster.nocheatplus.checks.CheckType; - -/* - * M"""""""`YM MP""""""`MM oo - * M mmmm. M M mmmmm..M - * M MMMMM M .d8888b. M. `YM dP dP dP dP 88d888b. .d8888b. - * M MMMMM M 88' `88 MMMMMMM. M 88 88 88 88 88' `88 88' `88 - * M MMMMM M 88. .88 M. .MMM' M 88.88b.88' 88 88 88 88. .88 - * M MMMMM M `88888P' Mb. .dM 8888P Y8P dP dP dP `8888P88 - * MMMMMMMMMMM MMMMMMMMMMM .88 - * d8888P - */ -/** - * We require that the player moves his arm between block breaks, this is what gets checked here. - */ -public class NoSwing extends Check { - - /** - * Instantiates a new no swing check. - */ - public NoSwing() { - super(CheckType.BLOCKINTERACT_NOSWING); - } - - /** - * Checks a player. - * - * @param player - * the player - * @return true, if successful - */ - public boolean check(final Player player) { - BlockInteractConfig.getConfig(player); - final BlockInteractData data = BlockInteractData.getData(player); - - boolean cancel = false; - - if (System.currentTimeMillis() - data.noSwingLastTime > 3L) - // Did he swing his arm before? - if (data.noSwingArmSwung) { - // "Consume" the flag. - data.noSwingArmSwung = false; - // Reward with lowering of the violation level. - data.noSwingVL *= 0.9D; - } else { - // He failed, increase violation level. - data.noSwingVL += 1D; - - // Execute whatever actions are associated with this check and the violation level and find out if we - // should cancel the event. - cancel = executeActions(player); - } - - data.noSwingLastTime = System.currentTimeMillis(); - - return cancel; - - } -} diff --git a/src/fr/neatmonster/nocheatplus/checks/blockinteract/Reach.java b/src/fr/neatmonster/nocheatplus/checks/blockinteract/Reach.java index 1d455a00..612ac313 100644 --- a/src/fr/neatmonster/nocheatplus/checks/blockinteract/Reach.java +++ b/src/fr/neatmonster/nocheatplus/checks/blockinteract/Reach.java @@ -46,7 +46,6 @@ public class Reach extends Check { * @return true, if successful */ public boolean check(final Player player, final Location location) { - BlockInteractConfig.getConfig(player); final BlockInteractData data = BlockInteractData.getData(player); boolean cancel = false; diff --git a/src/fr/neatmonster/nocheatplus/checks/blockplace/Direction.java b/src/fr/neatmonster/nocheatplus/checks/blockplace/Direction.java index 69d270f3..d3405907 100644 --- a/src/fr/neatmonster/nocheatplus/checks/blockplace/Direction.java +++ b/src/fr/neatmonster/nocheatplus/checks/blockplace/Direction.java @@ -39,7 +39,6 @@ public class Direction extends Check { * @return true, if successful */ public boolean check(final Player player, final Location placed, final Location against) { - BlockPlaceConfig.getConfig(player); final BlockPlaceData data = BlockPlaceData.getData(player); boolean cancel = false; diff --git a/src/fr/neatmonster/nocheatplus/checks/blockplace/NoSwing.java b/src/fr/neatmonster/nocheatplus/checks/blockplace/NoSwing.java index 8e572de4..3999b891 100644 --- a/src/fr/neatmonster/nocheatplus/checks/blockplace/NoSwing.java +++ b/src/fr/neatmonster/nocheatplus/checks/blockplace/NoSwing.java @@ -35,7 +35,6 @@ public class NoSwing extends Check { * @return true, if successful */ public boolean check(final Player player) { - BlockPlaceConfig.getConfig(player); final BlockPlaceData data = BlockPlaceData.getData(player); boolean cancel = false; diff --git a/src/fr/neatmonster/nocheatplus/checks/blockplace/Reach.java b/src/fr/neatmonster/nocheatplus/checks/blockplace/Reach.java index 512f5bd5..bd569191 100644 --- a/src/fr/neatmonster/nocheatplus/checks/blockplace/Reach.java +++ b/src/fr/neatmonster/nocheatplus/checks/blockplace/Reach.java @@ -46,7 +46,6 @@ public class Reach extends Check { * @return true, if successful */ public boolean check(final Player player, final Location location) { - BlockPlaceConfig.getConfig(player); final BlockPlaceData data = BlockPlaceData.getData(player); boolean cancel = false; diff --git a/src/fr/neatmonster/nocheatplus/checks/chat/Color.java b/src/fr/neatmonster/nocheatplus/checks/chat/Color.java index 367acf26..af03f717 100644 --- a/src/fr/neatmonster/nocheatplus/checks/chat/Color.java +++ b/src/fr/neatmonster/nocheatplus/checks/chat/Color.java @@ -36,7 +36,6 @@ public class Color extends Check { * @return the string */ public String check(final Player player, final String message) { - ChatConfig.getConfig(player); final ChatData data = ChatData.getData(player); // If the message contains colors... diff --git a/src/fr/neatmonster/nocheatplus/checks/fight/GodMode.java b/src/fr/neatmonster/nocheatplus/checks/fight/GodMode.java index 8fd6b2ab..3c73006d 100644 --- a/src/fr/neatmonster/nocheatplus/checks/fight/GodMode.java +++ b/src/fr/neatmonster/nocheatplus/checks/fight/GodMode.java @@ -39,7 +39,6 @@ public class GodMode extends Check { * @return true, if successful */ public boolean check(final Player player) { - FightConfig.getConfig(player); final FightData data = FightData.getData(player); boolean cancel = false; diff --git a/src/fr/neatmonster/nocheatplus/checks/fight/InstantHeal.java b/src/fr/neatmonster/nocheatplus/checks/fight/InstantHeal.java index 6034d7ef..179924d9 100644 --- a/src/fr/neatmonster/nocheatplus/checks/fight/InstantHeal.java +++ b/src/fr/neatmonster/nocheatplus/checks/fight/InstantHeal.java @@ -34,7 +34,6 @@ public class InstantHeal extends Check { * @return true, if successful */ public boolean check(final Player player) { - FightConfig.getConfig(player); final FightData data = FightData.getData(player); boolean cancel = false; diff --git a/src/fr/neatmonster/nocheatplus/checks/fight/NoSwing.java b/src/fr/neatmonster/nocheatplus/checks/fight/NoSwing.java index 4acfda07..072a4c72 100644 --- a/src/fr/neatmonster/nocheatplus/checks/fight/NoSwing.java +++ b/src/fr/neatmonster/nocheatplus/checks/fight/NoSwing.java @@ -35,7 +35,6 @@ public class NoSwing extends Check { * @return true, if successful */ public boolean check(final Player player) { - FightConfig.getConfig(player); final FightData data = FightData.getData(player); boolean cancel = false; diff --git a/src/fr/neatmonster/nocheatplus/checks/inventory/InstantBow.java b/src/fr/neatmonster/nocheatplus/checks/inventory/InstantBow.java index 67c00dea..3ae9c92d 100644 --- a/src/fr/neatmonster/nocheatplus/checks/inventory/InstantBow.java +++ b/src/fr/neatmonster/nocheatplus/checks/inventory/InstantBow.java @@ -36,7 +36,6 @@ public class InstantBow extends Check { * @return true, if successful */ public boolean check(final Player player, final float force) { - InventoryConfig.getConfig(player); final InventoryData data = InventoryData.getData(player); boolean cancel = false; diff --git a/src/fr/neatmonster/nocheatplus/checks/inventory/InstantEat.java b/src/fr/neatmonster/nocheatplus/checks/inventory/InstantEat.java index 44c086ea..a55d9fea 100644 --- a/src/fr/neatmonster/nocheatplus/checks/inventory/InstantEat.java +++ b/src/fr/neatmonster/nocheatplus/checks/inventory/InstantEat.java @@ -37,7 +37,6 @@ public class InstantEat extends Check { * @return true, if successful */ public boolean check(final Player player, final int level) { - InventoryConfig.getConfig(player); final InventoryData data = InventoryData.getData(player); boolean cancel = false; diff --git a/src/fr/neatmonster/nocheatplus/checks/moving/MorePackets.java b/src/fr/neatmonster/nocheatplus/checks/moving/MorePackets.java index 2facc83b..9f423e01 100644 --- a/src/fr/neatmonster/nocheatplus/checks/moving/MorePackets.java +++ b/src/fr/neatmonster/nocheatplus/checks/moving/MorePackets.java @@ -58,7 +58,6 @@ public class MorePackets extends Check { * @return the location */ public Location check(final Player player, final PlayerLocation from, final PlayerLocation to) { - MovingConfig.getConfig(player); final MovingData data = MovingData.getData(player); Location newTo = null; diff --git a/src/fr/neatmonster/nocheatplus/checks/moving/MorePacketsVehicle.java b/src/fr/neatmonster/nocheatplus/checks/moving/MorePacketsVehicle.java index 4139ee0c..de899ef7 100644 --- a/src/fr/neatmonster/nocheatplus/checks/moving/MorePacketsVehicle.java +++ b/src/fr/neatmonster/nocheatplus/checks/moving/MorePacketsVehicle.java @@ -57,7 +57,6 @@ public class MorePacketsVehicle extends Check { * @return the location */ public Location check(final Player player, final Location from, final Location to) { - MovingConfig.getConfig(player); final MovingData data = MovingData.getData(player); Location newTo = null; diff --git a/src/fr/neatmonster/nocheatplus/checks/moving/SurvivalFly.java b/src/fr/neatmonster/nocheatplus/checks/moving/SurvivalFly.java index 835d2261..a475d745 100644 --- a/src/fr/neatmonster/nocheatplus/checks/moving/SurvivalFly.java +++ b/src/fr/neatmonster/nocheatplus/checks/moving/SurvivalFly.java @@ -42,7 +42,7 @@ public class SurvivalFly extends Check { private static final double COBWEB_ASCEND = 0.02D + MARGIN; /** The vertical speed limit when descending into web. */ - private static final double COBWEB_DESCEND = 0.062D + MARGIN; + private static final double COBWEB_DESCEND = 0.09D + MARGIN; /** The horizontal speed limit when moving into web. */ private static final double COBWEB_MOVE = 0.11D; diff --git a/src/fr/neatmonster/nocheatplus/config/ConfPaths.java b/src/fr/neatmonster/nocheatplus/config/ConfPaths.java index 375991e8..f35fd241 100644 --- a/src/fr/neatmonster/nocheatplus/config/ConfPaths.java +++ b/src/fr/neatmonster/nocheatplus/config/ConfPaths.java @@ -84,10 +84,6 @@ public abstract class ConfPaths { public static final String BLOCKINTERACT_DIRECTION_CHECK = BLOCKINTERACT_DIRECTION + "active"; public static final String BLOCKINTERACT_DIRECTION_ACTIONS = BLOCKINTERACT_DIRECTION + "actions"; - private static final String BLOCKINTERACT_NOSWING = BLOCKINTERACT + "noswing."; - public static final String BLOCKINTERACT_NOSWING_CHECK = BLOCKINTERACT_NOSWING + "active"; - public static final String BLOCKINTERACT_NOSWING_ACTIONS = BLOCKINTERACT_NOSWING + "actions"; - private static final String BLOCKINTERACT_REACH = BLOCKINTERACT + "reach."; public static final String BLOCKINTERACT_REACH_CHECK = BLOCKINTERACT_REACH + "active"; public static final String BLOCKINTERACT_REACH_ACTIONS = BLOCKINTERACT_REACH + "actions"; diff --git a/src/fr/neatmonster/nocheatplus/config/DefaultConfig.java b/src/fr/neatmonster/nocheatplus/config/DefaultConfig.java index ee04745d..215ae14f 100644 --- a/src/fr/neatmonster/nocheatplus/config/DefaultConfig.java +++ b/src/fr/neatmonster/nocheatplus/config/DefaultConfig.java @@ -81,9 +81,6 @@ public class DefaultConfig extends ConfigFile { set(ConfPaths.BLOCKINTERACT_DIRECTION_CHECK, true); set(ConfPaths.BLOCKINTERACT_DIRECTION_ACTIONS, "cancel vl>10 log:bdirection:0:3:if cancel"); - set(ConfPaths.BLOCKINTERACT_NOSWING_CHECK, true); - set(ConfPaths.BLOCKINTERACT_NOSWING_ACTIONS, "log:noswing:3:2:if cancel"); - set(ConfPaths.BLOCKINTERACT_REACH_CHECK, true); set(ConfPaths.BLOCKINTERACT_REACH_ACTIONS, "cancel vl>5 log:breach:0:2:if cancel"); diff --git a/src/fr/neatmonster/nocheatplus/players/Permissions.java b/src/fr/neatmonster/nocheatplus/players/Permissions.java index 6113fc77..b1750f9e 100644 --- a/src/fr/neatmonster/nocheatplus/players/Permissions.java +++ b/src/fr/neatmonster/nocheatplus/players/Permissions.java @@ -87,7 +87,6 @@ public class Permissions { */ private static final String BLOCKINTERACT = CHECKS + ".blockinteract"; public static final String BLOCKINTERACT_DIRECTION = BLOCKINTERACT + ".direction"; - public static final String BLOCKINTERACT_NOSWING = BLOCKINTERACT + ".noswing"; public static final String BLOCKINTERACT_REACH = BLOCKINTERACT + ".reach"; /*