Distinguish method by Minecraft version. Skip packet level pre-1.9.

This commit is contained in:
asofold 2017-04-08 23:54:53 +02:00
parent 5be2f45ba7
commit f221086729
2 changed files with 12 additions and 2 deletions

View File

@ -346,7 +346,16 @@ public class MovingConfig extends ACheckConfig {
));
final PlayerSetBackMethod playerSetBackMethod = PlayerSetBackMethod.fromString(
"extern.fromconfig", config.getString(ConfPaths.MOVING_SETBACK_METHOD));
this.playerSetBackMethod = playerSetBackMethod.doesThisMakeSense() ? playerSetBackMethod : PlayerSetBackMethod.CAUTIOUS;
if (playerSetBackMethod.doesThisMakeSense()) {
this.playerSetBackMethod = playerSetBackMethod;
}
else if (ServerVersion.compareMinecraftVersion("1.9") < 0) {
this.playerSetBackMethod = PlayerSetBackMethod.LEGACY;
}
else {
// Latest.
this.playerSetBackMethod = PlayerSetBackMethod.CAUTIOUS;
}
traceMaxAge = config.getInt(ConfPaths.MOVING_TRACE_MAXAGE, 200);
traceMaxSize = config.getInt(ConfPaths.MOVING_TRACE_MAXSIZE, 200);
@ -380,6 +389,7 @@ public class MovingConfig extends ACheckConfig {
catch (IllegalArgumentException e) {}
}
// Messages.
msgKickIllegalMove = ColorUtil.replaceColors(config.getString(ConfPaths.MOVING_MESSAGE_ILLEGALPLAYERMOVE));
msgKickIllegalVehicleMove = ColorUtil.replaceColors(config.getString(ConfPaths.MOVING_MESSAGE_ILLEGALVEHICLEMOVE));

View File

@ -447,7 +447,7 @@ public class MovingUtil {
// TODO: Consider to skip checking for packet level, if not available (plus optimize access).
// TODO: Consider a config flag, so this can be turned off (set back method).
final PlayerSetBackMethod method = MovingConfig.getConfig(player).playerSetBackMethod;
if (method.shouldCancel() || method.shouldSetTo()) {
if ((method.shouldCancel() || method.shouldSetTo()) && method.shouldUpdateFrom()) {
/*
* Another leniency option: Skip, if we have already received an
* ACK for this position on packet level.