From 2ad21b87f1f112752cac419551299043a8ab1111 Mon Sep 17 00:00:00 2001 From: md_5 Date: Tue, 14 Mar 2017 21:56:19 +1100 Subject: Ensure PlayerResourcePackStatusEvent is synchronous --- nms-patches/PlayerConnection.patch | 49 +++++++++++++++++++------------------- 1 file changed, 25 insertions(+), 24 deletions(-) (limited to 'nms-patches') diff --git a/nms-patches/PlayerConnection.patch b/nms-patches/PlayerConnection.patch index 380dbf31..7889169f 100644 --- a/nms-patches/PlayerConnection.patch +++ b/nms-patches/PlayerConnection.patch @@ -664,7 +664,7 @@ if (entity.world == this.player.world) { this.player.enderTeleportTo(entity.locX, entity.locY, entity.locZ); } else { -@@ -555,12 +974,19 @@ +@@ -555,12 +974,20 @@ this.minecraftServer.getPlayerList().b(this.player, worldserver2); this.minecraftServer.getPlayerList().updateClient(this.player); } @@ -679,13 +679,14 @@ - public void a(PacketPlayInResourcePackStatus packetplayinresourcepackstatus) {} + // CraftBukkit start + public void a(PacketPlayInResourcePackStatus packetplayinresourcepackstatus) { ++ PlayerConnectionUtils.ensureMainThread(packetplayinresourcepackstatus, this, this.player.x()); + this.server.getPluginManager().callEvent(new PlayerResourcePackStatusEvent(getPlayer(), PlayerResourcePackStatusEvent.Status.values()[packetplayinresourcepackstatus.status.ordinal()])); + } + // CraftBukkit end public void a(PacketPlayInBoatMove packetplayinboatmove) { PlayerConnectionUtils.ensureMainThread(packetplayinboatmove, this, this.player.x()); -@@ -573,14 +999,29 @@ +@@ -573,14 +1000,29 @@ } public void a(IChatBaseComponent ichatbasecomponent) { @@ -717,7 +718,7 @@ if (this.minecraftServer.R() && this.player.getName().equals(this.minecraftServer.Q())) { PlayerConnection.LOGGER.info("Stopping singleplayer server as player logged out"); this.minecraftServer.safeShutdown(); -@@ -602,6 +1043,15 @@ +@@ -602,6 +1044,15 @@ } } @@ -733,7 +734,7 @@ try { this.networkManager.sendPacket(packet); } catch (Throwable throwable) { -@@ -623,17 +1073,32 @@ +@@ -623,17 +1074,32 @@ public void a(PacketPlayInHeldItemSlot packetplayinhelditemslot) { PlayerConnectionUtils.ensureMainThread(packetplayinhelditemslot, this, this.player.x()); @@ -768,7 +769,7 @@ ChatMessage chatmessage = new ChatMessage("chat.cannotSend", new Object[0]); chatmessage.getChatModifier().setColor(EnumChatFormat.RED); -@@ -646,39 +1111,249 @@ +@@ -646,39 +1112,249 @@ for (int i = 0; i < s.length(); ++i) { if (!SharedConstants.isAllowedChatCharacter(s.charAt(i))) { @@ -1026,7 +1027,7 @@ this.player.resetIdleTimer(); IJumpable ijumpable; -@@ -750,6 +1425,7 @@ +@@ -750,6 +1426,7 @@ public void a(PacketPlayInUseEntity packetplayinuseentity) { PlayerConnectionUtils.ensureMainThread(packetplayinuseentity, this, this.player.x()); @@ -1034,7 +1035,7 @@ WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension); Entity entity = packetplayinuseentity.a((World) worldserver); -@@ -765,20 +1441,68 @@ +@@ -765,20 +1442,68 @@ if (this.player.h(entity) < d0) { EnumHand enumhand; @@ -1104,7 +1105,7 @@ } } } -@@ -794,7 +1518,8 @@ +@@ -794,7 +1519,8 @@ case PERFORM_RESPAWN: if (this.player.viewingCredits) { this.player.viewingCredits = false; @@ -1114,7 +1115,7 @@ } else { if (this.player.getHealth() > 0.0F) { return; -@@ -820,14 +1545,20 @@ +@@ -820,14 +1546,20 @@ public void a(PacketPlayInCloseWindow packetplayinclosewindow) { PlayerConnectionUtils.ensureMainThread(packetplayinclosewindow, this, this.player.x()); @@ -1137,7 +1138,7 @@ NonNullList nonnulllist = NonNullList.a(); for (int i = 0; i < this.player.activeContainer.c.size(); ++i) { -@@ -836,8 +1567,274 @@ +@@ -836,8 +1568,274 @@ this.player.a(this.player.activeContainer, nonnulllist); } else { @@ -1413,7 +1414,7 @@ if (ItemStack.matches(packetplayinwindowclick.e(), itemstack)) { this.player.playerConnection.sendPacket(new PacketPlayOutTransaction(packetplayinwindowclick.a(), packetplayinwindowclick.d(), true)); this.player.f = true; -@@ -866,6 +1863,7 @@ +@@ -866,6 +1864,7 @@ public void a(PacketPlayInEnchantItem packetplayinenchantitem) { PlayerConnectionUtils.ensureMainThread(packetplayinenchantitem, this, this.player.x()); @@ -1421,7 +1422,7 @@ this.player.resetIdleTimer(); if (this.player.activeContainer.windowId == packetplayinenchantitem.a() && this.player.activeContainer.c(this.player) && !this.player.isSpectator()) { this.player.activeContainer.a(this.player, packetplayinenchantitem.b()); -@@ -899,7 +1897,46 @@ +@@ -899,7 +1898,46 @@ } boolean flag1 = packetplayinsetcreativeslot.a() >= 1 && packetplayinsetcreativeslot.a() <= 45; @@ -1469,7 +1470,7 @@ if (flag1 && flag2) { if (itemstack.isEmpty()) { -@@ -923,6 +1960,7 @@ +@@ -923,6 +1961,7 @@ public void a(PacketPlayInTransaction packetplayintransaction) { PlayerConnectionUtils.ensureMainThread(packetplayintransaction, this, this.player.x()); @@ -1477,7 +1478,7 @@ Short oshort = (Short) this.k.get(this.player.activeContainer.windowId); if (oshort != null && packetplayintransaction.b() == oshort.shortValue() && this.player.activeContainer.windowId == packetplayintransaction.a() && !this.player.activeContainer.c(this.player) && !this.player.isSpectator()) { -@@ -933,6 +1971,7 @@ +@@ -933,6 +1972,7 @@ public void a(PacketPlayInUpdateSign packetplayinupdatesign) { PlayerConnectionUtils.ensureMainThread(packetplayinupdatesign, this, this.player.x()); @@ -1485,7 +1486,7 @@ this.player.resetIdleTimer(); WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension); BlockPosition blockposition = packetplayinupdatesign.a(); -@@ -949,14 +1988,30 @@ +@@ -949,14 +1989,30 @@ if (!tileentitysign.a() || tileentitysign.e() != this.player) { this.minecraftServer.warning("Player " + this.player.getName() + " just tried to change non-editable sign"); @@ -1517,7 +1518,7 @@ tileentitysign.update(); worldserver.notify(blockposition, iblockdata, iblockdata, 3); -@@ -979,11 +2034,27 @@ +@@ -979,11 +2035,27 @@ public void a(PacketPlayInAbilities packetplayinabilities) { PlayerConnectionUtils.ensureMainThread(packetplayinabilities, this, this.player.x()); @@ -1546,7 +1547,7 @@ ArrayList arraylist = Lists.newArrayList(); Iterator iterator = this.minecraftServer.tabCompleteCommand(this.player, packetplayintabcomplete.a(), packetplayintabcomplete.b(), packetplayintabcomplete.c()).iterator(); -@@ -1027,10 +2098,13 @@ +@@ -1027,10 +2099,13 @@ } if (itemstack.getItem() == Items.WRITABLE_BOOK && itemstack.getItem() == itemstack1.getItem()) { @@ -1560,7 +1561,7 @@ } } else { String s1; -@@ -1069,10 +2143,11 @@ +@@ -1069,10 +2144,11 @@ } itemstack2.a("pages", (NBTBase) nbttaglist); @@ -1573,7 +1574,7 @@ } } else if ("MC|TrSel".equals(s)) { try { -@@ -1084,6 +2159,7 @@ +@@ -1084,6 +2160,7 @@ } } catch (Exception exception2) { PlayerConnection.LOGGER.error("Couldn\'t select trade", exception2); @@ -1581,7 +1582,7 @@ } } else { TileEntity tileentity; -@@ -1133,6 +2209,7 @@ +@@ -1133,6 +2210,7 @@ } } catch (Exception exception3) { PlayerConnection.LOGGER.error("Couldn\'t set command block", exception3); @@ -1589,7 +1590,7 @@ } } else if ("MC|AutoCmd".equals(s)) { if (!this.minecraftServer.getEnableCommandBlock()) { -@@ -1200,6 +2277,7 @@ +@@ -1200,6 +2278,7 @@ } } catch (Exception exception4) { PlayerConnection.LOGGER.error("Couldn\'t set command block", exception4); @@ -1597,7 +1598,7 @@ } } else { int k; -@@ -1223,6 +2301,7 @@ +@@ -1223,6 +2302,7 @@ } } catch (Exception exception5) { PlayerConnection.LOGGER.error("Couldn\'t set beacon", exception5); @@ -1605,7 +1606,7 @@ } } } else if ("MC|ItemName".equals(s)) { -@@ -1309,6 +2388,7 @@ +@@ -1309,6 +2389,7 @@ } } catch (Exception exception6) { PlayerConnection.LOGGER.error("Couldn\'t set structure block", exception6); @@ -1613,7 +1614,7 @@ } } else if ("MC|PickItem".equals(s)) { packetdataserializer = packetplayincustompayload.b(); -@@ -1323,9 +2403,31 @@ +@@ -1323,9 +2404,31 @@ PlayerConnection.LOGGER.error("Couldn\'t pick item", exception7); } } -- cgit v1.2.3