diff --git a/NCPCore/src/main/java/fr/neatmonster/nocheatplus/checks/blockplace/BlockPlaceConfig.java b/NCPCore/src/main/java/fr/neatmonster/nocheatplus/checks/blockplace/BlockPlaceConfig.java index 4a39b027..71d7dba2 100644 --- a/NCPCore/src/main/java/fr/neatmonster/nocheatplus/checks/blockplace/BlockPlaceConfig.java +++ b/NCPCore/src/main/java/fr/neatmonster/nocheatplus/checks/blockplace/BlockPlaceConfig.java @@ -1,8 +1,11 @@ package fr.neatmonster.nocheatplus.checks.blockplace; import java.util.HashMap; +import java.util.HashSet; import java.util.Map; +import java.util.Set; +import org.bukkit.Material; import org.bukkit.entity.Player; import fr.neatmonster.nocheatplus.actions.ActionList; @@ -69,6 +72,7 @@ public class BlockPlaceConfig extends ACheckConfig { public final ActionList fastPlaceActions; public final boolean noSwingCheck; + public final Set noSwingExceptions = new HashSet(); public final ActionList noSwingActions; public final boolean reachCheck; @@ -104,6 +108,7 @@ public class BlockPlaceConfig extends ACheckConfig { fastPlaceActions = data.getOptimizedActionList(ConfPaths.BLOCKPLACE_FASTPLACE_ACTIONS, Permissions.BLOCKPLACE_FASTPLACE); noSwingCheck = data.getBoolean(ConfPaths.BLOCKPLACE_NOSWING_CHECK); + data.readMaterialFromList(ConfPaths.BLOCKPLACE_NOSWING_EXCEPTIONS, noSwingExceptions); noSwingActions = data.getOptimizedActionList(ConfPaths.BLOCKPLACE_NOSWING_ACTIONS, Permissions.BLOCKPLACE_NOSWING); reachCheck = data.getBoolean(ConfPaths.BLOCKPLACE_REACH_CHECK); diff --git a/NCPCore/src/main/java/fr/neatmonster/nocheatplus/checks/blockplace/BlockPlaceListener.java b/NCPCore/src/main/java/fr/neatmonster/nocheatplus/checks/blockplace/BlockPlaceListener.java index c9ca254d..20986e2e 100644 --- a/NCPCore/src/main/java/fr/neatmonster/nocheatplus/checks/blockplace/BlockPlaceListener.java +++ b/NCPCore/src/main/java/fr/neatmonster/nocheatplus/checks/blockplace/BlockPlaceListener.java @@ -125,7 +125,7 @@ public class BlockPlaceListener extends CheckListener { } // No swing check (player doesn't swing their arm when placing a lily pad). - if (!cancelled && placedMat != Material.WATER_LILY && noSwing.isEnabled(player) && noSwing.check(player, data, cc)) { + if (!cancelled && !cc.noSwingExceptions.contains(placedMat) && noSwing.isEnabled(player) && noSwing.check(player, data, cc)) { // Consider skipping all insta placables or using simplified version (true or true within time frame). cancelled = true; } diff --git a/NCPCore/src/main/java/fr/neatmonster/nocheatplus/config/ConfPaths.java b/NCPCore/src/main/java/fr/neatmonster/nocheatplus/config/ConfPaths.java index 36c7fafb..5abfaf80 100644 --- a/NCPCore/src/main/java/fr/neatmonster/nocheatplus/config/ConfPaths.java +++ b/NCPCore/src/main/java/fr/neatmonster/nocheatplus/config/ConfPaths.java @@ -201,6 +201,7 @@ public abstract class ConfPaths { private static final String BLOCKPLACE_NOSWING = BLOCKPLACE + "noswing."; public static final String BLOCKPLACE_NOSWING_CHECK = BLOCKPLACE_NOSWING + "active"; + public static final String BLOCKPLACE_NOSWING_EXCEPTIONS = BLOCKPLACE_NOSWING + "exceptions"; public static final String BLOCKPLACE_NOSWING_ACTIONS = BLOCKPLACE_NOSWING + "actions"; private static final String BLOCKPLACE_REACH = BLOCKPLACE + "reach."; diff --git a/NCPCore/src/main/java/fr/neatmonster/nocheatplus/config/DefaultConfig.java b/NCPCore/src/main/java/fr/neatmonster/nocheatplus/config/DefaultConfig.java index 4a73e97b..f54adfbb 100644 --- a/NCPCore/src/main/java/fr/neatmonster/nocheatplus/config/DefaultConfig.java +++ b/NCPCore/src/main/java/fr/neatmonster/nocheatplus/config/DefaultConfig.java @@ -138,6 +138,7 @@ public class DefaultConfig extends ConfigFile { set(ConfPaths.BLOCKPLACE_REACH_ACTIONS, "cancel vl>5 log:breach:0:2:if cancel"); set(ConfPaths.BLOCKPLACE_NOSWING_CHECK, true); + set(ConfPaths.BLOCKPLACE_NOSWING_EXCEPTIONS, Arrays.asList(Material.WATER_LILY.toString(), Material.FLINT_AND_STEEL.toString())); set(ConfPaths.BLOCKPLACE_NOSWING_ACTIONS, "cancel vl>10 log:noswing:0:5:if cancel"); set(ConfPaths.BLOCKPLACE_SPEED_CHECK, true);