mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2024-11-09 20:20:11 +01:00
Ensure improbable check is bound to other checks being enabled for the
player.
This commit is contained in:
parent
0a2091ea54
commit
34a70251aa
@ -143,8 +143,6 @@ public class BlockBreakConfig extends ACheckConfig {
|
||||
frequencyShortTermTicks = data.getInt(ConfPaths.BLOCKBREAK_FREQUENCY_SHORTTERM_TICKS);
|
||||
frequencyActions = data.getActionList(ConfPaths.BLOCKBREAK_FREQUENCY_ACTIONS, Permissions.BLOCKBREAK_FREQUENCY);
|
||||
|
||||
improbableFastBreakCheck = data.getBoolean(ConfPaths.COMBINED_IMPROBABLE_FASTBREAK_CHECK);
|
||||
|
||||
noSwingCheck = data.getBoolean(ConfPaths.BLOCKBREAK_NOSWING_CHECK);
|
||||
noSwingActions = data.getActionList(ConfPaths.BLOCKBREAK_NOSWING_ACTIONS, Permissions.BLOCKBREAK_NOSWING);
|
||||
|
||||
|
@ -97,11 +97,6 @@ public class FastBreak extends Check {
|
||||
}
|
||||
|
||||
// (The break time is set in the listener).
|
||||
|
||||
// // Combined speed:
|
||||
// // TODO: use some value corresponding to allowed block breaking speed !
|
||||
// if (cc.improbableFastBreakCheck && Improbable.check(player, 1f, now)) // <- the weight should reflect needed duration
|
||||
// cancel = true;
|
||||
|
||||
return cancel;
|
||||
}
|
||||
|
@ -72,12 +72,6 @@ public class Reach extends Check {
|
||||
} else{
|
||||
// Player passed the check, reward him.
|
||||
data.reachVL *= 0.9D;
|
||||
|
||||
// // Check if improbable
|
||||
// if (distance > -0.1){
|
||||
// if (Improbable.check(player, 1.0f, System.currentTimeMillis()))
|
||||
// cancel = true;
|
||||
// }
|
||||
}
|
||||
|
||||
return cancel;
|
||||
|
@ -108,12 +108,6 @@ public class FightListener implements Listener {
|
||||
final Player damagedPlayer = (Player) cbEntity;
|
||||
if (selfHit.isEnabled(player) && selfHit.check(player, damagedPlayer, data, cc))
|
||||
cancelled = true;
|
||||
else{
|
||||
// // Check if improbable
|
||||
// if (Improbable.check(player, 2.0f, System.currentTimeMillis()))
|
||||
// cancelled = true;
|
||||
// CombinedData.getData((Player) cbEntity).improbableCount.add(System.currentTimeMillis(), -2.0f);
|
||||
}
|
||||
}
|
||||
|
||||
if (cc.cancelDead){
|
||||
|
@ -72,13 +72,14 @@ public class InventoryListener implements Listener {
|
||||
// Only if a player shot the arrow.
|
||||
if (event.getEntity() instanceof Player) {
|
||||
final Player player = (Player) event.getEntity();
|
||||
if (instantBow.isEnabled(player) && instantBow.check(player, event.getForce()))
|
||||
// The check requested the event to be cancelled.
|
||||
event.setCancelled(true);
|
||||
else
|
||||
// Combined speed:
|
||||
if (Improbable.check(player, 1f, System.currentTimeMillis()))
|
||||
if (instantBow.isEnabled(player)){
|
||||
if (instantBow.check(player, event.getForce()))
|
||||
// The check requested the event to be cancelled.
|
||||
event.setCancelled(true);
|
||||
if (Improbable.check(player, 1f, System.currentTimeMillis()))
|
||||
// COmbined fighting speed.
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -161,14 +162,20 @@ public class InventoryListener implements Listener {
|
||||
if (event.getPlayer().isDead())
|
||||
return;
|
||||
|
||||
if (drop.isEnabled(event.getPlayer()) && drop.check(event.getPlayer()))
|
||||
// Cancelling drop events is not save (in certain circumstances items will disappear completely). So don't
|
||||
// do it and kick players instead by default.
|
||||
event.setCancelled(true);
|
||||
else
|
||||
// Combined speed:
|
||||
if (Improbable.check(event.getPlayer(), 1f, System.currentTimeMillis()))
|
||||
if (drop.isEnabled(event.getPlayer())){
|
||||
if (drop.check(event.getPlayer())){
|
||||
// TODO: Is the following command still correct? If so, adapt actions.
|
||||
// Cancelling drop events is not save (in certain circumstances items will disappear completely). So don't
|
||||
// do it and kick players instead by default.
|
||||
event.setCancelled(true);
|
||||
}
|
||||
else if (Improbable.check(event.getPlayer(), 1f, System.currentTimeMillis())){
|
||||
// Combined speed
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -306,8 +306,8 @@ public abstract class ConfPaths {
|
||||
public static final String COMBINED_IMPROBABLE_CHECK = COMBINED_IMPROBABLE + "active";
|
||||
public static final String COMBINED_IMPROBABLE_LEVEL = COMBINED_IMPROBABLE + "level";
|
||||
|
||||
private static final String COMBINED_IMPROBABLE_CHECKS = COMBINED_IMPROBABLE + "options.";
|
||||
public static final String COMBINED_IMPROBABLE_FASTBREAK_CHECK = COMBINED_IMPROBABLE_CHECKS + "fastbreak";
|
||||
// private static final String COMBINED_IMPROBABLE_CHECKS = COMBINED_IMPROBABLE + "options.";
|
||||
// public static final String COMBINED_IMPROBABLE_FASTBREAK_CHECK = COMBINED_IMPROBABLE_CHECKS + "fastbreak";
|
||||
|
||||
public static final String COMBINED_IMPROBABLE_ACTIONS = COMBINED_IMPROBABLE + "actions";
|
||||
|
||||
|
@ -233,7 +233,7 @@ public class DefaultConfig extends ConfigFile {
|
||||
*/
|
||||
set(ConfPaths.COMBINED_IMPROBABLE_CHECK , true);
|
||||
set(ConfPaths.COMBINED_IMPROBABLE_LEVEL, 300);
|
||||
set(ConfPaths.COMBINED_IMPROBABLE_FASTBREAK_CHECK, false);
|
||||
// set(ConfPaths.COMBINED_IMPROBABLE_FASTBREAK_CHECK, false);
|
||||
set(ConfPaths.COMBINED_IMPROBABLE_ACTIONS, "cancel log:improbable:2:8:if");
|
||||
|
||||
set(ConfPaths.COMBINED_YAWRATE_RATE , 380);
|
||||
|
Loading…
Reference in New Issue
Block a user