SPIGOT-4340: Improve client bug workaround

This commit is contained in:
md_5 2018-09-03 08:00:50 +10:00
parent 60d7982024
commit 6cf60193b0

View File

@ -284,7 +284,15 @@
this.player.setLocation(this.teleportPos.x, this.teleportPos.y, this.teleportPos.z, this.player.yaw, this.player.pitch); this.player.setLocation(this.teleportPos.x, this.teleportPos.y, this.teleportPos.z, this.player.yaw, this.player.pitch);
this.o = this.teleportPos.x; this.o = this.teleportPos.x;
this.p = this.teleportPos.y; this.p = this.teleportPos.y;
@@ -289,6 +481,12 @@ @@ -253,6 +445,7 @@
}
this.teleportPos = null;
+ this.minecraftServer.getPlayerList().d(this.player); // CraftBukkit
}
}
@@ -289,6 +482,12 @@
public void a(PacketPlayInTabComplete packetplayintabcomplete) { public void a(PacketPlayInTabComplete packetplayintabcomplete) {
PlayerConnectionUtils.ensureMainThread(packetplayintabcomplete, this, this.player.getWorldServer()); PlayerConnectionUtils.ensureMainThread(packetplayintabcomplete, this, this.player.getWorldServer());
@ -297,7 +305,7 @@
StringReader stringreader = new StringReader(packetplayintabcomplete.c()); StringReader stringreader = new StringReader(packetplayintabcomplete.c());
if (stringreader.canRead() && stringreader.peek() == 47) { if (stringreader.canRead() && stringreader.peek() == 47) {
@@ -298,7 +496,8 @@ @@ -298,7 +497,8 @@
ParseResults parseresults = this.minecraftServer.getCommandDispatcher().a().parse(stringreader, this.player.getCommandListener()); ParseResults parseresults = this.minecraftServer.getCommandDispatcher().a().parse(stringreader, this.player.getCommandListener());
this.minecraftServer.getCommandDispatcher().a().getCompletionSuggestions(parseresults).thenAccept((suggestions) -> { this.minecraftServer.getCommandDispatcher().a().getCompletionSuggestions(parseresults).thenAccept((suggestions) -> {
@ -307,7 +315,7 @@
}); });
} }
@@ -492,6 +691,15 @@ @@ -492,6 +692,15 @@
} }
public void a(PacketPlayInBEdit packetplayinbedit) { public void a(PacketPlayInBEdit packetplayinbedit) {
@ -323,7 +331,7 @@
ItemStack itemstack = packetplayinbedit.b(); ItemStack itemstack = packetplayinbedit.b();
if (!itemstack.isEmpty()) { if (!itemstack.isEmpty()) {
@@ -516,11 +724,13 @@ @@ -516,11 +725,13 @@
} }
itemstack2.a("pages", (NBTBase) nbttaglist); itemstack2.a("pages", (NBTBase) nbttaglist);
@ -339,7 +347,7 @@
} }
} }
@@ -560,7 +770,7 @@ @@ -560,7 +771,7 @@
} else { } else {
WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension); WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension);
@ -348,7 +356,7 @@
if (this.e == 0) { if (this.e == 0) {
this.syncPosition(); this.syncPosition();
} }
@@ -570,13 +780,21 @@ @@ -570,13 +781,21 @@
this.A = this.e; this.A = this.e;
this.a(this.teleportPos.x, this.teleportPos.y, this.teleportPos.z, this.player.yaw, this.player.pitch); this.a(this.teleportPos.x, this.teleportPos.y, this.teleportPos.z, this.player.yaw, this.player.pitch);
} }
@ -371,7 +379,7 @@
double d0 = this.player.locX; double d0 = this.player.locX;
double d1 = this.player.locY; double d1 = this.player.locY;
double d2 = this.player.locZ; double d2 = this.player.locZ;
@@ -601,15 +819,33 @@ @@ -601,15 +820,33 @@
++this.receivedMovePackets; ++this.receivedMovePackets;
int i = this.receivedMovePackets - this.processedMovePackets; int i = this.receivedMovePackets - this.processedMovePackets;
@ -407,7 +415,7 @@
PlayerConnection.LOGGER.warn("{} moved too quickly! {},{},{}", this.player.getDisplayName().getString(), Double.valueOf(d7), Double.valueOf(d8), Double.valueOf(d9)); PlayerConnection.LOGGER.warn("{} moved too quickly! {},{},{}", this.player.getDisplayName().getString(), Double.valueOf(d7), Double.valueOf(d8), Double.valueOf(d9));
this.a(this.player.locX, this.player.locY, this.player.locZ, this.player.yaw, this.player.pitch); this.a(this.player.locX, this.player.locY, this.player.locZ, this.player.yaw, this.player.pitch);
return; return;
@@ -655,6 +891,69 @@ @@ -655,6 +892,69 @@
} }
} }
@ -477,7 +485,7 @@
this.B = d12 >= -0.03125D; this.B = d12 >= -0.03125D;
this.B &= !this.minecraftServer.getAllowFlight() && !this.player.abilities.canFly; this.B &= !this.minecraftServer.getAllowFlight() && !this.player.abilities.canFly;
this.B &= !this.player.hasEffect(MobEffects.LEVITATION) && !this.player.dc() && !worldserver.a(this.player.getBoundingBox().g(0.0625D).b(0.0D, -0.55D, 0.0D)); this.B &= !this.player.hasEffect(MobEffects.LEVITATION) && !this.player.dc() && !worldserver.a(this.player.getBoundingBox().g(0.0625D).b(0.0D, -0.55D, 0.0D));
@@ -672,10 +971,76 @@ @@ -672,10 +972,76 @@
} }
public void a(double d0, double d1, double d2, float f, float f1) { public void a(double d0, double d1, double d2, float f, float f1) {
@ -555,7 +563,7 @@
double d3 = set.contains(PacketPlayOutPosition.EnumPlayerTeleportFlags.X) ? this.player.locX : 0.0D; double d3 = set.contains(PacketPlayOutPosition.EnumPlayerTeleportFlags.X) ? this.player.locX : 0.0D;
double d4 = set.contains(PacketPlayOutPosition.EnumPlayerTeleportFlags.Y) ? this.player.locY : 0.0D; double d4 = set.contains(PacketPlayOutPosition.EnumPlayerTeleportFlags.Y) ? this.player.locY : 0.0D;
double d5 = set.contains(PacketPlayOutPosition.EnumPlayerTeleportFlags.Z) ? this.player.locZ : 0.0D; double d5 = set.contains(PacketPlayOutPosition.EnumPlayerTeleportFlags.Z) ? this.player.locZ : 0.0D;
@@ -687,13 +1052,23 @@ @@ -687,6 +1053,14 @@
this.teleportAwait = 0; this.teleportAwait = 0;
} }
@ -570,8 +578,7 @@
this.A = this.e; this.A = this.e;
this.player.setLocation(d0, d1, d2, f, f1); this.player.setLocation(d0, d1, d2, f, f1);
this.player.playerConnection.sendPacket(new PacketPlayOutPosition(d0 - d3, d1 - d4, d2 - d5, f - f2, f1 - f3, set, this.teleportAwait)); this.player.playerConnection.sendPacket(new PacketPlayOutPosition(d0 - d3, d1 - d4, d2 - d5, f - f2, f1 - f3, set, this.teleportAwait));
+ this.minecraftServer.getPlayerList().d(this.player); // CraftBukkit @@ -694,6 +1068,7 @@
}
public void a(PacketPlayInBlockDig packetplayinblockdig) { public void a(PacketPlayInBlockDig packetplayinblockdig) {
PlayerConnectionUtils.ensureMainThread(packetplayinblockdig, this, this.player.getWorldServer()); PlayerConnectionUtils.ensureMainThread(packetplayinblockdig, this, this.player.getWorldServer());