Remove fight.selfhit check as it causes sometimes problems and is no

longer really needed
This commit is contained in:
Evenprime 2011-12-29 16:43:21 +01:00
parent 1eefa59640
commit 5818a32fc0
8 changed files with 14 additions and 79 deletions

View File

@ -80,7 +80,5 @@ permissions:
children:
nocheat.checks.fight.direction:
description: Allow a player to attack players and monster even if they are not in his field of view
nocheat.checks.fight.selfhit:
description: Allow a player to attack himself with close combat attacks (punching, swords, etc.)
nocheat.checks.fight.noswing:
description: Allow a player to fight without swinging their arm

View File

@ -11,8 +11,6 @@ public class CCFight implements ConfigItem {
public final double directionPrecision;
public final ActionList directionActions;
public final long directionPenaltyTime;
public final boolean selfhitCheck;
public final ActionList selfhitActions;
public final boolean noswingCheck;
public final ActionList noswingActions;
@ -23,8 +21,6 @@ public class CCFight implements ConfigItem {
directionPrecision = ((double) (data.getInteger(Configuration.FIGHT_DIRECTION_PRECISION))) / 100D;
directionPenaltyTime = data.getInteger(Configuration.FIGHT_DIRECTION_PENALTYTIME);
directionActions = data.getActionList(Configuration.FIGHT_DIRECTION_ACTIONS);
selfhitCheck = data.getBoolean(Configuration.FIGHT_SELFHIT_CHECK);
selfhitActions = data.getActionList(Configuration.FIGHT_SELFHIT_ACTIONS);
noswingCheck = data.getBoolean(Configuration.FIGHT_NOSWING_CHECK);
noswingActions = data.getActionList(Configuration.FIGHT_NOSWING_ACTIONS);
}

View File

@ -28,7 +28,6 @@ public class FightEventManager extends EventManagerImpl {
this.checks = new ArrayList<FightCheck>(3);
this.checks.add(new NoswingCheck(plugin));
this.checks.add(new SelfhitCheck(plugin));
this.checks.add(new DirectionCheck(plugin));
registerListener(Event.Type.ENTITY_DAMAGE, Priority.Lowest, true, plugin.getPerformance(EventType.FIGHT));
@ -115,8 +114,6 @@ public class FightEventManager extends EventManagerImpl {
if(f.check && f.directionCheck)
s.add("fight.direction");
if(f.check && f.selfhitCheck)
s.add("fight.selfhit");
if(f.check && f.noswingCheck)
s.add("fight.noswing");
return s;

View File

@ -1,47 +0,0 @@
package cc.co.evenprime.bukkit.nocheat.checks.fight;
import java.util.Locale;
import cc.co.evenprime.bukkit.nocheat.NoCheat;
import cc.co.evenprime.bukkit.nocheat.NoCheatPlayer;
import cc.co.evenprime.bukkit.nocheat.actions.ParameterName;
import cc.co.evenprime.bukkit.nocheat.config.Permissions;
public class SelfhitCheck extends FightCheck {
public SelfhitCheck(NoCheat plugin) {
super(plugin, "fight.selfhit", Permissions.FIGHT_SELFHIT);
}
public boolean check(NoCheatPlayer player, FightData data, CCFight cc) {
boolean cancel = false;
if(player.getPlayer().equals(data.damagee.getBukkitEntity())) {
// Player failed the check obviously
data.selfhitVL += 1;
data.selfhitTotalVL += 1;
data.selfhitFailed++;
cancel = executeActions(player, cc.selfhitActions.getActions(data.selfhitVL));
} else {
data.selfhitVL *= 0.99D;
}
return cancel;
}
@Override
public boolean isEnabled(CCFight cc) {
return cc.selfhitCheck;
}
public String getParameter(ParameterName wildcard, NoCheatPlayer player) {
if(wildcard == ParameterName.VIOLATIONS)
return String.format(Locale.US, "%d", (int) getData(player.getDataStore()).selfhitVL);
else
return super.getParameter(wildcard, player);
}
}

View File

@ -126,10 +126,6 @@ public abstract class Configuration {
public final static OptionNode FIGHT_DIRECTION_PENALTYTIME = new OptionNode("penaltytime", FIGHT_DIRECTION, DataType.INTEGER);
public final static OptionNode FIGHT_DIRECTION_ACTIONS = new OptionNode("actions", FIGHT_DIRECTION, DataType.ACTIONLIST);
private final static OptionNode FIGHT_SELFHIT = new OptionNode("selfhit", FIGHT, DataType.PARENT);
public final static OptionNode FIGHT_SELFHIT_CHECK = new OptionNode("check", FIGHT_SELFHIT, DataType.BOOLEAN);
public final static OptionNode FIGHT_SELFHIT_ACTIONS = new OptionNode("actions", FIGHT_SELFHIT, DataType.ACTIONLIST);
private final static OptionNode FIGHT_NOSWING = new OptionNode("noswing", FIGHT, DataType.PARENT);
public final static OptionNode FIGHT_NOSWING_CHECK = new OptionNode("check", FIGHT_NOSWING, DataType.BOOLEAN);
public final static OptionNode FIGHT_NOSWING_ACTIONS = new OptionNode("actions", FIGHT_NOSWING, DataType.ACTIONLIST);

View File

@ -38,16 +38,20 @@ public class DefaultConfiguration extends Configuration {
/*** INVENTORY ***/
{
setValue(INVENTORY_PREVENTITEMDUPE, true);
/*setValue(INVENTORY_CHECK, true);
setValue(INVENTORY_DROP_CHECK, true);
setValue(INVENTORY_DROP_TIMEFRAME, 20);
setValue(INVENTORY_DROP_LIMIT, 100);
ActionList dropActionList = new ActionList();
dropActionList.setActions(0, action.getActions("dropLog dropCancel".split(" ")));
dropActionList.setActions(500, action.getActions("dropLog dropCancel dropkick".split(" ")));
setValue(INVENTORY_DROP_ACTIONS, dropActionList);*/
/*
* setValue(INVENTORY_CHECK, true);
*
* setValue(INVENTORY_DROP_CHECK, true);
* setValue(INVENTORY_DROP_TIMEFRAME, 20);
* setValue(INVENTORY_DROP_LIMIT, 100);
*
* ActionList dropActionList = new ActionList();
* dropActionList.setActions(0,
* action.getActions("dropLog dropCancel".split(" ")));
* dropActionList.setActions(500,
* action.getActions("dropLog dropCancel dropkick".split(" ")));
* setValue(INVENTORY_DROP_ACTIONS, dropActionList);
*/
}
/*** MOVING ***/
@ -184,11 +188,6 @@ public class DefaultConfiguration extends Configuration {
directionActionList.setActions(50, action.getActions("fightDirectionLogHigh fightCancel".split(" ")));
setValue(FIGHT_DIRECTION_ACTIONS, directionActionList);
setValue(FIGHT_SELFHIT_CHECK, true);
ActionList selfhitActionList = new ActionList();
selfhitActionList.setActions(0, action.getActions("fightSelfhitLog fightCancel".split(" ")));
setValue(FIGHT_SELFHIT_ACTIONS, selfhitActionList);
setValue(FIGHT_NOSWING_CHECK, true);
ActionList noswingActionList = new ActionList();
noswingActionList.setActions(0, action.getActions("noswingLog fightCancel".split(" ")));

View File

@ -102,9 +102,6 @@ public class Explainations {
set(Configuration.FIGHT_DIRECTION_PENALTYTIME, "If a player fails the check, he will be unable to attack for this amount of time (in milliseconds), default is 500.");
set(Configuration.FIGHT_DIRECTION_ACTIONS, "What should be done if a player attacks entities that are not in his field of view.\nUnit is sqare root of the distance in blocks between where the enemy was and where the player looked.");
set(Configuration.FIGHT_SELFHIT_CHECK, "If true, check if a player is attacking itself, which should normally be impossible.");
set(Configuration.FIGHT_SELFHIT_ACTIONS, "What should be done if a player attacks himself.\nUnit is number of attacks on himself.");
set(Configuration.FIGHT_NOSWING_CHECK, "If true, check if a player swung his arm before attacking, which he should have done.");
set(Configuration.FIGHT_NOSWING_ACTIONS, "What should be done if a player didn't swing his arm.\nUnit is number of attacks without armswinging.");

View File

@ -33,7 +33,6 @@ public class Permissions {
public static final String FIGHT = CHECKS + ".fight";
public static final String FIGHT_DIRECTION = FIGHT + ".direction";
public static final String FIGHT_SELFHIT = FIGHT + ".selfhit";
public static final String FIGHT_NOSWING = FIGHT + ".noswing";
public static final String TIMED = CHECKS + ".timed";