3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-18 20:40:08 +01:00

Ensure PlayerResourcePackStatusEvent is synchronous

Dieser Commit ist enthalten in:
md_5 2017-03-14 21:56:19 +11:00
Ursprung aa522c91a8
Commit 2ad21b87f1

Datei anzeigen

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