mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2024-12-29 03:48:50 +01:00
+ rudimentary support for sprinting players
This commit is contained in:
parent
d280bc4f7d
commit
248a4867a6
@ -3,7 +3,7 @@ name: NoCheat
|
|||||||
author: Evenprime
|
author: Evenprime
|
||||||
|
|
||||||
main: cc.co.evenprime.bukkit.nocheat.NoCheat
|
main: cc.co.evenprime.bukkit.nocheat.NoCheat
|
||||||
version: 2.03c
|
version: 2.04
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
|
|
||||||
|
@ -83,7 +83,8 @@ public class DefaultConfiguration {
|
|||||||
movingNode.add(runningNode);
|
movingNode.add(runningNode);
|
||||||
|
|
||||||
runningNode.add(new BooleanOption("check", true, true));
|
runningNode.add(new BooleanOption("check", true, true));
|
||||||
runningNode.add(new IntegerOption("speedlimit", 22));
|
runningNode.add(new IntegerOption("walkingspeedlimit", 22));
|
||||||
|
runningNode.add(new IntegerOption("sprintingspeedlimit", 44));
|
||||||
|
|
||||||
/**** MOVING.RUNNING.SWIMMING ****/
|
/**** MOVING.RUNNING.SWIMMING ****/
|
||||||
{
|
{
|
||||||
|
@ -33,7 +33,8 @@ public class Explainations {
|
|||||||
set("moving.flying.actions", "What should be done if a player flies faster than the speed limit(s). \nUnits are in 1/100 of a block above the limit.");
|
set("moving.flying.actions", "What should be done if a player flies faster than the speed limit(s). \nUnits are in 1/100 of a block above the limit.");
|
||||||
|
|
||||||
set("moving.running.check", "If true, check if a player is running too fast/jumping too high.\nIf this is true, 'flying.check' is ignored.");
|
set("moving.running.check", "If true, check if a player is running too fast/jumping too high.\nIf this is true, 'flying.check' is ignored.");
|
||||||
set("moving.running.speedlimit", "Set the speed limit for moving horizontal under 'normal' conditions.\nUnit is 1/100 of a block, default is 22.");
|
set("moving.running.walkingspeedlimit", "Set the speed limit for moving horizontal under 'normal' conditions.\nUnit is 1/100 of a block, default is 22.");
|
||||||
|
set("moving.running.sprintingspeedlimit", "Set the speed limit for moving horizontal while sprinting.\nUnit is 1/100 of a block, default is 44.");
|
||||||
set("moving.running.swimming.check", "If 'running.check' and this are active, use a seperate speed limit for swimming players.");
|
set("moving.running.swimming.check", "If 'running.check' and this are active, use a seperate speed limit for swimming players.");
|
||||||
set("moving.running.swimming.speedlimit", "Set the speed limit for moving horizontal while in water.\nUnit is 1/100 of a block, default is 18");
|
set("moving.running.swimming.speedlimit", "Set the speed limit for moving horizontal while in water.\nUnit is 1/100 of a block, default is 18");
|
||||||
set("moving.running.sneaking.check", "If 'running.check' and this are active, use a seperate speed limit for sneaking players.");
|
set("moving.running.sneaking.check", "If 'running.check' and this are active, use a seperate speed limit for sneaking players.");
|
||||||
|
@ -70,6 +70,10 @@ public class NoCheat extends JavaPlugin {
|
|||||||
|
|
||||||
// First set up logging
|
// First set up logging
|
||||||
this.log = new LogManager(this);
|
this.log = new LogManager(this);
|
||||||
|
|
||||||
|
|
||||||
|
log.logToConsole(LogLevel.MED, "[NoCheat] This version is EXPERIMENTAL and built specifically for CB #1118. It may break at any time and for any other version.");
|
||||||
|
|
||||||
this.data = new DataManager();
|
this.data = new DataManager();
|
||||||
|
|
||||||
this.action = new ActionManager(log);
|
this.action = new ActionManager(log);
|
||||||
|
@ -4,6 +4,7 @@ import java.util.HashMap;
|
|||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.craftbukkit.entity.CraftPlayer;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import cc.co.evenprime.bukkit.nocheat.NoCheat;
|
import cc.co.evenprime.bukkit.nocheat.NoCheat;
|
||||||
@ -129,8 +130,10 @@ public class RunningCheck {
|
|||||||
distanceAboveLimit = totalDistance - cc.moving.sneakingSpeedLimit - data.horizFreedom;
|
distanceAboveLimit = totalDistance - cc.moving.sneakingSpeedLimit - data.horizFreedom;
|
||||||
} else if(cc.moving.swimmingCheck && isSwimming && !player.hasPermission(Permissions.MOVE_SWIM)) {
|
} else if(cc.moving.swimmingCheck && isSwimming && !player.hasPermission(Permissions.MOVE_SWIM)) {
|
||||||
distanceAboveLimit = totalDistance - cc.moving.swimmingSpeedLimit - data.horizFreedom;
|
distanceAboveLimit = totalDistance - cc.moving.swimmingSpeedLimit - data.horizFreedom;
|
||||||
|
} else if(player instanceof CraftPlayer && !((CraftPlayer)player).getHandle().at()){
|
||||||
|
distanceAboveLimit = totalDistance - cc.moving.walkingSpeedLimit - data.horizFreedom;
|
||||||
} else {
|
} else {
|
||||||
distanceAboveLimit = totalDistance - cc.moving.runningSpeedLimit - data.horizFreedom;
|
distanceAboveLimit = totalDistance - cc.moving.sprintingSpeedLimit - data.horizFreedom;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Did he go too far?
|
// Did he go too far?
|
||||||
|
@ -21,7 +21,8 @@ public class CCMoving {
|
|||||||
public final ActionList flyingActions;
|
public final ActionList flyingActions;
|
||||||
|
|
||||||
public final boolean runningCheck;
|
public final boolean runningCheck;
|
||||||
public final double runningSpeedLimit;
|
public final double walkingSpeedLimit;
|
||||||
|
public final double sprintingSpeedLimit;
|
||||||
|
|
||||||
public final ActionList runningActions;
|
public final ActionList runningActions;
|
||||||
|
|
||||||
@ -46,7 +47,8 @@ public class CCMoving {
|
|||||||
flyingActions = data.getActionList("moving.flying.actions");
|
flyingActions = data.getActionList("moving.flying.actions");
|
||||||
|
|
||||||
runningCheck = data.getBoolean("moving.running.check");
|
runningCheck = data.getBoolean("moving.running.check");
|
||||||
runningSpeedLimit = ((double) data.getInteger("moving.running.speedlimit")) / 100D;
|
walkingSpeedLimit = ((double) data.getInteger("moving.running.walkingspeedlimit")) / 100D;
|
||||||
|
sprintingSpeedLimit = ((double) data.getInteger("moving.running.sprintingspeedlimit")) / 100D;
|
||||||
runningActions = data.getActionList("moving.running.actions");
|
runningActions = data.getActionList("moving.running.actions");
|
||||||
swimmingCheck = data.getBoolean("moving.running.swimming.check");
|
swimmingCheck = data.getBoolean("moving.running.swimming.check");
|
||||||
swimmingSpeedLimit = ((double) data.getInteger("moving.running.swimming.speedlimit")) / 100D;
|
swimmingSpeedLimit = ((double) data.getInteger("moving.running.swimming.speedlimit")) / 100D;
|
||||||
|
Loading…
Reference in New Issue
Block a user