Added ".silent" subpermission for checks

This commit is contained in:
Evenprime 2012-02-23 14:03:53 +01:00
parent ac907989e0
commit 3f193e212f
33 changed files with 74 additions and 52 deletions

View File

@ -1,7 +1,7 @@
################################################################################ ################################################################################
# # # #
# Important files, config.yml or "clean up your stuff # # Important files, config.yml or "clean up your stuff" #
# # # #
################################################################################ ################################################################################
@ -131,7 +131,6 @@
- bPermissions - bPermissions
- PermissionsEx - PermissionsEx
- Essentials GroupManager - Essentials GroupManager
- PermissionBukkit
I personally recommend bPermissions, but any of them will do just fine. I personally recommend bPermissions, but any of them will do just fine.
@ -288,6 +287,17 @@
Especially you don't have to and should not use ".*" anywhere when defining Especially you don't have to and should not use ".*" anywhere when defining
NoCheat permissions. NoCheat permissions.
You can exclude a specific player from getting logged by appending ".silent"
to the relevant permission node of the specific check. E.g.
- nocheat.checks.moving.nofall.silent
will prevent NoCheat from recording log messages for that player for the
"nofall" check, while still executing all other actions as usual. These silent
permissions won't show up elsewhere, e.g. when using the "nocheat permlist"
command.
################################################################################ ################################################################################

View File

@ -1,6 +1,6 @@
The MIT License The MIT License
Copyright (c) 2011 Wilfried Pasquazzo (Evenprime) <wilfried.pasquazzo@gmail.com> Copyright (c) 2012 Wilfried Pasquazzo (Evenprime) <wilfried.pasquazzo@gmail.com>
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal

View File

@ -1,4 +1,4 @@
Copyright (c) 2011 Wilfried Pasquazzo (Evenprime) Copyright (c) 2012 Wilfried Pasquazzo (Evenprime)
<wilfried.pasquazzo@gmail.com> <wilfried.pasquazzo@gmail.com>
This software is provided under the MIT License, This software is provided under the MIT License,

View File

@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>cc.co.evenprime.bukkit</groupId> <groupId>cc.co.evenprime.bukkit</groupId>
<artifactId>NoCheat</artifactId> <artifactId>NoCheat</artifactId>
<version>3.4.1</version> <version>3.4.2</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<name>NoCheat</name> <name>NoCheat</name>
<properties> <properties>

View File

