Skip to content

Commit

Permalink
Remove fight.knockback.
Browse files Browse the repository at this point in the history
Measuring the time from sprint to attack doesn't work well. The
ctrl-sprint thing also adds to it. Better would be measuring the
toggle-sprint frequency and possibly combine it with some other measure
(packet level attack frequency?) then rather deal attack penalty time.
  • Loading branch information
asofold committed Jan 19, 2015
1 parent 0fa307a commit a2e4145
Show file tree
Hide file tree
Showing 9 changed files with 6 additions and 105 deletions.
Expand Up @@ -74,7 +74,6 @@ public enum CheckType {
FIGHT_DIRECTION(FIGHT, Permissions.FIGHT_DIRECTION),
FIGHT_FASTHEAL(FIGHT, Permissions.FIGHT_FASTHEAL),
FIGHT_GODMODE(FIGHT, Permissions.FIGHT_GODMODE),
FIGHT_KNOCKBACK(FIGHT, Permissions.FIGHT_KNOCKBACK),
FIGHT_NOSWING(FIGHT, Permissions.FIGHT_NOSWING),
FIGHT_REACH(FIGHT, Permissions.FIGHT_REACH),
FIGHT_SELFHIT(FIGHT, Permissions.FIGHT_SELFHIT, FightConfig.factory, FightData.selfHitDataFactory),
Expand Down
Expand Up @@ -80,10 +80,6 @@ public static FightConfig getConfig(final Player player) {
public final long godModeLagMaxAge;
public final ActionList godModeActions;

public final boolean knockbackCheck;
public final long knockbackInterval;
public final ActionList knockbackActions;

public final boolean noSwingCheck;
public final ActionList noSwingActions;

Expand Down Expand Up @@ -148,10 +144,6 @@ public FightConfig(final ConfigFile data) {
godModeLagMaxAge = data.getLong(ConfPaths.FIGHT_GODMODE_LAGMAXAGE);
godModeActions = data.getOptimizedActionList(ConfPaths.FIGHT_GODMODE_ACTIONS, Permissions.FIGHT_GODMODE);

knockbackCheck = data.getBoolean(ConfPaths.FIGHT_KNOCKBACK_CHECK);
knockbackInterval = data.getLong(ConfPaths.FIGHT_KNOCKBACK_INTERVAL);
knockbackActions = data.getOptimizedActionList(ConfPaths.FIGHT_KNOCKBACK_ACTIONS, Permissions.FIGHT_KNOCKBACK);

noSwingCheck = data.getBoolean(ConfPaths.FIGHT_NOSWING_CHECK);
noSwingActions = data.getOptimizedActionList(ConfPaths.FIGHT_NOSWING_ACTIONS, Permissions.FIGHT_NOSWING);

Expand Down Expand Up @@ -197,8 +189,6 @@ public final boolean isEnabled(final CheckType checkType) {
return directionCheck;
case FIGHT_GODMODE:
return godModeCheck;
case FIGHT_KNOCKBACK:
return knockbackCheck;
case FIGHT_NOSWING:
return noSwingCheck;
case FIGHT_REACH:
Expand Down
Expand Up @@ -123,7 +123,6 @@ public static void clear(){
public double directionVL;
public double fastHealVL;
public double godModeVL;
public double knockbackVL;
public double noSwingVL;
public double reachVL;
public double speedVL;
Expand Down Expand Up @@ -167,9 +166,6 @@ public static void clear(){
/** Accumulator. */
public int godModeAcc = 0;

// Data of the knockback check.
public long knockbackSprintTime;

// Data of the no swing check.
public boolean noSwingArmSwung;

Expand Down
Expand Up @@ -18,7 +18,6 @@
import org.bukkit.event.player.PlayerAnimationEvent;
import org.bukkit.event.player.PlayerChangedWorldEvent;
import org.bukkit.event.player.PlayerItemHeldEvent;
import org.bukkit.event.player.PlayerToggleSprintEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.PlayerInventory;

Expand Down Expand Up @@ -67,9 +66,6 @@ public class FightListener extends CheckListener implements JoinLeaveListener{
/** The god mode check. */
private final GodMode godMode = addCheck(new GodMode());

/** The knockback check. */
private final Knockback knockback = addCheck(new Knockback());

/** The no swing check. */
private final NoSwing noSwing = addCheck(new NoSwing());

Expand Down Expand Up @@ -222,10 +218,6 @@ else if (normalizedMove > 2.0 && Improbable.check(player, 1f, now, "fight.speed"
cancelled = true;
}

if (!cancelled && knockback.isEnabled(player) && knockback.check(player, data, cc)) {
cancelled = true;
}

if (!cancelled && noSwing.isEnabled(player) && noSwing.check(player, data, cc)) {
cancelled = true;
}
Expand Down Expand Up @@ -594,19 +586,6 @@ protected void onPlayerAnimation(final PlayerAnimationEvent event) {
FightData.getData(event.getPlayer()).noSwingArmSwung = true;
}

/**
* We listen to the PlayerToggleSprint events for the Knockback check.
*
* @param event
* the event
*/
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onPlayerToggleSprint(final PlayerToggleSprintEvent event) {
if (event.isSprinting()) {
FightData.getData(event.getPlayer()).knockbackSprintTime = System.currentTimeMillis();
}
}

@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void onEntityRegainHealthLow(final EntityRegainHealthEvent event){
final Entity entity = event.getEntity();
Expand Down

This file was deleted.

Expand Up @@ -408,11 +408,6 @@ public abstract class ConfPaths {
public static final String FIGHT_GODMODE_LAGMAXAGE = FIGHT_GODMODE + "maxage";
public static final String FIGHT_GODMODE_ACTIONS = FIGHT_GODMODE + "actions";

private static final String FIGHT_KNOCKBACK = FIGHT + "knockback.";
public static final String FIGHT_KNOCKBACK_CHECK = FIGHT_KNOCKBACK + "active";
public static final String FIGHT_KNOCKBACK_INTERVAL = FIGHT_KNOCKBACK + "interval";
public static final String FIGHT_KNOCKBACK_ACTIONS = FIGHT_KNOCKBACK + "actions";

private static final String FIGHT_NOSWING = FIGHT + "noswing.";
public static final String FIGHT_NOSWING_CHECK = FIGHT_NOSWING + "active";
public static final String FIGHT_NOSWING_ACTIONS = FIGHT_NOSWING + "actions";
Expand Down Expand Up @@ -657,5 +652,11 @@ public abstract class ConfPaths {
public static final String FIGHT_CRITICAL_VELOCITY = "checks.fight.critical.velocity";
@Deprecated
public static final String BLOCKBREAK_FASTBREAK_DEBUG = "checks.blockbreak.fastbreak.debug";
@Deprecated
public static final String FIGHT_KNOCKBACK_CHECK = "checks.fight.knockback.active";
@Deprecated
public static final String FIGHT_KNOCKBACK_INTERVAL = "checks.fight.knockback.interval";
@Deprecated
public static final String FIGHT_KNOCKBACK_ACTIONS = "checks.fight.knockback.actions";

}
Expand Up @@ -291,10 +291,6 @@ public DefaultConfig() {
set(ConfPaths.FIGHT_GODMODE_LAGMAXAGE, 5000);
set(ConfPaths.FIGHT_GODMODE_ACTIONS, "log:godmode:2:5:if cancel vl>60 log:godmode:2:5:icf cancel"); // cmd:kickgod");

set(ConfPaths.FIGHT_KNOCKBACK_CHECK, true);
set(ConfPaths.FIGHT_KNOCKBACK_INTERVAL, 50L);
set(ConfPaths.FIGHT_KNOCKBACK_ACTIONS, "cancel vl>50 log:knockback:0:5:cif cancel");

set(ConfPaths.FIGHT_NOSWING_CHECK, true);
set(ConfPaths.FIGHT_NOSWING_ACTIONS, "cancel vl>10 log:noswing:0:5:if cancel");

Expand Down
Expand Up @@ -99,7 +99,6 @@ public class Permissions {
public static final String FIGHT_DIRECTION = FIGHT + ".direction";
public static final String FIGHT_FASTHEAL = FIGHT + ".fastheal";
public static final String FIGHT_GODMODE = FIGHT + ".godmode";
public static final String FIGHT_KNOCKBACK = FIGHT + ".knockback";
public static final String FIGHT_NOSWING = FIGHT + ".noswing";
public static final String FIGHT_REACH = FIGHT + ".reach";
public static final String FIGHT_SELFHIT = FIGHT + ".selfhit";
Expand Down
2 changes: 0 additions & 2 deletions NCPPlugin/src/main/resources/plugin.yml
Expand Up @@ -130,8 +130,6 @@ permissions:
description: Allow the player to bypass the FastHeal check.
nocheatplus.checks.fight.godmode:
description: Allow the player to bypass the GodMode check.
nocheatplus.checks.fight.knockback:
description: Allow the player to bypass the Knockback check.
nocheatplus.checks.fight.noswing:
description: Allow the player to bypass the NoSwing check.
nocheatplus.checks.fight.reach:
Expand Down

0 comments on commit a2e4145

Please sign in to comment.