diff options
author | ementalo <ementalodev@gmx.co.uk> | 2012-07-17 12:26:55 +0100 |
---|---|---|
committer | ementalo <ementalodev@gmx.co.uk> | 2012-07-17 14:21:03 +0100 |
commit | a661bce7b3de3f53e2b7b79c1283f0affa6fe9c3 (patch) | |
tree | 2aa10b6300f6c8d3cb2b298c124180fade74857a /EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/fight/SpeedCheck.java | |
parent | 3c385e69271dfe8530fadc3f67e13ee495e4b0e1 (diff) | |
parent | 9f05e43ecf8e6e1a8fcaef757678e762f0d82573 (diff) | |
download | Essentials-a661bce7b3de3f53e2b7b79c1283f0affa6fe9c3.tar Essentials-a661bce7b3de3f53e2b7b79c1283f0affa6fe9c3.tar.gz Essentials-a661bce7b3de3f53e2b7b79c1283f0affa6fe9c3.tar.lz Essentials-a661bce7b3de3f53e2b7b79c1283f0affa6fe9c3.tar.xz Essentials-a661bce7b3de3f53e2b7b79c1283f0affa6fe9c3.zip |
Merge of server-layer branch
Diffstat (limited to 'EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/fight/SpeedCheck.java')
-rw-r--r-- | EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/fight/SpeedCheck.java | 81 |
1 files changed, 0 insertions, 81 deletions
diff --git a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/fight/SpeedCheck.java b/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/fight/SpeedCheck.java deleted file mode 100644 index baa7db9c5..000000000 --- a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/fight/SpeedCheck.java +++ /dev/null @@ -1,81 +0,0 @@ -package com.earth2me.essentials.anticheat.checks.fight; - -import com.earth2me.essentials.anticheat.NoCheat; -import com.earth2me.essentials.anticheat.NoCheatPlayer; -import com.earth2me.essentials.anticheat.actions.ParameterName; -import com.earth2me.essentials.anticheat.config.Permissions; -import com.earth2me.essentials.anticheat.data.Statistics.Id; -import java.util.Locale; - - -/** - * The speed check will find out if a player interacts with something that's too far away - * - */ -public class SpeedCheck extends FightCheck -{ - public SpeedCheck(NoCheat plugin) - { - super(plugin, "fight.speed", Permissions.FIGHT_SPEED); - } - - public boolean check(NoCheatPlayer player, FightData data, FightConfig cc) - { - - boolean cancel = false; - - final long time = System.currentTimeMillis(); - - // Check if one second has passed and reset counters and vl in that case - if (data.speedTime + 1000L <= time) - { - data.speedTime = time; - data.speedAttackCount = 0; - data.speedVL = 0; - } - - // count the attack - data.speedAttackCount++; - - // too many attacks - if (data.speedAttackCount > cc.speedAttackLimit) - { - // if there was lag, don't count it towards statistics and vl - if (!plugin.skipCheck()) - { - data.speedVL += 1; - incrementStatistics(player, Id.FI_SPEED, 1); - } - - // Execute whatever actions are associated with this check and the - // violation level and find out if we should cancel the event - cancel = executeActions(player, cc.speedActions, data.speedVL); - } - - return cancel; - } - - @Override - public boolean isEnabled(FightConfig cc) - { - return cc.speedCheck; - } - - @Override - public String getParameter(ParameterName wildcard, NoCheatPlayer player) - { - - if (wildcard == ParameterName.VIOLATIONS) - { - return String.format(Locale.US, "%d", getData(player).speedVL); - } - else if (wildcard == ParameterName.LIMIT) - { - return String.format(Locale.US, "%d", getConfig(player.getConfigurationStore()).speedAttackLimit); - } - else - { - return super.getParameter(wildcard, player); - } - } -} |