mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2025-01-28 18:31:24 +01:00
Add exception list for blockplace.noswing (water lily, flint and steel).
This commit is contained in:
parent
258dbbdf84
commit
5c243aa4bc
@ -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<Material> noSwingExceptions = new HashSet<Material>();
|
||||
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);
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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.";
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user