@ -14,12 +14,15 @@ import cc.co.evenprime.bukkit.nocheat.actions.Action;
*/ */
public class ActionList { public class ActionList {
public ActionList() {} public ActionList(String permission) {
this.permissionSilent = permission + ".silent";
}
private final static Action[] emptyArray = new Action[0]; private final static Action[] emptyArray = new Action[0];
private final Map<Integer, Action[]> actions = new HashMap<Integer, Action[]>(); private final Map<Integer, Action[]> actions = new HashMap<Integer, Action[]>();
private final List<Integer> tresholds = new ArrayList<Integer>(); private final List<Integer> tresholds = new ArrayList<Integer>();
public final String permissionSilent;
/** /**
* Add an entry to this actionList. The list will be sorted by tresholds * Add an entry to this actionList. The list will be sorted by tresholds

View File

@ -11,6 +11,7 @@ import cc.co.evenprime.bukkit.nocheat.NoCheatPlayer;
import cc.co.evenprime.bukkit.nocheat.actions.Action; import cc.co.evenprime.bukkit.nocheat.actions.Action;
import cc.co.evenprime.bukkit.nocheat.actions.NoCheatCommandSender; import cc.co.evenprime.bukkit.nocheat.actions.NoCheatCommandSender;
import cc.co.evenprime.bukkit.nocheat.actions.ParameterName; import cc.co.evenprime.bukkit.nocheat.actions.ParameterName;
import cc.co.evenprime.bukkit.nocheat.actions.types.ActionList;
import cc.co.evenprime.bukkit.nocheat.actions.types.ConsolecommandAction; import cc.co.evenprime.bukkit.nocheat.actions.types.ConsolecommandAction;
import cc.co.evenprime.bukkit.nocheat.actions.types.DummyAction; import cc.co.evenprime.bukkit.nocheat.actions.types.DummyAction;
import cc.co.evenprime.bukkit.nocheat.actions.types.LogAction; import cc.co.evenprime.bukkit.nocheat.actions.types.LogAction;
@ -39,16 +40,18 @@ public abstract class Check {
* @param actions * @param actions
* @return * @return
*/ */
protected final boolean executeActions(NoCheatPlayer player, Action[] actions) { protected final boolean executeActions(NoCheatPlayer player, ActionList actionList, double violationLevel) {
boolean special = false; boolean special = false;
Action[] actions = actionList.getActions(violationLevel);
final long time = System.currentTimeMillis() / 1000L; final long time = System.currentTimeMillis() / 1000L;
final ConfigurationCacheStore cc = player.getConfigurationStore(); final ConfigurationCacheStore cc = player.getConfigurationStore();
for(Action ac : actions) { for(Action ac : actions) {
if(player.getExecutionHistory().executeAction(groupId, ac, time)) { if(player.getExecutionHistory().executeAction(groupId, ac, time)) {
if(ac instanceof LogAction) { if(ac instanceof LogAction && !player.hasPermission(actionList.permissionSilent)) {
executeLogAction((LogAction) ac, this, player, cc); executeLogAction((LogAction) ac, this, player, cc);
} else if(ac instanceof SpecialAction) { } else if(ac instanceof SpecialAction) {
special = true; special = true;

View File

@ -4,6 +4,7 @@ import cc.co.evenprime.bukkit.nocheat.ConfigItem;
import cc.co.evenprime.bukkit.nocheat.actions.types.ActionList; import cc.co.evenprime.bukkit.nocheat.actions.types.ActionList;
import cc.co.evenprime.bukkit.nocheat.config.ConfPaths; import cc.co.evenprime.bukkit.nocheat.config.ConfPaths;
import cc.co.evenprime.bukkit.nocheat.config.NoCheatConfiguration; import cc.co.evenprime.bukkit.nocheat.config.NoCheatConfiguration;
import cc.co.evenprime.bukkit.nocheat.config.Permissions;
/** /**
* Configurations specific for the "BlockBreak" checks * Configurations specific for the "BlockBreak" checks
@ -26,12 +27,12 @@ public class BlockBreakConfig implements ConfigItem {
reachCheck = data.getBoolean(ConfPaths.BLOCKBREAK_REACH_CHECK); reachCheck = data.getBoolean(ConfPaths.BLOCKBREAK_REACH_CHECK);
reachDistance = 535D / 100D; reachDistance = 535D / 100D;
reachActions = data.getActionList(ConfPaths.BLOCKBREAK_REACH_ACTIONS); reachActions = data.getActionList(ConfPaths.BLOCKBREAK_REACH_ACTIONS, Permissions.BLOCKBREAK_REACH);
directionCheck = data.getBoolean(ConfPaths.BLOCKBREAK_DIRECTION_CHECK); directionCheck = data.getBoolean(ConfPaths.BLOCKBREAK_DIRECTION_CHECK);
directionPrecision = ((double) data.getInt(ConfPaths.BLOCKBREAK_DIRECTION_PRECISION)) / 100D; directionPrecision = ((double) data.getInt(ConfPaths.BLOCKBREAK_DIRECTION_PRECISION)) / 100D;
directionPenaltyTime = data.getInt(ConfPaths.BLOCKBREAK_DIRECTION_PENALTYTIME); directionPenaltyTime = data.getInt(ConfPaths.BLOCKBREAK_DIRECTION_PENALTYTIME);
directionActions = data.getActionList(ConfPaths.BLOCKBREAK_DIRECTION_ACTIONS); directionActions = data.getActionList(ConfPaths.BLOCKBREAK_DIRECTION_ACTIONS, Permissions.BLOCKBREAK_DIRECTION);
noswingCheck = data.getBoolean(ConfPaths.BLOCKBREAK_NOSWING_CHECK); noswingCheck = data.getBoolean(ConfPaths.BLOCKBREAK_NOSWING_CHECK);
noswingActions = data.getActionList(ConfPaths.BLOCKBREAK_NOSWING_ACTIONS); noswingActions = data.getActionList(ConfPaths.BLOCKBREAK_NOSWING_ACTIONS, Permissions.BLOCKBREAK_NOSWING);
} }
} }

View File

@ -39,12 +39,12 @@ public class DirectionCheck extends BlockBreakCheck {
if(isInstaBreak) { if(isInstaBreak) {
// Instabreak block failures are very common, so don't be as // Instabreak block failures are very common, so don't be as
// hard on people failing them // hard on people failing them
off /= 10; off /= 5;
} }
data.directionVL += off; data.directionVL += off;
incrementStatistics(player, Id.BB_DIRECTION, off); incrementStatistics(player, Id.BB_DIRECTION, off);
cancel = executeActions(player, ccblockbreak.directionActions.getActions(data.directionVL)); cancel = executeActions(player, ccblockbreak.directionActions, data.directionVL);
if(cancel) { if(cancel) {
// Needed to calculate penalty times // Needed to calculate penalty times

View File

@ -24,7 +24,7 @@ public class NoswingCheck extends BlockBreakCheck {
data.noswingVL += 1; data.noswingVL += 1;
incrementStatistics(player, Id.BB_NOSWING, 1); incrementStatistics(player, Id.BB_NOSWING, 1);
cancel = executeActions(player, cc.noswingActions.getActions(data.noswingVL)); cancel = executeActions(player, cc.noswingActions, data.noswingVL);
} }
return cancel; return cancel;

View File

@ -35,7 +35,7 @@ public class ReachCheck extends BlockBreakCheck {
incrementStatistics(player, Id.BB_REACH, distance); incrementStatistics(player, Id.BB_REACH, distance);
data.reachDistance = distance; data.reachDistance = distance;
cancel = executeActions(player, cc.reachActions.getActions(data.reachVL)); cancel = executeActions(player, cc.reachActions, data.reachVL);
} else { } else {
data.reachVL *= 0.9D; data.reachVL *= 0.9D;
} }

View File

@ -4,6 +4,7 @@ import cc.co.evenprime.bukkit.nocheat.ConfigItem;
import cc.co.evenprime.bukkit.nocheat.actions.types.ActionList; import cc.co.evenprime.bukkit.nocheat.actions.types.ActionList;
import cc.co.evenprime.bukkit.nocheat.config.ConfPaths; import cc.co.evenprime.bukkit.nocheat.config.ConfPaths;
import cc.co.evenprime.bukkit.nocheat.config.NoCheatConfiguration; import cc.co.evenprime.bukkit.nocheat.config.NoCheatConfiguration;
import cc.co.evenprime.bukkit.nocheat.config.Permissions;
/** /**
* *
@ -23,11 +24,11 @@ public class BlockPlaceConfig implements ConfigItem {
reachCheck = data.getBoolean(ConfPaths.BLOCKPLACE_REACH_CHECK); reachCheck = data.getBoolean(ConfPaths.BLOCKPLACE_REACH_CHECK);
reachDistance = 535D / 100D; reachDistance = 535D / 100D;
reachActions = data.getActionList(ConfPaths.BLOCKPLACE_REACH_ACTIONS); reachActions = data.getActionList(ConfPaths.BLOCKPLACE_REACH_ACTIONS, Permissions.BLOCKPLACE_REACH);
directionCheck = data.getBoolean(ConfPaths.BLOCKPLACE_DIRECTION_CHECK); directionCheck = data.getBoolean(ConfPaths.BLOCKPLACE_DIRECTION_CHECK);
directionPenaltyTime = data.getInt(ConfPaths.BLOCKPLACE_DIRECTION_PENALTYTIME); directionPenaltyTime = data.getInt(ConfPaths.BLOCKPLACE_DIRECTION_PENALTYTIME);
directionPrecision = ((double) data.getInt(ConfPaths.BLOCKPLACE_DIRECTION_PRECISION)) / 100D; directionPrecision = ((double) data.getInt(ConfPaths.BLOCKPLACE_DIRECTION_PRECISION)) / 100D;
directionActions = data.getActionList(ConfPaths.BLOCKPLACE_DIRECTION_ACTIONS); directionActions = data.getActionList(ConfPaths.BLOCKPLACE_DIRECTION_ACTIONS, Permissions.BLOCKPLACE_DIRECTION);
} }
} }

View File

@ -62,7 +62,7 @@ public class DirectionCheck extends BlockPlaceCheck {
// Prepare some event-specific values for logging and custom actions // Prepare some event-specific values for logging and custom actions
cancel = executeActions(player, cc.directionActions.getActions(data.directionVL)); cancel = executeActions(player, cc.directionActions, data.directionVL);
if(cancel) { if(cancel) {
// Needed to calculate penalty times // Needed to calculate penalty times

View File

@ -35,7 +35,7 @@ public class ReachCheck extends BlockPlaceCheck {
incrementStatistics(player, Id.BP_REACH, distance); incrementStatistics(player, Id.BP_REACH, distance);
data.reachdistance = distance; data.reachdistance = distance;
cancel = executeActions(player, cc.reachActions.getActions(data.reachVL)); cancel = executeActions(player, cc.reachActions, data.reachVL);
} else { } else {
data.reachVL *= 0.9D; data.reachVL *= 0.9D;
} }

View File

@ -6,6 +6,7 @@ import cc.co.evenprime.bukkit.nocheat.ConfigItem;
import cc.co.evenprime.bukkit.nocheat.actions.types.ActionList; import cc.co.evenprime.bukkit.nocheat.actions.types.ActionList;
import cc.co.evenprime.bukkit.nocheat.config.ConfPaths; import cc.co.evenprime.bukkit.nocheat.config.ConfPaths;
import cc.co.evenprime.bukkit.nocheat.config.NoCheatConfiguration; import cc.co.evenprime.bukkit.nocheat.config.NoCheatConfiguration;
import cc.co.evenprime.bukkit.nocheat.config.Permissions;
public class ChatConfig implements ConfigItem { public class ChatConfig implements ConfigItem {
@ -25,9 +26,9 @@ public class ChatConfig implements ConfigItem {
spamTimeframe = data.getInt(ConfPaths.CHAT_SPAM_TIMEFRAME); spamTimeframe = data.getInt(ConfPaths.CHAT_SPAM_TIMEFRAME);
spamMessageLimit = data.getInt(ConfPaths.CHAT_SPAM_MESSAGELIMIT); spamMessageLimit = data.getInt(ConfPaths.CHAT_SPAM_MESSAGELIMIT);
spamCommandLimit = data.getInt(ConfPaths.CHAT_SPAM_COMMANDLIMIT); spamCommandLimit = data.getInt(ConfPaths.CHAT_SPAM_COMMANDLIMIT);
spamActions = data.getActionList(ConfPaths.CHAT_SPAM_ACTIONS); spamActions = data.getActionList(ConfPaths.CHAT_SPAM_ACTIONS, Permissions.CHAT_SPAM);
colorCheck = data.getBoolean(ConfPaths.CHAT_COLOR_CHECK); colorCheck = data.getBoolean(ConfPaths.CHAT_COLOR_CHECK);
colorActions = data.getActionList(ConfPaths.CHAT_COLOR_ACTIONS); colorActions = data.getActionList(ConfPaths.CHAT_COLOR_ACTIONS, Permissions.CHAT_COLOR);
} }
private String[] splitWhitelist(String string) { private String[] splitWhitelist(String string) {

View File

@ -19,7 +19,7 @@ public class ColorCheck extends ChatCheck {
data.colorVL += 1; data.colorVL += 1;
incrementStatistics(player, Id.CHAT_COLOR, 1); incrementStatistics(player, Id.CHAT_COLOR, 1);
boolean filter = executeActions(player, cc.colorActions.getActions(data.colorVL)); boolean filter = executeActions(player, cc.colorActions, data.colorVL);
if(filter) { if(filter) {
// Remove color codes // Remove color codes

View File

@ -50,7 +50,7 @@ public class SpamCheck extends ChatCheck {
data.spamVL += Math.max(0, data.commandCount - commandLimit); data.spamVL += Math.max(0, data.commandCount - commandLimit);
incrementStatistics(player, Id.CHAT_SPAM, 1); incrementStatistics(player, Id.CHAT_SPAM, 1);
cancel = executeActions(player, cc.spamActions.getActions(data.spamVL)); cancel = executeActions(player, cc.spamActions, data.spamVL);
} }
return cancel; return cancel;

View File

@ -51,7 +51,7 @@ public class DirectionCheck extends FightCheck {
incrementStatistics(player, Id.FI_DIRECTION, sqrt); incrementStatistics(player, Id.FI_DIRECTION, sqrt);
} }
cancel = executeActions(player, cc.directionActions.getActions(data.directionVL)); cancel = executeActions(player, cc.directionActions, data.directionVL);
if(cancel) { if(cancel) {
// Needed to calculate penalty times // Needed to calculate penalty times

View File

@ -4,6 +4,7 @@ import cc.co.evenprime.bukkit.nocheat.ConfigItem;
import cc.co.evenprime.bukkit.nocheat.actions.types.ActionList; import cc.co.evenprime.bukkit.nocheat.actions.types.ActionList;
import cc.co.evenprime.bukkit.nocheat.config.ConfPaths; import cc.co.evenprime.bukkit.nocheat.config.ConfPaths;
import cc.co.evenprime.bukkit.nocheat.config.NoCheatConfiguration; import cc.co.evenprime.bukkit.nocheat.config.NoCheatConfiguration;
import cc.co.evenprime.bukkit.nocheat.config.Permissions;
public class FightConfig implements ConfigItem { public class FightConfig implements ConfigItem {
@ -30,19 +31,19 @@ public class FightConfig implements ConfigItem {
directionCheck = data.getBoolean(ConfPaths.FIGHT_DIRECTION_CHECK); directionCheck = data.getBoolean(ConfPaths.FIGHT_DIRECTION_CHECK);
directionPrecision = ((double) (data.getInt(ConfPaths.FIGHT_DIRECTION_PRECISION))) / 100D; directionPrecision = ((double) (data.getInt(ConfPaths.FIGHT_DIRECTION_PRECISION))) / 100D;
directionPenaltyTime = data.getInt(ConfPaths.FIGHT_DIRECTION_PENALTYTIME); directionPenaltyTime = data.getInt(ConfPaths.FIGHT_DIRECTION_PENALTYTIME);
directionActions = data.getActionList(ConfPaths.FIGHT_DIRECTION_ACTIONS); directionActions = data.getActionList(ConfPaths.FIGHT_DIRECTION_ACTIONS, Permissions.FIGHT_DIRECTION);
noswingCheck = data.getBoolean(ConfPaths.FIGHT_NOSWING_CHECK); noswingCheck = data.getBoolean(ConfPaths.FIGHT_NOSWING_CHECK);
noswingActions = data.getActionList(ConfPaths.FIGHT_NOSWING_ACTIONS); noswingActions = data.getActionList(ConfPaths.FIGHT_NOSWING_ACTIONS, Permissions.FIGHT_NOSWING);
reachCheck = data.getBoolean(ConfPaths.FIGHT_REACH_CHECK); reachCheck = data.getBoolean(ConfPaths.FIGHT_REACH_CHECK);
reachLimit = ((double) (data.getInt(ConfPaths.FIGHT_REACH_LIMIT))) / 100D; reachLimit = ((double) (data.getInt(ConfPaths.FIGHT_REACH_LIMIT))) / 100D;
reachPenaltyTime = data.getInt(ConfPaths.FIGHT_REACH_PENALTYTIME); reachPenaltyTime = data.getInt(ConfPaths.FIGHT_REACH_PENALTYTIME);
reachActions = data.getActionList(ConfPaths.FIGHT_REACH_ACTIONS); reachActions = data.getActionList(ConfPaths.FIGHT_REACH_ACTIONS, Permissions.FIGHT_REACH);
speedCheck = data.getBoolean(ConfPaths.FIGHT_SPEED_CHECK); speedCheck = data.getBoolean(ConfPaths.FIGHT_SPEED_CHECK);
speedActions = data.getActionList(ConfPaths.FIGHT_SPEED_ACTIONS); speedActions = data.getActionList(ConfPaths.FIGHT_SPEED_ACTIONS, Permissions.FIGHT_SPEED);
speedAttackLimit = data.getInt(ConfPaths.FIGHT_SPEED_ATTACKLIMIT); speedAttackLimit = data.getInt(ConfPaths.FIGHT_SPEED_ATTACKLIMIT);
godmodeCheck = data.getBoolean(ConfPaths.FIGHT_GODMODE_CHECK); godmodeCheck = data.getBoolean(ConfPaths.FIGHT_GODMODE_CHECK);
godmodeActions = data.getActionList(ConfPaths.FIGHT_GODMODE_ACTIONS); godmodeActions = data.getActionList(ConfPaths.FIGHT_GODMODE_ACTIONS, Permissions.FIGHT_GODMODE);
damageChecks = directionCheck || noswingCheck || reachCheck || speedCheck; damageChecks = directionCheck || noswingCheck || reachCheck || speedCheck;
} }

View File

@ -39,7 +39,7 @@ public class GodmodeCheck extends FightCheck {
// No // No
data.godmodeVL -= data.godmodeBuffer; data.godmodeVL -= data.godmodeBuffer;
incrementStatistics(player, Statistics.Id.FI_GODMODE, -data.godmodeBuffer); incrementStatistics(player, Statistics.Id.FI_GODMODE, -data.godmodeBuffer);
cancelled = executeActions(player, cc.godmodeActions.getActions(data.godmodeVL)); cancelled = executeActions(player, cc.godmodeActions, data.godmodeVL);
} }
} else { } else {
// Give some new points, once a second // Give some new points, once a second

View File

@ -25,7 +25,7 @@ public class NoswingCheck extends FightCheck {
data.noswingVL += 1; data.noswingVL += 1;
incrementStatistics(player, Id.FI_NOSWING, 1); incrementStatistics(player, Id.FI_NOSWING, 1);
cancel = executeActions(player, cc.noswingActions.getActions(data.noswingVL)); cancel = executeActions(player, cc.noswingActions, data.noswingVL);
} }
return cancel; return cancel;

View File

@ -53,7 +53,7 @@ public class ReachCheck extends FightCheck {
incrementStatistics(player, Id.FI_REACH, sqrt); incrementStatistics(player, Id.FI_REACH, sqrt);
} }
cancel = executeActions(player, cc.reachActions.getActions(data.reachVL)); cancel = executeActions(player, cc.reachActions, data.reachVL);
if(cancel) { if(cancel) {
// Needed to calculate penalty times // Needed to calculate penalty times

View File

@ -33,7 +33,7 @@ public class SpeedCheck extends FightCheck {
incrementStatistics(player, Id.FI_SPEED, 1); incrementStatistics(player, Id.FI_SPEED, 1);
} }
cancel = executeActions(player, cc.speedActions.getActions(data.speedVL)); cancel = executeActions(player, cc.speedActions, data.speedVL);
} }
return cancel; return cancel;

View File

@ -34,7 +34,7 @@ public class DropCheck extends InventoryCheck {
data.dropVL = data.dropCount - cc.dropLimit; data.dropVL = data.dropCount - cc.dropLimit;
incrementStatistics(player, Id.INV_DROP, 1); incrementStatistics(player, Id.INV_DROP, 1);
cancel = executeActions(player, cc.dropActions.getActions(data.dropVL)); cancel = executeActions(player, cc.dropActions, data.dropVL);
} }
return cancel; return cancel;

View File

@ -32,7 +32,7 @@ public class InstantBowCheck extends InventoryCheck {
int vl = ((int) (expectedTimeWhenStringDrawn - time)) / 100; int vl = ((int) (expectedTimeWhenStringDrawn - time)) / 100;
data.instantBowVL += vl; data.instantBowVL += vl;
incrementStatistics(player, Id.INV_BOW, vl); incrementStatistics(player, Id.INV_BOW, vl);
cancelled = executeActions(player, cc.bowActions.getActions(data.instantBowVL)); cancelled = executeActions(player, cc.bowActions, data.instantBowVL);
} }
return cancelled; return cancelled;

View File

@ -35,7 +35,7 @@ public class InstantEatCheck extends InventoryCheck {
int vl = ((int) (expectedTimeWhenEatingFinished - time)) / 100; int vl = ((int) (expectedTimeWhenEatingFinished - time)) / 100;
data.instantEatVL += vl; data.instantEatVL += vl;
incrementStatistics(player, Id.INV_EAT, vl); incrementStatistics(player, Id.INV_EAT, vl);
cancelled = executeActions(player, cc.eatActions.getActions(data.instantEatVL)); cancelled = executeActions(player, cc.eatActions, data.instantEatVL);
} }
return cancelled; return cancelled;

View File

@ -4,6 +4,7 @@ import cc.co.evenprime.bukkit.nocheat.ConfigItem;
import cc.co.evenprime.bukkit.nocheat.actions.types.ActionList; import cc.co.evenprime.bukkit.nocheat.actions.types.ActionList;
import cc.co.evenprime.bukkit.nocheat.config.ConfPaths; import cc.co.evenprime.bukkit.nocheat.config.ConfPaths;
import cc.co.evenprime.bukkit.nocheat.config.NoCheatConfiguration; import cc.co.evenprime.bukkit.nocheat.config.NoCheatConfiguration;
import cc.co.evenprime.bukkit.nocheat.config.Permissions;
public class InventoryConfig implements ConfigItem { public class InventoryConfig implements ConfigItem {
@ -23,12 +24,12 @@ public class InventoryConfig implements ConfigItem {
dropCheck = data.getBoolean(ConfPaths.INVENTORY_DROP_CHECK); dropCheck = data.getBoolean(ConfPaths.INVENTORY_DROP_CHECK);
dropTimeFrame = data.getInt(ConfPaths.INVENTORY_DROP_TIMEFRAME); dropTimeFrame = data.getInt(ConfPaths.INVENTORY_DROP_TIMEFRAME);
dropLimit = data.getInt(ConfPaths.INVENTORY_DROP_LIMIT); dropLimit = data.getInt(ConfPaths.INVENTORY_DROP_LIMIT);
dropActions = data.getActionList(ConfPaths.INVENTORY_DROP_ACTIONS); dropActions = data.getActionList(ConfPaths.INVENTORY_DROP_ACTIONS, Permissions.INVENTORY_DROP);
bowCheck = data.getBoolean(ConfPaths.INVENTORY_INSTANTBOW_CHECK); bowCheck = data.getBoolean(ConfPaths.INVENTORY_INSTANTBOW_CHECK);
bowActions = data.getActionList(ConfPaths.INVENTORY_INSTANTBOW_ACTIONS); bowActions = data.getActionList(ConfPaths.INVENTORY_INSTANTBOW_ACTIONS, Permissions.INVENTORY_INSTANTBOW);
eatCheck = data.getBoolean(ConfPaths.INVENTORY_INSTANTEAT_CHECK); eatCheck = data.getBoolean(ConfPaths.INVENTORY_INSTANTEAT_CHECK);
eatActions = data.getActionList(ConfPaths.INVENTORY_INSTANTEAT_ACTIONS); eatActions = data.getActionList(ConfPaths.INVENTORY_INSTANTEAT_ACTIONS, Permissions.INVENTORY_INSTANTEAT);
} }
} }

View File

@ -106,7 +106,7 @@ public class FlyingCheck extends MovingCheck {
incrementStatistics(player, Id.MOV_FLYING, resultVert); incrementStatistics(player, Id.MOV_FLYING, resultVert);
} }
boolean cancel = executeActions(player, ccmoving.flyingActions.getActions(data.runflyVL)); boolean cancel = executeActions(player, ccmoving.flyingActions, data.runflyVL);
// Was one of the actions a cancel? Then really do it // Was one of the actions a cancel? Then really do it
if(cancel) { if(cancel) {

View File

@ -55,7 +55,7 @@ public class MorePacketsCheck extends MovingCheck {
data.packets = -data.morePacketsBuffer; data.packets = -data.morePacketsBuffer;
final boolean cancel = executeActions(player, cc.morePacketsActions.getActions(data.morePacketsVL)); final boolean cancel = executeActions(player, cc.morePacketsActions, data.morePacketsVL);
if(cancel) if(cancel)
newToLocation = data.morePacketsSetbackPoint; newToLocation = data.morePacketsSetbackPoint;

View File

@ -4,6 +4,7 @@ import cc.co.evenprime.bukkit.nocheat.ConfigItem;
import cc.co.evenprime.bukkit.nocheat.actions.types.ActionList; import cc.co.evenprime.bukkit.nocheat.actions.types.ActionList;
import cc.co.evenprime.bukkit.nocheat.config.ConfPaths; import cc.co.evenprime.bukkit.nocheat.config.ConfPaths;
import cc.co.evenprime.bukkit.nocheat.config.NoCheatConfiguration; import cc.co.evenprime.bukkit.nocheat.config.NoCheatConfiguration;
import cc.co.evenprime.bukkit.nocheat.config.Permissions;
/** /**
* Configurations specific for the Move Checks. Every world gets one of these * Configurations specific for the Move Checks. Every world gets one of these
@ -53,20 +54,20 @@ public class MovingConfig implements ConfigItem {
jumpheight = ((double) 135) / 100D; jumpheight = ((double) 135) / 100D;
sneakingCheck = !data.getBoolean(ConfPaths.MOVING_RUNFLY_ALLOWFASTSNEAKING); sneakingCheck = !data.getBoolean(ConfPaths.MOVING_RUNFLY_ALLOWFASTSNEAKING);
actions = data.getActionList(ConfPaths.MOVING_RUNFLY_ACTIONS); actions = data.getActionList(ConfPaths.MOVING_RUNFLY_ACTIONS, Permissions.MOVING_RUNFLY);
allowFlying = data.getBoolean(ConfPaths.MOVING_RUNFLY_FLYING_ALLOWALWAYS); allowFlying = data.getBoolean(ConfPaths.MOVING_RUNFLY_FLYING_ALLOWALWAYS);
flyingSpeedLimitVertical = ((double) data.getInt(ConfPaths.MOVING_RUNFLY_FLYING_SPEEDLIMITVERTICAL)) / 100D; flyingSpeedLimitVertical = ((double) data.getInt(ConfPaths.MOVING_RUNFLY_FLYING_SPEEDLIMITVERTICAL)) / 100D;
flyingSpeedLimitHorizontal = ((double) data.getInt(ConfPaths.MOVING_RUNFLY_FLYING_SPEEDLIMITHORIZONTAL)) / 100D; flyingSpeedLimitHorizontal = ((double) data.getInt(ConfPaths.MOVING_RUNFLY_FLYING_SPEEDLIMITHORIZONTAL)) / 100D;
flyingHeightLimit = data.getInt(ConfPaths.MOVING_RUNFLY_FLYING_HEIGHTLIMIT); flyingHeightLimit = data.getInt(ConfPaths.MOVING_RUNFLY_FLYING_HEIGHTLIMIT);
flyingActions = data.getActionList(ConfPaths.MOVING_RUNFLY_FLYING_ACTIONS); flyingActions = data.getActionList(ConfPaths.MOVING_RUNFLY_FLYING_ACTIONS, Permissions.MOVING_FLYING);
nofallCheck = data.getBoolean(ConfPaths.MOVING_RUNFLY_CHECKNOFALL); nofallCheck = data.getBoolean(ConfPaths.MOVING_RUNFLY_CHECKNOFALL);
nofallMultiplier = ((float) 200) / 100F; nofallMultiplier = ((float) 200) / 100F;
nofallaggressive = data.getBoolean(ConfPaths.MOVING_RUNFLY_NOFALLAGGRESSIVE); nofallaggressive = data.getBoolean(ConfPaths.MOVING_RUNFLY_NOFALLAGGRESSIVE);
nofallActions = data.getActionList(ConfPaths.MOVING_RUNFLY_NOFALLACTIONS); nofallActions = data.getActionList(ConfPaths.MOVING_RUNFLY_NOFALLACTIONS, Permissions.MOVING_NOFALL);
morePacketsCheck = data.getBoolean(ConfPaths.MOVING_MOREPACKETS_CHECK); morePacketsCheck = data.getBoolean(ConfPaths.MOVING_MOREPACKETS_CHECK);
morePacketsActions = data.getActionList(ConfPaths.MOVING_MOREPACKETS_ACTIONS); morePacketsActions = data.getActionList(ConfPaths.MOVING_MOREPACKETS_ACTIONS, Permissions.MOVING_MOREPACKETS);
} }
} }

View File

@ -41,7 +41,7 @@ public class NoFallCheck extends MovingCheck {
data.fallDistance = player.getPlayer().getFallDistance(); data.fallDistance = player.getPlayer().getFallDistance();
data.nofallVL += data.fallDistance; data.nofallVL += data.fallDistance;
incrementStatistics(player, Id.MOV_NOFALL, data.fallDistance); incrementStatistics(player, Id.MOV_NOFALL, data.fallDistance);
final boolean cancel = executeActions(player, cc.nofallActions.getActions(data.nofallVL)); final boolean cancel = executeActions(player, cc.nofallActions, data.nofallVL);
if(cancel) { if(cancel) {
player.dealFallDamage(); player.dealFallDamage();
} }
@ -64,7 +64,7 @@ public class NoFallCheck extends MovingCheck {
data.nofallVL += difference; data.nofallVL += difference;
incrementStatistics(player, Id.MOV_NOFALL, difference); incrementStatistics(player, Id.MOV_NOFALL, difference);
final boolean cancel = executeActions(player, cc.nofallActions.getActions(data.nofallVL)); final boolean cancel = executeActions(player, cc.nofallActions, data.nofallVL);
// If "cancelled", the fall damage gets dealt in a way that's // If "cancelled", the fall damage gets dealt in a way that's
// visible to other plugins // visible to other plugins

View File

@ -79,7 +79,7 @@ public class RunningCheck extends MovingCheck {
incrementStatistics(player, data.statisticCategory, result); incrementStatistics(player, data.statisticCategory, result);
boolean cancel = executeActions(player, cc.actions.getActions(data.runflyVL)); boolean cancel = executeActions(player, cc.actions, data.runflyVL);
// Was one of the actions a cancel? Then do it // Was one of the actions a cancel? Then do it
if(cancel) { if(cancel) {

View File

@ -113,8 +113,8 @@ public class ActionFactory {
return actions.toArray(new Action[actions.size()]); return actions.toArray(new Action[actions.size()]);
} }
public ActionList createActionList(String definition) { public ActionList createActionList(String definition, String permission) {
ActionList list = new ActionList(); ActionList list = new ActionList(permission);
boolean first = true; boolean first = true;

View File

@ -76,10 +76,10 @@ public class NoCheatConfiguration extends YamlConfiguration {
* @param path * @param path
* @return * @return
*/ */
public ActionList getActionList(String path) { public ActionList getActionList(String path, String permission) {
String value = this.getString(path); String value = this.getString(path);
return factory.createActionList(value); return factory.createActionList(value, permission);
} }
/** /**