From 6cf60193b06e404403236fa38ecbcd4feb9aab11 Mon Sep 17 00:00:00 2001 From: md_5 Date: Mon, 3 Sep 2018 08:00:50 +1000 Subject: [PATCH] SPIGOT-4340: Improve client bug workaround --- nms-patches/PlayerConnection.patch | 31 ++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/nms-patches/PlayerConnection.patch b/nms-patches/PlayerConnection.patch index 380ec94c0d..a33f7b4969 100644 --- a/nms-patches/PlayerConnection.patch +++ b/nms-patches/PlayerConnection.patch @@ -284,7 +284,15 @@ this.player.setLocation(this.teleportPos.x, this.teleportPos.y, this.teleportPos.z, this.player.yaw, this.player.pitch); this.o = this.teleportPos.x; 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) { PlayerConnectionUtils.ensureMainThread(packetplayintabcomplete, this, this.player.getWorldServer()); @@ -297,7 +305,7 @@ StringReader stringreader = new StringReader(packetplayintabcomplete.c()); 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()); 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) { @@ -323,7 +331,7 @@ ItemStack itemstack = packetplayinbedit.b(); if (!itemstack.isEmpty()) { -@@ -516,11 +724,13 @@ +@@ -516,11 +725,13 @@ } itemstack2.a("pages", (NBTBase) nbttaglist); @@ -339,7 +347,7 @@ } } -@@ -560,7 +770,7 @@ +@@ -560,7 +771,7 @@ } else { WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension); @@ -348,7 +356,7 @@ if (this.e == 0) { this.syncPosition(); } -@@ -570,13 +780,21 @@ +@@ -570,13 +781,21 @@ this.A = this.e; 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 d1 = this.player.locY; double d2 = this.player.locZ; -@@ -601,15 +819,33 @@ +@@ -601,15 +820,33 @@ ++this.receivedMovePackets; 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)); this.a(this.player.locX, this.player.locY, this.player.locZ, this.player.yaw, this.player.pitch); return; -@@ -655,6 +891,69 @@ +@@ -655,6 +892,69 @@ } } @@ -477,7 +485,7 @@ this.B = d12 >= -0.03125D; 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)); -@@ -672,10 +971,76 @@ +@@ -672,10 +972,76 @@ } 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 d4 = set.contains(PacketPlayOutPosition.EnumPlayerTeleportFlags.Y) ? this.player.locY : 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; } @@ -570,8 +578,7 @@ this.A = this.e; 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.minecraftServer.getPlayerList().d(this.player); // CraftBukkit - } +@@ -694,6 +1068,7 @@ public void a(PacketPlayInBlockDig packetplayinblockdig) { PlayerConnectionUtils.ensureMainThread(packetplayinblockdig, this, this.player.getWorldServer());