summaryrefslogtreecommitdiffstats
path: root/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/inventory/DropCheck.java
diff options
context:
space:
mode:
authorementalo <ementalodev@gmx.co.uk>2012-07-17 12:26:55 +0100
committerementalo <ementalodev@gmx.co.uk>2012-07-17 14:21:03 +0100
commita661bce7b3de3f53e2b7b79c1283f0affa6fe9c3 (patch)
tree2aa10b6300f6c8d3cb2b298c124180fade74857a /EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/inventory/DropCheck.java
parent3c385e69271dfe8530fadc3f67e13ee495e4b0e1 (diff)
parent9f05e43ecf8e6e1a8fcaef757678e762f0d82573 (diff)
downloadEssentials-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/inventory/DropCheck.java')
-rw-r--r--EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/inventory/DropCheck.java71
1 files changed, 0 insertions, 71 deletions
diff --git a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/inventory/DropCheck.java b/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/inventory/DropCheck.java
deleted file mode 100644
index 2e9d030f7..000000000
--- a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/inventory/DropCheck.java
+++ /dev/null
@@ -1,71 +0,0 @@
-package com.earth2me.essentials.anticheat.checks.inventory;
-
-import com.earth2me.essentials.anticheat.NoCheat;
-import com.earth2me.essentials.anticheat.NoCheatPlayer;
-import com.earth2me.essentials.anticheat.actions.ParameterName;
-import com.earth2me.essentials.anticheat.data.Statistics.Id;
-import java.util.Locale;
-
-
-/**
- * The DropCheck will find out if a player drops too many items within a short amount of time
- *
- */
-public class DropCheck extends InventoryCheck
-{
- public DropCheck(NoCheat plugin)
- {
- super(plugin, "inventory.drop");
- }
-
- public boolean check(NoCheatPlayer player, InventoryData data, InventoryConfig cc)
- {
-
- boolean cancel = false;
-
- final long time = System.currentTimeMillis();
-
- // Has the configured time passed? If so, reset the counter
- if (data.dropLastTime + cc.dropTimeFrame <= time)
- {
- data.dropLastTime = time;
- data.dropCount = 0;
- data.dropVL = 0;
- }
- // Security check, if the system time changes
- else if (data.dropLastTime > time)
- {
- data.dropLastTime = Integer.MIN_VALUE;
- }
-
- data.dropCount++;
-
- // The player dropped more than he should
- if (data.dropCount > cc.dropLimit)
- {
- // Set vl and increment statistics
- data.dropVL = data.dropCount - cc.dropLimit;
- incrementStatistics(player, Id.INV_DROP, 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.dropActions, data.dropVL);
- }
-
- return cancel;
- }
-
- @Override
- public String getParameter(ParameterName wildcard, NoCheatPlayer player)
- {
-
- if (wildcard == ParameterName.VIOLATIONS)
- {
- return String.format(Locale.US, "%d", getData(player).dropVL);
- }
- else
- {
- return super.getParameter(wildcard, player);
- }
- }
-}