Add option to assume the player is sprinting when possible (read on).

This is a workaround for the case that sprinting events are missing,
wrongly set up or for events firing in an unusual order.

This does allow speeding hacks that allow players to go at sprinting
speed without telling the server, so it should only be turned on if
there is any issues.

The option has to be turned on: checks.moving.assumesprint
This commit is contained in:
asofold 2014-02-09 13:50:30 +01:00
parent ad2105bdfb
commit 12b046f5a7
5 changed files with 8 additions and 11 deletions

View File

@ -145,6 +145,7 @@ public class MovingConfig extends ACheckConfig {
public final boolean tempKickIllegal;
public final boolean loadChunksOnJoin;
public final long sprintingGrace;
public final boolean assumeSprint;
public final int speedGrace;
public final boolean vehicleEnforceLocation;
public final boolean vehiclePreventDestroyOwn;
@ -221,6 +222,7 @@ public class MovingConfig extends ACheckConfig {
tempKickIllegal = config.getBoolean(ConfPaths.MOVING_TEMPKICKILLEGAL);
loadChunksOnJoin = config.getBoolean(ConfPaths.MOVING_LOADCHUNKS_JOIN);
sprintingGrace = Math.max(0L, (long) (config.getDouble(ConfPaths.MOVING_SPRINTINGGRACE) * 1000.0)); // Config: seconds.
assumeSprint = config.getBoolean(ConfPaths.MOVING_ASSUMESPRINT);
speedGrace = Math.max(0, (int) Math.round(config.getDouble(ConfPaths.MOVING_SPEEDGRACE) * 20.0)); // Config: seconds
vehicleEnforceLocation = config.getBoolean(ConfPaths.MOVING_VEHICLES_ENFORCELOCATION);

View File

@ -479,8 +479,8 @@ public class MovingListener extends CheckListener implements TickListener, IRemo
}
final long time = System.currentTimeMillis();
if (player.isSprinting()) {
//
if (player.isSprinting() || cc.assumeSprint) {
// Hard to confine assumesprint further (some logics change with hdist or sprinting).
if (player.getFoodLevel() > 5) {
data.timeSprinting = time;
}

View File

@ -1439,6 +1439,7 @@ public class SurvivalFly extends Check {
}
if (player.isSleeping()) tags.add("sleeping");
if (player.getFoodLevel() <= 5 && player.isSprinting()) {
// Exception: does not take into account latency.
tags.add("lowfoodsprint");
}
if (!tags.isEmpty()) builder.append("\n" + " tags: " + StringUtil.join(tags, "+"));

View File

@ -640,6 +640,7 @@ public abstract class ConfPaths {
private static final String MOVING_LOADCHUNKS = MOVING + "loadchunks.";
public static final String MOVING_LOADCHUNKS_JOIN = MOVING_LOADCHUNKS + "join";
public static final String MOVING_SPRINTINGGRACE = MOVING + "sprintinggrace";
public static final String MOVING_ASSUMESPRINT = MOVING + "assumesprint";
public static final String MOVING_SPEEDGRACE = MOVING + "speedgrace";
private static final String MOVING_VEHICLES = MOVING + "vehicles.";

View File

@ -410,15 +410,7 @@ public class DefaultConfig extends ConfigFile {
set(ConfPaths.INVENTORY_OPEN_CLOSE, true);
set(ConfPaths.INVENTORY_OPEN_CANCELOTHER, true);
/*
* e e ,e,
* d8b d8b e88 88e Y8b Y888P " 888 8e e88 888
* e Y8b Y8b d888 888b Y8b Y8P 888 888 88b d888 888
* d8b Y8b Y8b Y888 888P Y8b " 888 888 888 Y888 888
* d888b Y8b Y8b "88 88" Y8P 888 888 888 "88 888
* , 88P
* "8",P"
*/
// MOVING
set(ConfPaths.MOVING_CREATIVEFLY_CHECK, true);
set(ConfPaths.MOVING_CREATIVEFLY_IGNOREALLOWFLIGHT, false);
set(ConfPaths.MOVING_CREATIVEFLY_IGNORECREATIVE, false);
@ -484,6 +476,7 @@ public class DefaultConfig extends ConfigFile {
set(ConfPaths.MOVING_TEMPKICKILLEGAL, true);
set(ConfPaths.MOVING_LOADCHUNKS_JOIN, true);
set(ConfPaths.MOVING_SPRINTINGGRACE, 2.0);
set(ConfPaths.MOVING_ASSUMESPRINT, false);
set(ConfPaths.MOVING_SPEEDGRACE, 4.0);
/*