SPIGOT-3571: Packet handling must be synchronous

This commit is contained in:
md_5 2017-09-19 08:00:56 +10:00
parent 9a1f5ee80a
commit 94b0980852

View File

@ -1519,7 +1519,15 @@
tileentitysign.update();
worldserver.notify(blockposition, iblockdata, iblockdata, 3);
@@ -1016,11 +2089,27 @@
@@ -999,6 +2072,7 @@
}
public void a(PacketPlayInKeepAlive packetplayinkeepalive) {
+ PlayerConnectionUtils.ensureMainThread(packetplayinkeepalive, this, this.player.x()); // CraftBukkit
if (this.g && packetplayinkeepalive.a() == this.h) {
int i = (int) (this.d() - this.f);
@@ -1016,11 +2090,27 @@
public void a(PacketPlayInAbilities packetplayinabilities) {
PlayerConnectionUtils.ensureMainThread(packetplayinabilities, this, this.player.x());
@ -1548,7 +1556,7 @@
ArrayList arraylist = Lists.newArrayList();
Iterator iterator = this.minecraftServer.tabCompleteCommand(this.player, packetplayintabcomplete.a(), packetplayintabcomplete.b(), packetplayintabcomplete.c()).iterator();
@@ -1046,6 +2135,13 @@
@@ -1046,6 +2136,13 @@
ItemStack itemstack1;
if ("MC|BEdit".equals(s)) {
@ -1562,7 +1570,7 @@
packetdataserializer = packetplayincustompayload.b();
try {
@@ -1064,15 +2160,25 @@
@@ -1064,15 +2161,25 @@
}
if (itemstack.getItem() == Items.WRITABLE_BOOK && itemstack.getItem() == itemstack1.getItem()) {
@ -1588,7 +1596,7 @@
packetdataserializer = packetplayincustompayload.b();
try {
@@ -1106,10 +2212,11 @@
@@ -1106,10 +2213,11 @@
}
itemstack2.a("pages", (NBTBase) nbttaglist);
@ -1601,7 +1609,7 @@
}
} else if ("MC|TrSel".equals(s)) {
try {
@@ -1121,6 +2228,7 @@
@@ -1121,6 +2229,7 @@
}
} catch (Exception exception2) {
PlayerConnection.LOGGER.error("Couldn\'t select trade", exception2);
@ -1609,7 +1617,7 @@
}
} else {
TileEntity tileentity;
@@ -1170,6 +2278,7 @@
@@ -1170,6 +2279,7 @@
}
} catch (Exception exception3) {
PlayerConnection.LOGGER.error("Couldn\'t set command block", exception3);
@ -1617,7 +1625,7 @@
}
} else if ("MC|AutoCmd".equals(s)) {
if (!this.minecraftServer.getEnableCommandBlock()) {
@@ -1237,6 +2346,7 @@
@@ -1237,6 +2347,7 @@
}
} catch (Exception exception4) {
PlayerConnection.LOGGER.error("Couldn\'t set command block", exception4);
@ -1625,7 +1633,7 @@
}
} else {
int k;
@@ -1260,6 +2370,7 @@
@@ -1260,6 +2371,7 @@
}
} catch (Exception exception5) {
PlayerConnection.LOGGER.error("Couldn\'t set beacon", exception5);
@ -1633,7 +1641,7 @@
}
}
} else if ("MC|ItemName".equals(s)) {
@@ -1346,6 +2457,7 @@
@@ -1346,6 +2458,7 @@
}
} catch (Exception exception6) {
PlayerConnection.LOGGER.error("Couldn\'t set structure block", exception6);
@ -1641,7 +1649,7 @@
}
} else if ("MC|PickItem".equals(s)) {
packetdataserializer = packetplayincustompayload.b();
@@ -1358,11 +2470,49 @@
@@ -1358,11 +2471,49 @@
this.player.playerConnection.sendPacket(new PacketPlayOutHeldItemSlot(this.player.inventory.itemInHandIndex));
} catch (Exception exception7) {
PlayerConnection.LOGGER.error("Couldn\'t pick item", exception7);