Class renamed to be more descriptive

This commit is contained in:
Evenprime 2012-01-25 23:25:25 +01:00
parent b6154df02a
commit 6d9675cb6a
33 changed files with 87 additions and 86 deletions

View File

@ -14,9 +14,9 @@ public abstract class BlockBreakCheck extends Check {
super(plugin, id, name, permission); super(plugin, id, name, permission);
} }
public abstract boolean check(NoCheatPlayer player, BlockBreakData data, CCBlockBreak cc); public abstract boolean check(NoCheatPlayer player, BlockBreakData data, BlockBreakConfig cc);
public abstract boolean isEnabled(CCBlockBreak cc); public abstract boolean isEnabled(BlockBreakConfig cc);
public static BlockBreakData getData(DataStore base) { public static BlockBreakData getData(DataStore base) {
BlockBreakData data = base.get(id); BlockBreakData data = base.get(id);
@ -27,10 +27,10 @@ public abstract class BlockBreakCheck extends Check {
return data; return data;
} }
public static CCBlockBreak getConfig(ConfigurationCacheStore cache) { public static BlockBreakConfig getConfig(ConfigurationCacheStore cache) {
CCBlockBreak config = cache.get(id); BlockBreakConfig config = cache.get(id);
if(config == null) { if(config == null) {
config = new CCBlockBreak(cache.getConfiguration()); config = new BlockBreakConfig(cache.getConfiguration());
cache.set(id, config); cache.set(id, config);
} }
return config; return config;

View File

@ -45,7 +45,7 @@ public class BlockBreakCheckListener implements Listener, EventManager {
boolean cancelled = false; boolean cancelled = false;
final NoCheatPlayer player = plugin.getPlayer(event.getPlayer()); final NoCheatPlayer player = plugin.getPlayer(event.getPlayer());
final CCBlockBreak cc = BlockBreakCheck.getConfig(player.getConfigurationStore()); final BlockBreakConfig cc = BlockBreakCheck.getConfig(player.getConfigurationStore());
if(!cc.check || player.hasPermission(Permissions.BLOCKBREAK)) { if(!cc.check || player.hasPermission(Permissions.BLOCKBREAK)) {
return; return;
@ -63,6 +63,7 @@ public class BlockBreakCheckListener implements Listener, EventManager {
return; return;
} }
// Go through all "blockbreak" checks
for(BlockBreakCheck check : checks) { for(BlockBreakCheck check : checks) {
// If it should be executed, do it // If it should be executed, do it
if(!cancelled && check.isEnabled(cc) && !player.hasPermission(check.getPermission())) { if(!cancelled && check.isEnabled(cc) && !player.hasPermission(check.getPermission())) {
@ -112,7 +113,7 @@ public class BlockBreakCheckListener implements Listener, EventManager {
public List<String> getActiveChecks(ConfigurationCacheStore cc) { public List<String> getActiveChecks(ConfigurationCacheStore cc) {
LinkedList<String> s = new LinkedList<String>(); LinkedList<String> s = new LinkedList<String>();
CCBlockBreak bb = BlockBreakCheck.getConfig(cc); BlockBreakConfig bb = BlockBreakCheck.getConfig(cc);
if(bb.check && bb.directionCheck) if(bb.check && bb.directionCheck)
s.add("blockbreak.direction"); s.add("blockbreak.direction");

View File

@ -9,7 +9,7 @@ import cc.co.evenprime.bukkit.nocheat.config.util.ActionList;
* Every world gets one of these assigned to it. * Every world gets one of these assigned to it.
* *
*/ */
public class CCBlockBreak implements ConfigItem { public class BlockBreakConfig implements ConfigItem {
public final boolean check; public final boolean check;
public final boolean checkinstabreakblocks; public final boolean checkinstabreakblocks;
@ -23,7 +23,7 @@ public class CCBlockBreak implements ConfigItem {
public final boolean noswingCheck; public final boolean noswingCheck;
public final ActionList noswingActions; public final ActionList noswingActions;
public CCBlockBreak(Configuration data) { public BlockBreakConfig(Configuration data) {
check = data.getBoolean(Configuration.BLOCKBREAK_CHECK); check = data.getBoolean(Configuration.BLOCKBREAK_CHECK);
reachCheck = data.getBoolean(Configuration.BLOCKBREAK_REACH_CHECK); reachCheck = data.getBoolean(Configuration.BLOCKBREAK_REACH_CHECK);

View File

@ -20,7 +20,7 @@ public class DirectionCheck extends BlockBreakCheck {
super(plugin, "blockbreak.direction", Permissions.BLOCKBREAK_DIRECTION); super(plugin, "blockbreak.direction", Permissions.BLOCKBREAK_DIRECTION);
} }
public boolean check(final NoCheatPlayer player, final BlockBreakData data, final CCBlockBreak ccblockbreak) { public boolean check(final NoCheatPlayer player, final BlockBreakData data, final BlockBreakConfig ccblockbreak) {
final SimpleLocation brokenBlock = data.brokenBlockLocation; final SimpleLocation brokenBlock = data.brokenBlockLocation;
final boolean isInstaBreak = data.instaBrokenBlockLocation.equals(brokenBlock); final boolean isInstaBreak = data.instaBrokenBlockLocation.equals(brokenBlock);
@ -72,7 +72,7 @@ public class DirectionCheck extends BlockBreakCheck {
return cancel; return cancel;
} }
public boolean isEnabled(CCBlockBreak cc) { public boolean isEnabled(BlockBreakConfig cc) {
return cc.directionCheck; return cc.directionCheck;
} }

View File

@ -13,7 +13,7 @@ public class NoswingCheck extends BlockBreakCheck {
super(plugin, "blockbreak.noswing", Permissions.BLOCKBREAK_NOSWING); super(plugin, "blockbreak.noswing", Permissions.BLOCKBREAK_NOSWING);
} }
public boolean check(NoCheatPlayer player, BlockBreakData data, CCBlockBreak cc) { public boolean check(NoCheatPlayer player, BlockBreakData data, BlockBreakConfig cc) {
boolean cancel = false; boolean cancel = false;
@ -32,7 +32,7 @@ public class NoswingCheck extends BlockBreakCheck {
return cancel; return cancel;
} }
public boolean isEnabled(CCBlockBreak cc) { public boolean isEnabled(BlockBreakConfig cc) {
return cc.noswingCheck; return cc.noswingCheck;
} }

View File

@ -20,7 +20,7 @@ public class ReachCheck extends BlockBreakCheck {
super(plugin, "blockbreak.reach", Permissions.BLOCKBREAK_REACH); super(plugin, "blockbreak.reach", Permissions.BLOCKBREAK_REACH);
} }
public boolean check(NoCheatPlayer player, BlockBreakData data, CCBlockBreak cc) { public boolean check(NoCheatPlayer player, BlockBreakData data, BlockBreakConfig cc) {
boolean cancel = false; boolean cancel = false;
@ -45,7 +45,7 @@ public class ReachCheck extends BlockBreakCheck {
return cancel; return cancel;
} }
public boolean isEnabled(CCBlockBreak cc) { public boolean isEnabled(BlockBreakConfig cc) {
return cc.reachCheck; return cc.reachCheck;
} }

View File

@ -20,9 +20,9 @@ public abstract class BlockPlaceCheck extends Check {
super(plugin, id, name, permission); super(plugin, id, name, permission);
} }
public abstract boolean check(NoCheatPlayer player, BlockPlaceData data, CCBlockPlace cc); public abstract boolean check(NoCheatPlayer player, BlockPlaceData data, BlockPlaceConfig cc);
public abstract boolean isEnabled(CCBlockPlace cc); public abstract boolean isEnabled(BlockPlaceConfig cc);
@Override @Override
public String getParameter(ParameterName wildcard, NoCheatPlayer player) { public String getParameter(ParameterName wildcard, NoCheatPlayer player) {
@ -57,10 +57,10 @@ public abstract class BlockPlaceCheck extends Check {
return data; return data;
} }
public static CCBlockPlace getConfig(ConfigurationCacheStore cache) { public static BlockPlaceConfig getConfig(ConfigurationCacheStore cache) {
CCBlockPlace config = cache.get(id); BlockPlaceConfig config = cache.get(id);
if(config == null) { if(config == null) {
config = new CCBlockPlace(cache.getConfiguration()); config = new BlockPlaceConfig(cache.getConfiguration());
cache.set(id, config); cache.set(id, config);
} }
return config; return config;

View File

@ -44,7 +44,7 @@ public class BlockPlaceCheckListener implements Listener, EventManager {
boolean cancelled = false; boolean cancelled = false;
final NoCheatPlayer player = plugin.getPlayer(event.getPlayer()); final NoCheatPlayer player = plugin.getPlayer(event.getPlayer());
final CCBlockPlace cc = BlockPlaceCheck.getConfig(player.getConfigurationStore()); final BlockPlaceConfig cc = BlockPlaceCheck.getConfig(player.getConfigurationStore());
if(!cc.check || player.hasPermission(Permissions.BLOCKPLACE)) { if(!cc.check || player.hasPermission(Permissions.BLOCKPLACE)) {
return; return;
@ -69,7 +69,7 @@ public class BlockPlaceCheckListener implements Listener, EventManager {
public List<String> getActiveChecks(ConfigurationCacheStore cc) { public List<String> getActiveChecks(ConfigurationCacheStore cc) {
LinkedList<String> s = new LinkedList<String>(); LinkedList<String> s = new LinkedList<String>();
CCBlockPlace bp = BlockPlaceCheck.getConfig(cc); BlockPlaceConfig bp = BlockPlaceCheck.getConfig(cc);
if(bp.check && bp.reachCheck) if(bp.check && bp.reachCheck)
s.add("blockplace.reach"); s.add("blockplace.reach");

View File

@ -7,7 +7,7 @@ import cc.co.evenprime.bukkit.nocheat.config.util.ActionList;
/** /**
* *
*/ */
public class CCBlockPlace implements ConfigItem { public class BlockPlaceConfig implements ConfigItem {
public final boolean check; public final boolean check;
@ -20,7 +20,7 @@ public class CCBlockPlace implements ConfigItem {
public final long directionPenaltyTime; public final long directionPenaltyTime;
public final double directionPrecision; public final double directionPrecision;
public CCBlockPlace(Configuration data) { public BlockPlaceConfig(Configuration data) {
check = data.getBoolean(Configuration.BLOCKPLACE_CHECK); check = data.getBoolean(Configuration.BLOCKPLACE_CHECK);

View File

@ -15,7 +15,7 @@ public class DirectionCheck extends BlockPlaceCheck {
super(plugin, "blockplace.direction", Permissions.BLOCKPLACE_DIRECTION); super(plugin, "blockplace.direction", Permissions.BLOCKPLACE_DIRECTION);
} }
public boolean check(NoCheatPlayer player, BlockPlaceData data, CCBlockPlace cc) { public boolean check(NoCheatPlayer player, BlockPlaceData data, BlockPlaceConfig cc) {
boolean cancel = false; boolean cancel = false;
@ -86,7 +86,7 @@ public class DirectionCheck extends BlockPlaceCheck {
} }
@Override @Override
public boolean isEnabled(CCBlockPlace cc) { public boolean isEnabled(BlockPlaceConfig cc) {
return cc.directionCheck; return cc.directionCheck;
} }

View File

@ -20,7 +20,7 @@ public class ReachCheck extends BlockPlaceCheck {
super(plugin, "blockplace.reach", Permissions.BLOCKPLACE_REACH); super(plugin, "blockplace.reach", Permissions.BLOCKPLACE_REACH);
} }
public boolean check(NoCheatPlayer player, BlockPlaceData data, CCBlockPlace cc) { public boolean check(NoCheatPlayer player, BlockPlaceData data, BlockPlaceConfig cc) {
boolean cancel = false; boolean cancel = false;
@ -46,7 +46,7 @@ public class ReachCheck extends BlockPlaceCheck {
} }
@Override @Override
public boolean isEnabled(CCBlockPlace cc) { public boolean isEnabled(BlockPlaceConfig cc) {
return cc.reachCheck; return cc.reachCheck;
} }

View File

@ -15,9 +15,9 @@ public abstract class ChatCheck extends Check {
super(plugin, id, name, permission); super(plugin, id, name, permission);
} }
public abstract boolean check(NoCheatPlayer player, ChatData data, CCChat cc); public abstract boolean check(NoCheatPlayer player, ChatData data, ChatConfig cc);
public abstract boolean isEnabled(CCChat cc); public abstract boolean isEnabled(ChatConfig cc);
@Override @Override
public String getParameter(ParameterName wildcard, NoCheatPlayer player) { public String getParameter(ParameterName wildcard, NoCheatPlayer player) {
@ -37,10 +37,10 @@ public abstract class ChatCheck extends Check {
return data; return data;
} }
public static CCChat getConfig(ConfigurationCacheStore cache) { public static ChatConfig getConfig(ConfigurationCacheStore cache) {
CCChat config = cache.get(id); ChatConfig config = cache.get(id);
if(config == null) { if(config == null) {
config = new CCChat(cache.getConfiguration()); config = new ChatConfig(cache.getConfiguration());
cache.set(id, config); cache.set(id, config);
} }
return config; return config;

View File

@ -42,7 +42,7 @@ public class ChatCheckListener implements Listener, EventManager {
boolean cancelled = false; boolean cancelled = false;
final NoCheatPlayer player = plugin.getPlayer(event.getPlayer()); final NoCheatPlayer player = plugin.getPlayer(event.getPlayer());
final CCChat cc = ChatCheck.getConfig(player.getConfigurationStore()); final ChatConfig cc = ChatCheck.getConfig(player.getConfigurationStore());
if(!cc.check || player.hasPermission(Permissions.CHAT)) { if(!cc.check || player.hasPermission(Permissions.CHAT)) {
return; return;
@ -70,7 +70,7 @@ public class ChatCheckListener implements Listener, EventManager {
public List<String> getActiveChecks(ConfigurationCacheStore cc) { public List<String> getActiveChecks(ConfigurationCacheStore cc) {
LinkedList<String> s = new LinkedList<String>(); LinkedList<String> s = new LinkedList<String>();
CCChat c = ChatCheck.getConfig(cc); ChatConfig c = ChatCheck.getConfig(cc);
if(c.check && c.spamCheck) if(c.check && c.spamCheck)
s.add("chat.spam"); s.add("chat.spam");
if(c.check && c.colorCheck) if(c.check && c.colorCheck)

View File

@ -6,7 +6,7 @@ import cc.co.evenprime.bukkit.nocheat.ConfigItem;
import cc.co.evenprime.bukkit.nocheat.config.Configuration; import cc.co.evenprime.bukkit.nocheat.config.Configuration;
import cc.co.evenprime.bukkit.nocheat.config.util.ActionList; import cc.co.evenprime.bukkit.nocheat.config.util.ActionList;
public class CCChat implements ConfigItem { public class ChatConfig implements ConfigItem {
public final boolean check; public final boolean check;
public final boolean spamCheck; public final boolean spamCheck;
@ -17,7 +17,7 @@ public class CCChat implements ConfigItem {
public final boolean colorCheck; public final boolean colorCheck;
public final ActionList colorActions; public final ActionList colorActions;
public CCChat(Configuration data) { public ChatConfig(Configuration data) {
check = data.getBoolean(Configuration.CHAT_CHECK); check = data.getBoolean(Configuration.CHAT_CHECK);
spamCheck = data.getBoolean(Configuration.CHAT_SPAM_CHECK); spamCheck = data.getBoolean(Configuration.CHAT_SPAM_CHECK);

View File

@ -12,7 +12,7 @@ public class ColorCheck extends ChatCheck {
super(plugin, "chat.color", Permissions.CHAT_COLOR); super(plugin, "chat.color", Permissions.CHAT_COLOR);
} }
public boolean check(NoCheatPlayer player, ChatData data, CCChat cc) { public boolean check(NoCheatPlayer player, ChatData data, ChatConfig cc) {
if(data.message.matches(".*\247.*")) { if(data.message.matches(".*\247.*")) {
@ -32,7 +32,7 @@ public class ColorCheck extends ChatCheck {
} }
@Override @Override
public boolean isEnabled(CCChat cc) { public boolean isEnabled(ChatConfig cc) {
return cc.colorCheck; return cc.colorCheck;
} }

View File

@ -13,7 +13,7 @@ public class SpamCheck extends ChatCheck {
super(plugin, "chat.spam", Permissions.CHAT_SPAM); super(plugin, "chat.spam", Permissions.CHAT_SPAM);
} }
public boolean check(NoCheatPlayer player, ChatData data, CCChat cc) { public boolean check(NoCheatPlayer player, ChatData data, ChatConfig cc) {
boolean cancel = false; boolean cancel = false;
// Maybe it's a command and on the whitelist // Maybe it's a command and on the whitelist
@ -50,7 +50,7 @@ public class SpamCheck extends ChatCheck {
} }
@Override @Override
public boolean isEnabled(CCChat cc) { public boolean isEnabled(ChatConfig cc) {
return cc.spamCheck; return cc.spamCheck;
} }

View File

@ -18,7 +18,7 @@ public class DirectionCheck extends FightCheck {
super(plugin, "fight.direction", Permissions.FIGHT_DIRECTION); super(plugin, "fight.direction", Permissions.FIGHT_DIRECTION);
} }
public boolean check(NoCheatPlayer player, FightData data, CCFight cc) { public boolean check(NoCheatPlayer player, FightData data, FightConfig cc) {
boolean cancel = false; boolean cancel = false;
@ -77,7 +77,7 @@ public class DirectionCheck extends FightCheck {
} }
@Override @Override
public boolean isEnabled(CCFight cc) { public boolean isEnabled(FightConfig cc) {
return cc.directionCheck; return cc.directionCheck;
} }

View File

@ -18,9 +18,9 @@ public abstract class FightCheck extends Check {
super(plugin, id, name, permission); super(plugin, id, name, permission);
} }
public abstract boolean check(NoCheatPlayer player, FightData data, CCFight cc); public abstract boolean check(NoCheatPlayer player, FightData data, FightConfig cc);
public abstract boolean isEnabled(CCFight cc); public abstract boolean isEnabled(FightConfig cc);
public static FightData getData(DataStore base) { public static FightData getData(DataStore base) {
FightData data = base.get(id); FightData data = base.get(id);
@ -31,10 +31,10 @@ public abstract class FightCheck extends Check {
return data; return data;
} }
public static CCFight getConfig(ConfigurationCacheStore cache) { public static FightConfig getConfig(ConfigurationCacheStore cache) {
CCFight config = cache.get(id); FightConfig config = cache.get(id);
if(config == null) { if(config == null) {
config = new CCFight(cache.getConfiguration()); config = new FightConfig(cache.getConfiguration());
cache.set(id, config); cache.set(id, config);
} }
return config; return config;

View File

@ -49,7 +49,7 @@ public class FightCheckListener implements Listener, EventManager {
final Player damager = (Player) event.getDamager(); final Player damager = (Player) event.getDamager();
final NoCheatPlayer player = plugin.getPlayer(damager); final NoCheatPlayer player = plugin.getPlayer(damager);
final CCFight cc = FightCheck.getConfig(player.getConfigurationStore()); final FightConfig cc = FightCheck.getConfig(player.getConfigurationStore());
if(!cc.check || player.hasPermission(Permissions.FIGHT)) { if(!cc.check || player.hasPermission(Permissions.FIGHT)) {
return; return;
@ -103,7 +103,7 @@ public class FightCheckListener implements Listener, EventManager {
public List<String> getActiveChecks(ConfigurationCacheStore cc) { public List<String> getActiveChecks(ConfigurationCacheStore cc) {
LinkedList<String> s = new LinkedList<String>(); LinkedList<String> s = new LinkedList<String>();
CCFight f = FightCheck.getConfig(cc); FightConfig f = FightCheck.getConfig(cc);
if(f.check && f.directionCheck) if(f.check && f.directionCheck)
s.add("fight.direction"); s.add("fight.direction");

View File

@ -4,7 +4,7 @@ import cc.co.evenprime.bukkit.nocheat.ConfigItem;
import cc.co.evenprime.bukkit.nocheat.config.Configuration; import cc.co.evenprime.bukkit.nocheat.config.Configuration;
import cc.co.evenprime.bukkit.nocheat.config.util.ActionList; import cc.co.evenprime.bukkit.nocheat.config.util.ActionList;
public class CCFight implements ConfigItem { public class FightConfig implements ConfigItem {
public final boolean check; public final boolean check;
public final boolean directionCheck; public final boolean directionCheck;
@ -14,7 +14,7 @@ public class CCFight implements ConfigItem {
public final boolean noswingCheck; public final boolean noswingCheck;
public final ActionList noswingActions; public final ActionList noswingActions;
public CCFight(Configuration data) { public FightConfig(Configuration data) {
check = data.getBoolean(Configuration.FIGHT_CHECK); check = data.getBoolean(Configuration.FIGHT_CHECK);
directionCheck = data.getBoolean(Configuration.FIGHT_DIRECTION_CHECK); directionCheck = data.getBoolean(Configuration.FIGHT_DIRECTION_CHECK);

View File

@ -13,7 +13,7 @@ public class NoswingCheck extends FightCheck {
super(plugin, "fight.noswing", Permissions.FIGHT_NOSWING); super(plugin, "fight.noswing", Permissions.FIGHT_NOSWING);
} }
public boolean check(NoCheatPlayer player, FightData data, CCFight cc) { public boolean check(NoCheatPlayer player, FightData data, FightConfig cc) {
boolean cancel = false; boolean cancel = false;
@ -33,7 +33,7 @@ public class NoswingCheck extends FightCheck {
} }
@Override @Override
public boolean isEnabled(CCFight cc) { public boolean isEnabled(FightConfig cc) {
return cc.noswingCheck; return cc.noswingCheck;
} }

View File

@ -13,7 +13,7 @@ public class DropCheck extends InventoryCheck {
} }
@Override @Override
public boolean check(NoCheatPlayer player, InventoryData data, CCInventory cc) { public boolean check(NoCheatPlayer player, InventoryData data, InventoryConfig cc) {
boolean cancel = false; boolean cancel = false;
@ -43,7 +43,7 @@ public class DropCheck extends InventoryCheck {
} }
@Override @Override
public boolean isEnabled(CCInventory cc) { public boolean isEnabled(InventoryConfig cc) {
return cc.dropCheck; return cc.dropCheck;
} }

View File

@ -14,9 +14,9 @@ public abstract class InventoryCheck extends Check {
super(plugin, id, name, permission); super(plugin, id, name, permission);
} }
public abstract boolean check(NoCheatPlayer player, InventoryData data, CCInventory cc); public abstract boolean check(NoCheatPlayer player, InventoryData data, InventoryConfig cc);
public abstract boolean isEnabled(CCInventory cc); public abstract boolean isEnabled(InventoryConfig cc);
public static InventoryData getData(DataStore base) { public static InventoryData getData(DataStore base) {
InventoryData data = base.get(id); InventoryData data = base.get(id);
@ -27,10 +27,10 @@ public abstract class InventoryCheck extends Check {
return data; return data;
} }
public static CCInventory getConfig(ConfigurationCacheStore cache) { public static InventoryConfig getConfig(ConfigurationCacheStore cache) {
CCInventory config = cache.get(id); InventoryConfig config = cache.get(id);
if(config == null) { if(config == null) {
config = new CCInventory(cache.getConfiguration()); config = new InventoryConfig(cache.getConfiguration());
cache.set(id, config); cache.set(id, config);
} }
return config; return config;

View File

@ -35,7 +35,7 @@ public class InventoryCheckListener implements Listener, EventManager {
return; return;
final NoCheatPlayer player = plugin.getPlayer(event.getPlayer()); final NoCheatPlayer player = plugin.getPlayer(event.getPlayer());
final CCInventory cc = InventoryCheck.getConfig(player.getConfigurationStore()); final InventoryConfig cc = InventoryCheck.getConfig(player.getConfigurationStore());
if(!cc.check || player.hasPermission(Permissions.INVENTORY) || player.isDead()) { if(!cc.check || player.hasPermission(Permissions.INVENTORY) || player.isDead()) {
return; return;
@ -62,7 +62,7 @@ public class InventoryCheckListener implements Listener, EventManager {
public List<String> getActiveChecks(ConfigurationCacheStore cc) { public List<String> getActiveChecks(ConfigurationCacheStore cc) {
LinkedList<String> s = new LinkedList<String>(); LinkedList<String> s = new LinkedList<String>();
CCInventory i = InventoryCheck.getConfig(cc); InventoryConfig i = InventoryCheck.getConfig(cc);
if(i.check && i.dropCheck) if(i.check && i.dropCheck)
s.add("inventory.dropCheck"); s.add("inventory.dropCheck");
return s; return s;

View File

@ -4,7 +4,7 @@ import cc.co.evenprime.bukkit.nocheat.ConfigItem;
import cc.co.evenprime.bukkit.nocheat.config.Configuration; import cc.co.evenprime.bukkit.nocheat.config.Configuration;
import cc.co.evenprime.bukkit.nocheat.config.util.ActionList; import cc.co.evenprime.bukkit.nocheat.config.util.ActionList;
public class CCInventory implements ConfigItem { public class InventoryConfig implements ConfigItem {
public final boolean check; public final boolean check;
@ -13,7 +13,7 @@ public class CCInventory implements ConfigItem {
public final int dropLimit; public final int dropLimit;
public final ActionList dropActions; public final ActionList dropActions;
public CCInventory(Configuration data) { public InventoryConfig(Configuration data) {
check = data.getBoolean(Configuration.INVENTORY_CHECK); check = data.getBoolean(Configuration.INVENTORY_CHECK);
dropCheck = data.getBoolean(Configuration.INVENTORY_DROP_CHECK); dropCheck = data.getBoolean(Configuration.INVENTORY_DROP_CHECK);

View File

@ -21,7 +21,7 @@ public class FlyingCheck extends MovingCheck {
private static final double creativeSpeed = 0.60D; private static final double creativeSpeed = 0.60D;
public PreciseLocation check(NoCheatPlayer player, MovingData data, CCMoving ccmoving) { public PreciseLocation check(NoCheatPlayer player, MovingData data, MovingConfig ccmoving) {
final PreciseLocation setBack = data.runflySetBackPoint; final PreciseLocation setBack = data.runflySetBackPoint;
final PreciseLocation from = data.from; final PreciseLocation from = data.from;
@ -117,7 +117,7 @@ public class FlyingCheck extends MovingCheck {
} }
@Override @Override
public boolean isEnabled(CCMoving moving) { public boolean isEnabled(MovingConfig moving) {
return moving.allowFlying && moving.runflyCheck; return moving.allowFlying && moving.runflyCheck;
} }

View File

@ -38,7 +38,7 @@ public class MorePacketsCheck extends MovingCheck {
* 8. reset packetCounter, wait for next 20 ticks to pass by. * 8. reset packetCounter, wait for next 20 ticks to pass by.
* *
*/ */
public PreciseLocation check(NoCheatPlayer player, MovingData data, CCMoving cc) { public PreciseLocation check(NoCheatPlayer player, MovingData data, MovingConfig cc) {
PreciseLocation newToLocation = null; PreciseLocation newToLocation = null;
@ -99,7 +99,7 @@ public class MorePacketsCheck extends MovingCheck {
} }
@Override @Override
public boolean isEnabled(CCMoving moving) { public boolean isEnabled(MovingConfig moving) {
return moving.morePacketsCheck; return moving.morePacketsCheck;
} }

View File

@ -23,9 +23,9 @@ public abstract class MovingCheck extends Check {
* @param event * @param event
* @return * @return
*/ */
public abstract PreciseLocation check(final NoCheatPlayer player, MovingData data, CCMoving cc); public abstract PreciseLocation check(final NoCheatPlayer player, MovingData data, MovingConfig cc);
public abstract boolean isEnabled(CCMoving moving); public abstract boolean isEnabled(MovingConfig moving);
@Override @Override
public String getParameter(ParameterName wildcard, NoCheatPlayer player) { public String getParameter(ParameterName wildcard, NoCheatPlayer player) {
@ -54,10 +54,10 @@ public abstract class MovingCheck extends Check {
return data; return data;
} }
public static CCMoving getConfig(ConfigurationCacheStore cache) { public static MovingConfig getConfig(ConfigurationCacheStore cache) {
CCMoving config = cache.get(id); MovingConfig config = cache.get(id);
if(config == null) { if(config == null) {
config = new CCMoving(cache.getConfiguration()); config = new MovingConfig(cache.getConfiguration());
cache.set(id, config); cache.set(id, config);
} }
return config; return config;

View File

@ -106,7 +106,7 @@ public class MovingCheckListener implements Listener, EventManager {
return; return;
} }
final CCMoving cc = MovingCheck.getConfig(player.getConfigurationStore()); final MovingConfig cc = MovingCheck.getConfig(player.getConfigurationStore());
final MovingData data = MovingCheck.getData(player.getDataStore()); final MovingData data = MovingCheck.getData(player.getDataStore());
@ -196,7 +196,7 @@ public class MovingCheckListener implements Listener, EventManager {
public List<String> getActiveChecks(ConfigurationCacheStore cc) { public List<String> getActiveChecks(ConfigurationCacheStore cc) {
LinkedList<String> s = new LinkedList<String>(); LinkedList<String> s = new LinkedList<String>();
CCMoving m = MovingCheck.getConfig(cc); MovingConfig m = MovingCheck.getConfig(cc);
if(m.check) { if(m.check) {
if(m.runflyCheck) { if(m.runflyCheck) {

View File

@ -9,7 +9,7 @@ import cc.co.evenprime.bukkit.nocheat.config.util.ActionList;
* assigned to it. * assigned to it.
* *
*/ */
public class CCMoving implements ConfigItem { public class MovingConfig implements ConfigItem {
public final boolean check; public final boolean check;
@ -38,7 +38,7 @@ public class CCMoving implements ConfigItem {
public final double flyingHeightLimit; public final double flyingHeightLimit;
public CCMoving(Configuration data) { public MovingConfig(Configuration data) {
check = data.getBoolean(Configuration.MOVING_CHECK); check = data.getBoolean(Configuration.MOVING_CHECK);
identifyCreativeMode = data.getBoolean(Configuration.MOVING_IDENTIFYCREATIVEMODE); identifyCreativeMode = data.getBoolean(Configuration.MOVING_IDENTIFYCREATIVEMODE);

View File

@ -23,7 +23,7 @@ public class NoFallCheck extends MovingCheck {
* Calculate if and how much the player "failed" this check. * Calculate if and how much the player "failed" this check.
* *
*/ */
public PreciseLocation check(NoCheatPlayer player, MovingData data, CCMoving cc) { public PreciseLocation check(NoCheatPlayer player, MovingData data, MovingConfig cc) {
// If the player is serverside in creative mode, we have to stop here to // If the player is serverside in creative mode, we have to stop here to
// avoid hurting him when he switches back to "normal" mode // avoid hurting him when he switches back to "normal" mode
@ -104,7 +104,7 @@ public class NoFallCheck extends MovingCheck {
} }
@Override @Override
public boolean isEnabled(CCMoving moving) { public boolean isEnabled(MovingConfig moving) {
return moving.nofallCheck; return moving.nofallCheck;
} }

View File

@ -21,7 +21,7 @@ public class RunflyCheck extends MovingCheck {
} }
@Override @Override
public PreciseLocation check(NoCheatPlayer player, MovingData data, CCMoving cc) { public PreciseLocation check(NoCheatPlayer player, MovingData data, MovingConfig cc) {
if(player.hasPermission(Permissions.MOVING_RUNFLY)) { if(player.hasPermission(Permissions.MOVING_RUNFLY)) {
// If the player doesn't get checked for movement // If the player doesn't get checked for movement
@ -42,7 +42,7 @@ public class RunflyCheck extends MovingCheck {
} }
@Override @Override
public boolean isEnabled(CCMoving moving) { public boolean isEnabled(MovingConfig moving) {
return moving.runflyCheck; return moving.runflyCheck;
} }
} }

View File

@ -33,7 +33,7 @@ public class RunningCheck extends MovingCheck {
this.noFallCheck = new NoFallCheck(plugin); this.noFallCheck = new NoFallCheck(plugin);
} }
public PreciseLocation check(NoCheatPlayer player, MovingData data, CCMoving cc) { public PreciseLocation check(NoCheatPlayer player, MovingData data, MovingConfig cc) {
// Some shortcuts: // Some shortcuts:
final PreciseLocation setBack = data.runflySetBackPoint; final PreciseLocation setBack = data.runflySetBackPoint;
@ -131,7 +131,7 @@ public class RunningCheck extends MovingCheck {
* Calculate how much the player failed this check * Calculate how much the player failed this check
* *
*/ */
private double checkHorizontal(final NoCheatPlayer player, final MovingData data, final boolean isSwimming, final double totalDistance, final CCMoving cc) { private double checkHorizontal(final NoCheatPlayer player, final MovingData data, final boolean isSwimming, final double totalDistance, final MovingConfig cc) {
// How much further did the player move than expected?? // How much further did the player move than expected??
double distanceAboveLimit = 0.0D; double distanceAboveLimit = 0.0D;
@ -201,7 +201,7 @@ public class RunningCheck extends MovingCheck {
* Calculate if and how much the player "failed" this check. * Calculate if and how much the player "failed" this check.
* *
*/ */
private double checkVertical(final MovingData data, final boolean fromOnGround, final boolean toOnGround, final CCMoving cc) { private double checkVertical(final MovingData data, final boolean fromOnGround, final boolean toOnGround, final MovingConfig cc) {
// How much higher did the player move than expected?? // How much higher did the player move than expected??
double distanceAboveLimit = 0.0D; double distanceAboveLimit = 0.0D;
@ -221,7 +221,7 @@ public class RunningCheck extends MovingCheck {
} }
@Override @Override
public boolean isEnabled(CCMoving moving) { public boolean isEnabled(MovingConfig moving) {
return moving.runflyCheck && !moving.allowFlying; return moving.runflyCheck && !moving.allowFlying;
} }