diff --git a/NCPPlugin/src/main/java/fr/neatmonster/nocheatplus/checks/blockbreak/WrongBlock.java b/NCPPlugin/src/main/java/fr/neatmonster/nocheatplus/checks/blockbreak/WrongBlock.java index 61a92c5f..5a190648 100644 --- a/NCPPlugin/src/main/java/fr/neatmonster/nocheatplus/checks/blockbreak/WrongBlock.java +++ b/NCPPlugin/src/main/java/fr/neatmonster/nocheatplus/checks/blockbreak/WrongBlock.java @@ -62,7 +62,7 @@ public class WrongBlock extends Check { if (score > cc.wrongBLockLevel){ if (executeActions(player, score, 1D, cc.wrongBlockActions)) cancel = true; - if (Improbable.check(player, 2.0f, now)) + if (Improbable.check(player, 2.0f, now, "blockbreak.wrongblock")) cancel = true; } } diff --git a/NCPPlugin/src/main/java/fr/neatmonster/nocheatplus/checks/blockplace/BlockPlaceListener.java b/NCPPlugin/src/main/java/fr/neatmonster/nocheatplus/checks/blockplace/BlockPlaceListener.java index 47c826e1..be513e46 100644 --- a/NCPPlugin/src/main/java/fr/neatmonster/nocheatplus/checks/blockplace/BlockPlaceListener.java +++ b/NCPPlugin/src/main/java/fr/neatmonster/nocheatplus/checks/blockplace/BlockPlaceListener.java @@ -258,7 +258,7 @@ public class BlockPlaceListener extends CheckListener { // If the check was positive, cancel the event. event.setCancelled(true); } - else if (Improbable.check(player, 0.6f, now)){ + else if (Improbable.check(player, 0.6f, now, "blockplace.speed")){ // Combined fighting speed. event.setCancelled(true); } diff --git a/NCPPlugin/src/main/java/fr/neatmonster/nocheatplus/checks/combined/Combined.java b/NCPPlugin/src/main/java/fr/neatmonster/nocheatplus/checks/combined/Combined.java index 78755297..392bcc5e 100644 --- a/NCPPlugin/src/main/java/fr/neatmonster/nocheatplus/checks/combined/Combined.java +++ b/NCPPlugin/src/main/java/fr/neatmonster/nocheatplus/checks/combined/Combined.java @@ -149,7 +149,7 @@ public class Combined { final float amount = ((total - threshold) / threshold * 1000f); data.timeFreeze = Math.max(data.timeFreeze, now + (long) Math.min(Math.max(cc.yawRatePenaltyFactor * amount , cc.yawRatePenaltyMin), cc.yawRatePenaltyMax)); // TODO: balance (100 ... 200 ) ? - if (cc.yawRateImprobable && Improbable.check(player, amount / 100f, now)) + if (cc.yawRateImprobable && Improbable.check(player, amount / 100f, now, "combined.yawrate")) cancel = true; } if (now < data.timeFreeze){ diff --git a/NCPPlugin/src/main/java/fr/neatmonster/nocheatplus/checks/combined/Improbable.java b/NCPPlugin/src/main/java/fr/neatmonster/nocheatplus/checks/combined/Improbable.java index 29e428e2..207a4d10 100644 --- a/NCPPlugin/src/main/java/fr/neatmonster/nocheatplus/checks/combined/Improbable.java +++ b/NCPPlugin/src/main/java/fr/neatmonster/nocheatplus/checks/combined/Improbable.java @@ -2,8 +2,10 @@ package fr.neatmonster.nocheatplus.checks.combined; import org.bukkit.entity.Player; +import fr.neatmonster.nocheatplus.actions.ParameterName; import fr.neatmonster.nocheatplus.checks.Check; import fr.neatmonster.nocheatplus.checks.CheckType; +import fr.neatmonster.nocheatplus.checks.ViolationData; import fr.neatmonster.nocheatplus.utilities.TickTask; /** @@ -24,8 +26,8 @@ public class Improbable extends Check { * @param now * @return */ - public static final boolean check(final Player player, final float weight, final long now){ - return instance.checkImprobable(player, weight, now); + public static final boolean check(final Player player, final float weight, final long now, final String tags){ + return instance.checkImprobable(player, weight, now, tags); } /** @@ -47,7 +49,7 @@ public class Improbable extends Check { instance = this; } - private boolean checkImprobable(final Player player, final float weight, final long now) { + private boolean checkImprobable(final Player player, final float weight, final long now, final String tags) { if (!isEnabled(player)) return false; final CombinedData data = CombinedData.getData(player); final CombinedConfig cc = CombinedConfig.getConfig(player); @@ -74,7 +76,9 @@ public class Improbable extends Check { if (violated){ // Execute actions data.improbableVL += violation / 10.0; - cancel = executeActions(player, data.improbableVL, violation / 10.0, cc.improbableActions); + final ViolationData vd = new ViolationData(this, player, data.improbableVL, violation, cc.improbableActions); + if (tags != null && !tags.isEmpty()) vd.setParameter(ParameterName.TAGS, tags); + cancel = executeActions(vd); } else data.improbableVL *= 0.95; diff --git a/NCPPlugin/src/main/java/fr/neatmonster/nocheatplus/checks/fight/FightListener.java b/NCPPlugin/src/main/java/fr/neatmonster/nocheatplus/checks/fight/FightListener.java index 0f511dfd..83064b7d 100644 --- a/NCPPlugin/src/main/java/fr/neatmonster/nocheatplus/checks/fight/FightListener.java +++ b/NCPPlugin/src/main/java/fr/neatmonster/nocheatplus/checks/fight/FightListener.java @@ -147,7 +147,7 @@ public class FightListener extends CheckListener { // Still feed the improbable. Improbable.feed(player, 2f, now); } - else if (normalizedMove > 2.0 && Improbable.check(player, 1f, now)){ + else if (normalizedMove > 2.0 && Improbable.check(player, 1f, now, "fight.speed")){ // Feed improbable in case of ok-moves too. // TODO: consider only feeding if attacking with higher average speed (!) cancelled = true; diff --git a/NCPPlugin/src/main/java/fr/neatmonster/nocheatplus/checks/fight/Reach.java b/NCPPlugin/src/main/java/fr/neatmonster/nocheatplus/checks/fight/Reach.java index ce915876..e2e74082 100644 --- a/NCPPlugin/src/main/java/fr/neatmonster/nocheatplus/checks/fight/Reach.java +++ b/NCPPlugin/src/main/java/fr/neatmonster/nocheatplus/checks/fight/Reach.java @@ -111,7 +111,7 @@ public class Reach extends Check { // 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.reachVL, violation, cc.reachActions); - if (Improbable.check(player, (float) violation, System.currentTimeMillis())) + if (Improbable.check(player, (float) violation, System.currentTimeMillis(), "fight.reach")) cancel = true; if (cancel) // If we should cancel, remember the current time too. diff --git a/NCPPlugin/src/main/java/fr/neatmonster/nocheatplus/checks/inventory/InventoryListener.java b/NCPPlugin/src/main/java/fr/neatmonster/nocheatplus/checks/inventory/InventoryListener.java index bbc8f3bf..2e8b40d7 100644 --- a/NCPPlugin/src/main/java/fr/neatmonster/nocheatplus/checks/inventory/InventoryListener.java +++ b/NCPPlugin/src/main/java/fr/neatmonster/nocheatplus/checks/inventory/InventoryListener.java @@ -99,7 +99,7 @@ public class InventoryListener extends CheckListener { // The check requested the event to be cancelled. event.setCancelled(true); } - else if (Improbable.check(player, 0.6f, now)){ + 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); }