summaryrefslogtreecommitdiffstats
path: root/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/blockplace/BlockPlaceCheck.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/blockplace/BlockPlaceCheck.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/blockplace/BlockPlaceCheck.java')
-rw-r--r--EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/blockplace/BlockPlaceCheck.java99
1 files changed, 0 insertions, 99 deletions
diff --git a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/blockplace/BlockPlaceCheck.java b/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/blockplace/BlockPlaceCheck.java
deleted file mode 100644
index e20a74ca9..000000000
--- a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/blockplace/BlockPlaceCheck.java
+++ /dev/null
@@ -1,99 +0,0 @@
-package com.earth2me.essentials.anticheat.checks.blockplace;
-
-import com.earth2me.essentials.anticheat.NoCheat;
-import com.earth2me.essentials.anticheat.NoCheatPlayer;
-import com.earth2me.essentials.anticheat.actions.ParameterName;
-import com.earth2me.essentials.anticheat.checks.Check;
-import com.earth2me.essentials.anticheat.config.ConfigurationCacheStore;
-import com.earth2me.essentials.anticheat.data.DataStore;
-import com.earth2me.essentials.anticheat.data.SimpleLocation;
-import java.util.Locale;
-
-
-/**
- * Abstract base class for BlockPlace checks, provides some convenience methods for access to data and config that's
- * relevant to this checktype
- */
-public abstract class BlockPlaceCheck extends Check
-{
- private static final String id = "blockplace";
-
- public BlockPlaceCheck(NoCheat plugin, String name)
- {
- super(plugin, id, name);
- }
-
- @Override
- public String getParameter(ParameterName wildcard, NoCheatPlayer player)
- {
- if (wildcard == ParameterName.PLACE_LOCATION)
- {
- SimpleLocation l = getData(player).blockPlaced;
- if (l.isSet())
- {
- return String.format(Locale.US, "%d %d %d", l.x, l.y, l.z);
- }
- else
- {
- return "null";
- }
- }
- else if (wildcard == ParameterName.PLACE_AGAINST)
- {
- SimpleLocation l = getData(player).blockPlacedAgainst;
- if (l.isSet())
- {
- return String.format(Locale.US, "%d %d %d", l.x, l.y, l.z);
- }
- else
- {
- return "null";
- }
- }
- else
- {
- return super.getParameter(wildcard, player);
- }
- }
-
- /**
- * Get the "BlockPlaceData" object that belongs to the player. Will ensure that such a object exists and if not,
- * create one
- *
- * @param player
- * @return
- */
- public static BlockPlaceData getData(NoCheatPlayer player)
- {
- DataStore base = player.getDataStore();
- BlockPlaceData data = base.get(id);
- if (data == null)
- {
- data = new BlockPlaceData();
- base.set(id, data);
- }
- return data;
- }
-
- /**
- * Get the BlockPlaceConfig object that belongs to the world that the player currently resides in.
- *
- * @param player
- * @return
- */
- public static BlockPlaceConfig getConfig(NoCheatPlayer player)
- {
- return getConfig(player.getConfigurationStore());
- }
-
- public static BlockPlaceConfig getConfig(ConfigurationCacheStore cache)
- {
- BlockPlaceConfig config = cache.get(id);
- if (config == null)
- {
- config = new BlockPlaceConfig(cache.getConfiguration());
- cache.set(id, config);
- }
- return config;
- }
-}