Fix client stall in specific teleportation scenarios

This commit is contained in:
md_5 2018-08-26 19:44:10 +10:00
parent b3dc236663
commit 997d378dab

View File

@ -555,7 +555,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,6 +1052,14 @@
@@ -687,13 +1052,23 @@
this.teleportAwait = 0;
}
@ -570,7 +570,8 @@
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));
@@ -694,6 +1067,7 @@
+ this.minecraftServer.getPlayerList().d(this.player); // CraftBukkit
}
public void a(PacketPlayInBlockDig packetplayinblockdig) {
PlayerConnectionUtils.ensureMainThread(packetplayinblockdig, this, this.player.getWorldServer());
@ -578,7 +579,7 @@
WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension);
BlockPosition blockposition = packetplayinblockdig.b();
@@ -703,14 +1077,46 @@
@@ -703,14 +1078,46 @@
if (!this.player.isSpectator()) {
ItemStack itemstack = this.player.b(EnumHand.OFF_HAND);
@ -627,7 +628,7 @@
this.player.a(false);
}
@@ -744,7 +1150,15 @@
@@ -744,7 +1151,15 @@
if (!this.minecraftServer.a(worldserver, blockposition, this.player) && worldserver.getWorldBorder().a(blockposition)) {
this.player.playerInteractManager.a(blockposition, packetplayinblockdig.c());
} else {
@ -643,7 +644,7 @@
}
} else {
if (packetplayinblockdig.d() == PacketPlayInBlockDig.EnumPlayerDigType.STOP_DESTROY_BLOCK) {
@@ -764,10 +1178,12 @@
@@ -764,10 +1179,12 @@
default:
throw new IllegalArgumentException("Invalid player action");
}
@ -656,7 +657,7 @@
WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension);
EnumHand enumhand = packetplayinuseitem.d();
ItemStack itemstack = this.player.b(enumhand);
@@ -780,6 +1196,13 @@
@@ -780,6 +1197,13 @@
this.player.playerConnection.sendPacket(new PacketPlayOutChat(ichatbasecomponent, ChatMessageType.GAME_INFO));
} else if (this.teleportPos == null && this.player.d((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D) < 64.0D && !this.minecraftServer.a(worldserver, blockposition, this.player) && worldserver.getWorldBorder().a(blockposition)) {
@ -670,7 +671,7 @@
this.player.playerInteractManager.a(this.player, worldserver, itemstack, enumhand, blockposition, enumdirection, packetplayinuseitem.e(), packetplayinuseitem.f(), packetplayinuseitem.g());
}
@@ -789,13 +1212,52 @@
@@ -789,13 +1213,52 @@
public void a(PacketPlayInBlockPlace packetplayinblockplace) {
PlayerConnectionUtils.ensureMainThread(packetplayinblockplace, this, this.player.getWorldServer());
@ -724,7 +725,7 @@
}
}
@@ -815,13 +1277,18 @@
@@ -815,13 +1278,18 @@
}
if (entity != null) {
@ -745,7 +746,7 @@
public void a(PacketPlayInBoatMove packetplayinboatmove) {
PlayerConnectionUtils.ensureMainThread(packetplayinboatmove, this, this.player.getWorldServer());
@@ -834,11 +1301,26 @@
@@ -834,11 +1302,26 @@
}
public void a(IChatBaseComponent ichatbasecomponent) {
@ -773,7 +774,7 @@
if (this.minecraftServer.H() && this.player.getDisplayName().getString().equals(this.minecraftServer.G())) {
PlayerConnection.LOGGER.info("Stopping singleplayer server as player logged out");
this.minecraftServer.safeShutdown();
@@ -864,6 +1346,15 @@
@@ -864,6 +1347,15 @@
}
}
@ -789,7 +790,7 @@
try {
this.networkManager.sendPacket(packet, genericfuturelistener);
} catch (Throwable throwable) {
@@ -879,17 +1370,37 @@
@@ -879,17 +1371,37 @@
public void a(PacketPlayInHeldItemSlot packetplayinhelditemslot) {
PlayerConnectionUtils.ensureMainThread(packetplayinhelditemslot, this, this.player.getWorldServer());
@ -829,7 +830,7 @@
this.sendPacket(new PacketPlayOutChat((new ChatMessage("chat.cannotSend", new Object[0])).a(EnumChatFormat.RED)));
} else {
this.player.resetIdleTimer();
@@ -899,39 +1410,249 @@
@@ -899,39 +1411,249 @@
for (int i = 0; i < s.length(); ++i) {
if (!SharedConstants.isAllowedChatCharacter(s.charAt(i))) {
@ -1086,7 +1087,7 @@
this.player.resetIdleTimer();
IJumpable ijumpable;
@@ -1003,6 +1724,7 @@
@@ -1003,6 +1725,7 @@
public void a(PacketPlayInUseEntity packetplayinuseentity) {
PlayerConnectionUtils.ensureMainThread(packetplayinuseentity, this, this.player.getWorldServer());
@ -1094,7 +1095,7 @@
WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension);
Entity entity = packetplayinuseentity.a((World) worldserver);
@@ -1018,20 +1740,73 @@
@@ -1018,20 +1741,73 @@
if (this.player.h(entity) < d0) {
EnumHand enumhand;
@ -1169,7 +1170,7 @@
}
}
}
@@ -1047,7 +1822,8 @@
@@ -1047,7 +1823,8 @@
case PERFORM_RESPAWN:
if (this.player.viewingCredits) {
this.player.viewingCredits = false;
@ -1179,7 +1180,7 @@
CriterionTriggers.v.a(this.player, DimensionManager.THE_END, DimensionManager.OVERWORLD);
} else {
if (this.player.getHealth() > 0.0F) {
@@ -1070,14 +1846,20 @@
@@ -1070,14 +1847,20 @@
public void a(PacketPlayInCloseWindow packetplayinclosewindow) {
PlayerConnectionUtils.ensureMainThread(packetplayinclosewindow, this, this.player.getWorldServer());
@ -1202,7 +1203,7 @@
NonNullList nonnulllist = NonNullList.a();
for (int i = 0; i < this.player.activeContainer.slots.size(); ++i) {
@@ -1086,8 +1868,274 @@
@@ -1086,8 +1869,274 @@
this.player.a(this.player.activeContainer, nonnulllist);
} else {
@ -1478,7 +1479,7 @@
if (ItemStack.matches(packetplayinwindowclick.f(), itemstack)) {
this.player.playerConnection.sendPacket(new PacketPlayOutTransaction(packetplayinwindowclick.b(), packetplayinwindowclick.e(), true));
this.player.f = true;
@@ -1130,6 +2178,7 @@
@@ -1130,6 +2179,7 @@
public void a(PacketPlayInEnchantItem packetplayinenchantitem) {
PlayerConnectionUtils.ensureMainThread(packetplayinenchantitem, this, this.player.getWorldServer());
@ -1486,7 +1487,7 @@
this.player.resetIdleTimer();
if (this.player.activeContainer.windowId == packetplayinenchantitem.b() && this.player.activeContainer.c(this.player) && !this.player.isSpectator()) {
this.player.activeContainer.a(this.player, packetplayinenchantitem.c());
@@ -1161,6 +2210,43 @@
@@ -1161,6 +2211,43 @@
boolean flag1 = packetplayinsetcreativeslot.b() >= 1 && packetplayinsetcreativeslot.b() <= 45;
boolean flag2 = itemstack.isEmpty() || itemstack.getDamage() >= 0 && itemstack.getCount() <= 64 && !itemstack.isEmpty();
@ -1530,7 +1531,7 @@
if (flag1 && flag2) {
if (itemstack.isEmpty()) {
@@ -1184,6 +2270,7 @@
@@ -1184,6 +2271,7 @@
public void a(PacketPlayInTransaction packetplayintransaction) {
PlayerConnectionUtils.ensureMainThread(packetplayintransaction, this, this.player.getWorldServer());
@ -1538,7 +1539,7 @@
Short oshort = (Short) this.k.get(this.player.activeContainer.windowId);
if (oshort != null && packetplayintransaction.c() == oshort.shortValue() && this.player.activeContainer.windowId == packetplayintransaction.b() && !this.player.activeContainer.c(this.player) && !this.player.isSpectator()) {
@@ -1194,6 +2281,7 @@
@@ -1194,6 +2282,7 @@
public void a(PacketPlayInUpdateSign packetplayinupdatesign) {
PlayerConnectionUtils.ensureMainThread(packetplayinupdatesign, this, this.player.getWorldServer());
@ -1546,7 +1547,7 @@
this.player.resetIdleTimer();
WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension);
BlockPosition blockposition = packetplayinupdatesign.b();
@@ -1210,14 +2298,30 @@
@@ -1210,14 +2299,30 @@
if (!tileentitysign.d() || tileentitysign.e() != this.player) {
this.minecraftServer.warning("Player " + this.player.getDisplayName().getString() + " just tried to change non-editable sign");
@ -1578,7 +1579,7 @@
tileentitysign.update();
worldserver.notify(blockposition, iblockdata, iblockdata, 3);
@@ -1226,6 +2330,7 @@
@@ -1226,6 +2331,7 @@
}
public void a(PacketPlayInKeepAlive packetplayinkeepalive) {
@ -1586,7 +1587,7 @@
if (this.g && packetplayinkeepalive.b() == this.h) {
int i = (int) (SystemUtils.b() - this.f);
@@ -1239,7 +2344,17 @@
@@ -1239,7 +2345,17 @@
public void a(PacketPlayInAbilities packetplayinabilities) {
PlayerConnectionUtils.ensureMainThread(packetplayinabilities, this, this.player.getWorldServer());
@ -1605,7 +1606,7 @@
}
public void a(PacketPlayInSettings packetplayinsettings) {
@@ -1247,5 +2362,47 @@
@@ -1247,5 +2363,47 @@
this.player.a(packetplayinsettings);
}