diff --git a/NCPCore/src/main/java/fr/neatmonster/nocheatplus/checks/inventory/InventoryConfig.java b/NCPCore/src/main/java/fr/neatmonster/nocheatplus/checks/inventory/InventoryConfig.java index f468283a..85cd8df6 100644 --- a/NCPCore/src/main/java/fr/neatmonster/nocheatplus/checks/inventory/InventoryConfig.java +++ b/NCPCore/src/main/java/fr/neatmonster/nocheatplus/checks/inventory/InventoryConfig.java @@ -111,6 +111,8 @@ public class InventoryConfig extends ACheckConfig { public final boolean instantBowCheck; public final boolean instantBowStrict; public final long instantBowDelay; + public final boolean instantBowImprobableFeedOnly; + public final float instantBowImprobableWeight; public final ActionList instantBowActions; public final boolean instantEatCheck; @@ -157,6 +159,8 @@ public class InventoryConfig extends ACheckConfig { instantBowCheck = data.getBoolean(ConfPaths.INVENTORY_INSTANTBOW_CHECK); instantBowStrict = data.getBoolean(ConfPaths.INVENTORY_INSTANTBOW_STRICT); instantBowDelay = data.getInt(ConfPaths.INVENTORY_INSTANTBOW_DELAY); + instantBowImprobableFeedOnly = data.getBoolean(ConfPaths.INVENTORY_INSTANTBOW_IMPROBABLE_FEEDONLY); + instantBowImprobableWeight = (float) data.getDouble(ConfPaths.INVENTORY_INSTANTBOW_IMPROBABLE_WEIGHT); instantBowActions = data.getOptimizedActionList(ConfPaths.INVENTORY_INSTANTBOW_ACTIONS, Permissions.INVENTORY_INSTANTBOW); instantEatCheck = data.getBoolean(ConfPaths.INVENTORY_INSTANTEAT_CHECK); diff --git a/NCPCore/src/main/java/fr/neatmonster/nocheatplus/checks/inventory/InventoryListener.java b/NCPCore/src/main/java/fr/neatmonster/nocheatplus/checks/inventory/InventoryListener.java index 9f6f8b97..be32dc3e 100644 --- a/NCPCore/src/main/java/fr/neatmonster/nocheatplus/checks/inventory/InventoryListener.java +++ b/NCPCore/src/main/java/fr/neatmonster/nocheatplus/checks/inventory/InventoryListener.java @@ -114,14 +114,20 @@ public class InventoryListener extends CheckListener implements JoinLeaveListen // No else if with this, could be cancelled due to other checks feeding, does not have actions. event.setCancelled(true); } + final InventoryConfig cc = InventoryConfig.getConfig(player); // Still check instantBow, whatever yawrate says. if (instantBow.check(player, event.getForce(), now)) { // The check requested the event to be cancelled. event.setCancelled(true); } - else if (Improbable.check(player, 0.6f, now, "inventory.instantbow")) { - // Combined fighting speed (Else if: Matter of taste, preventing extreme cascading and actions spam). - event.setCancelled(true); + else if (cc.instantBowImprobableWeight > 0.0f) { + if (cc.instantBowImprobableFeedOnly) { + Improbable.feed(player, cc.instantBowImprobableWeight, now); + } + else if (Improbable.check(player, cc.instantBowImprobableWeight, now, "inventory.instantbow")) { + // Combined fighting speed (Else if: Matter of taste, preventing extreme cascading and actions spam). + event.setCancelled(true); + } } useLoc.setWorld(null); } 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 4ec97563..a82a0eea 100644 --- a/NCPCore/src/main/java/fr/neatmonster/nocheatplus/config/ConfPaths.java +++ b/NCPCore/src/main/java/fr/neatmonster/nocheatplus/config/ConfPaths.java @@ -542,6 +542,10 @@ public abstract class ConfPaths { public static final String INVENTORY_INSTANTBOW_CHECK = INVENTORY_INSTANTBOW + "active"; public static final String INVENTORY_INSTANTBOW_STRICT = INVENTORY_INSTANTBOW + "strict"; public static final String INVENTORY_INSTANTBOW_DELAY = INVENTORY_INSTANTBOW + "delay"; + private static final String INVENTORY_INSTANTBOW_IMPROBABLE = INVENTORY_INSTANTBOW + "improbable."; + public static final String INVENTORY_INSTANTBOW_IMPROBABLE_FEEDONLY = INVENTORY_INSTANTBOW_IMPROBABLE + "feedonly"; + public static final String INVENTORY_INSTANTBOW_IMPROBABLE_WEIGHT = INVENTORY_INSTANTBOW_IMPROBABLE + "weight"; + public static final String INVENTORY_INSTANTBOW_ACTIONS = INVENTORY_INSTANTBOW + "actions"; private static final String INVENTORY_INSTANTEAT = INVENTORY + "instanteat."; 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 42f15493..3e1e81eb 100644 --- a/NCPCore/src/main/java/fr/neatmonster/nocheatplus/config/DefaultConfig.java +++ b/NCPCore/src/main/java/fr/neatmonster/nocheatplus/config/DefaultConfig.java @@ -339,6 +339,8 @@ public class DefaultConfig extends ConfigFile { set(ConfPaths.INVENTORY_INSTANTBOW_CHECK, true, 785); set(ConfPaths.INVENTORY_INSTANTBOW_STRICT, true, 785); set(ConfPaths.INVENTORY_INSTANTBOW_DELAY, 130, 785); + set(ConfPaths.INVENTORY_INSTANTBOW_IMPROBABLE_FEEDONLY, false, 1085); + set(ConfPaths.INVENTORY_INSTANTBOW_IMPROBABLE_WEIGHT, 0.6, 1085); set(ConfPaths.INVENTORY_INSTANTBOW_ACTIONS, "cancel vl>15 log:instantbow:2:5:if cancel", 785); set(ConfPaths.INVENTORY_INSTANTEAT_CHECK, true, 785);