3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-11-16 21:10:17 +01:00

Made the movement speed check more reliable on high load servers.

Dieser Commit ist enthalten in:
EvilSeph 2011-05-09 14:51:01 -04:00
Ursprung 98633a9f16
Commit 0faaf5af8a
2 geänderte Dateien mit 9 neuen und 2 gelöschten Zeilen

Datei anzeigen

@ -55,6 +55,7 @@ public class MinecraftServer implements Runnable, ICommandListener {
public OptionSet options;
public ColouredConsoleSender console;
public ConsoleReader reader;
public static int currentTick;
// Craftbukkit end
public MinecraftServer(OptionSet options) { // CraftBukkit - adds argument OptionSet
@ -281,6 +282,7 @@ public class MinecraftServer implements Runnable, ICommandListener {
j = 0L;
} else {
while (j > 50L) {
MinecraftServer.currentTick = (int) (System.currentTimeMillis() / 50); // CraftBukkit
j -= 50L;
this.h();
}

Datei anzeigen

@ -38,6 +38,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
private double z;
private boolean m = true;
private Map n = new HashMap();
private int lastTick = MinecraftServer.currentTick; // CraftBukkit
public NetServerHandler(MinecraftServer minecraftserver, NetworkManager networkmanager, EntityPlayer entityplayer) {
this.minecraftServer = minecraftserver;
@ -277,11 +278,15 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
double d7 = d3 - this.player.locZ;
double d8 = d4 * d4 + d6 * d6 + d7 * d7;
if (d8 > 100.0D) {
a.warning(this.player.name + " moved too quickly!");
// CraftBukkit start - make the movement speed check behave properly under tick degradation.
int elapsedTicks = MinecraftServer.currentTick - this.lastTick;
if (d8 > 100.0D * (elapsedTicks == 0 ? 1 : elapsedTicks)) {
a.warning(this.player.name + " moved too quickly! Elapsed ticks: " + (elapsedTicks == 0 ? 1 : elapsedTicks) + ", Distance change: " + d8);
this.disconnect("You moved too quickly :( (Hacking?)");
return;
}
this.lastTick = MinecraftServer.currentTick;
// CraftBukkit end
float f4 = 0.0625F;
// CraftBukkit