mirror of
https://github.com/essentials/Essentials.git
synced 2025-09-09 06:00:45 +02:00
Hopefully get the basis of a speed check. This whole idea of checks needs to be cleaned up.
This commit is contained in:
@@ -21,6 +21,7 @@ public class BlockPlaceCheckListener implements Listener, EventManager
|
||||
{
|
||||
private final ReachCheck reachCheck;
|
||||
private final DirectionCheck directionCheck;
|
||||
private final SpeedCheck speedCheck;
|
||||
private final NoCheat plugin;
|
||||
|
||||
public BlockPlaceCheckListener(NoCheat plugin)
|
||||
@@ -28,6 +29,7 @@ public class BlockPlaceCheckListener implements Listener, EventManager
|
||||
|
||||
this.plugin = plugin;
|
||||
|
||||
speedCheck = new SpeedCheck(plugin);
|
||||
reachCheck = new ReachCheck(plugin);
|
||||
directionCheck = new DirectionCheck(plugin);
|
||||
}
|
||||
@@ -69,6 +71,11 @@ public class BlockPlaceCheckListener implements Listener, EventManager
|
||||
cancelled = directionCheck.check(player, data, cc);
|
||||
}
|
||||
|
||||
// Third the speed
|
||||
if (!cancelled && cc.speedCheck && !player.hasPermission(Permissions.BLOCKPLACE_SPEED))
|
||||
{
|
||||
cancelled = speedCheck.check(player, data, cc);
|
||||
}
|
||||
// If one of the checks requested to cancel the event, do so
|
||||
if (cancelled)
|
||||
{
|
||||
@@ -76,6 +83,7 @@ public class BlockPlaceCheckListener implements Listener, EventManager
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getActiveChecks(ConfigurationCacheStore cc)
|
||||
{
|
||||
LinkedList<String> s = new LinkedList<String>();
|
||||
@@ -90,7 +98,10 @@ public class BlockPlaceCheckListener implements Listener, EventManager
|
||||
{
|
||||
s.add("blockplace.direction");
|
||||
}
|
||||
|
||||
if (bp.speedCheck)
|
||||
{
|
||||
s.add("blockplace.speed");
|
||||
}
|
||||
return s;
|
||||
}
|
||||
}
|
||||
|
@@ -21,9 +21,13 @@ public class BlockPlaceConfig implements ConfigItem
|
||||
public final ActionList directionActions;
|
||||
public final long directionPenaltyTime;
|
||||
public final double directionPrecision;
|
||||
public final boolean speedCheck;
|
||||
public final ActionList speedActions;
|
||||
|
||||
public BlockPlaceConfig(NoCheatConfiguration data)
|
||||
{
|
||||
speedCheck = data.getBoolean(ConfPaths.BLOCKPLACE_SPEED_CHECK);
|
||||
speedActions = data.getActionList(ConfPaths.BLOCKPLACE_SPEED_ACTIONS, Permissions.BLOCKPLACE_SPEED);
|
||||
|
||||
reachCheck = data.getBoolean(ConfPaths.BLOCKPLACE_REACH_CHECK);
|
||||
reachDistance = 535D / 100D;
|
||||
|
@@ -0,0 +1,18 @@
|
||||
package com.earth2me.essentials.anticheat.checks.blockplace;
|
||||
|
||||
import com.earth2me.essentials.anticheat.NoCheat;
|
||||
import com.earth2me.essentials.anticheat.NoCheatPlayer;
|
||||
|
||||
|
||||
public class SpeedCheck extends BlockPlaceCheck
|
||||
{
|
||||
public SpeedCheck(NoCheat plugin)
|
||||
{
|
||||
super(plugin, "blockplace.speed");
|
||||
}
|
||||
|
||||
public boolean check(NoCheatPlayer player, BlockPlaceData data, BlockPlaceConfig cc)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
@@ -84,6 +84,9 @@ public abstract class ConfPaths
|
||||
|
||||
private final static String BLOCKPLACE = CHECKS + "blockplace.";
|
||||
|
||||
public final static String BLOCKPLACE_SPEED = BLOCKPLACE + "speed.";
|
||||
public final static String BLOCKPLACE_SPEED_CHECK = BLOCKPLACE_SPEED + "active";
|
||||
public final static String BLOCKPLACE_SPEED_ACTIONS = BLOCKPLACE_SPEED + "actions";
|
||||
private final static String BLOCKPLACE_REACH = BLOCKPLACE + "reach.";
|
||||
public final static String BLOCKPLACE_REACH_CHECK = BLOCKPLACE_REACH + "active";
|
||||
public final static String BLOCKPLACE_REACH_ACTIONS = BLOCKPLACE_REACH + "actions";
|
||||
|
@@ -25,6 +25,7 @@ public class Permissions
|
||||
public static final String BLOCKPLACE = CHECKS + ".blockplace";
|
||||
public static final String BLOCKPLACE_REACH = BLOCKPLACE + ".reach";
|
||||
public static final String BLOCKPLACE_DIRECTION = BLOCKPLACE + ".direction";
|
||||
public static final String BLOCKPLACE_SPEED = BLOCKPLACE + ".speed";
|
||||
public static final String CHAT = CHECKS + ".chat";
|
||||
public static final String CHAT_SPAM = CHAT + ".spam";
|
||||
public static final String CHAT_COLOR = CHAT + ".color";
|
||||
|
@@ -53,6 +53,9 @@ checks:
|
||||
active: true
|
||||
actions: log:bbnoswing:3:2:if cancel
|
||||
blockplace:
|
||||
speed:
|
||||
active: true
|
||||
actions: TODO
|
||||
reach:
|
||||
active: true
|
||||
actions: cancel vl>5 log:bpreach:0:2:if cancel
|
||||
|
Reference in New Issue
Block a user