diff options
author | Jake Potrebic <[email protected]> | 2024-05-29 13:58:57 -0700 |
---|---|---|
committer | GitHub <[email protected]> | 2024-05-29 22:58:57 +0200 |
commit | a31dc90741ed9c121a13a3c124c9ebf5bafd0da7 (patch) | |
tree | 81963bd94fe7772ee08bd21710230de21b6b25da /patches/server/0525-fix-PlayerItemHeldEvent-firing-twice.patch | |
parent | ed85aac53cfd93d29fa24e6071dbdddd0e49624b (diff) | |
download | Paper-a31dc90741ed9c121a13a3c124c9ebf5bafd0da7.tar.gz Paper-a31dc90741ed9c121a13a3c124c9ebf5bafd0da7.zip |
Several fixes and new api for experience merging/stacking (#9242)
Diffstat (limited to 'patches/server/0525-fix-PlayerItemHeldEvent-firing-twice.patch')
-rw-r--r-- | patches/server/0525-fix-PlayerItemHeldEvent-firing-twice.patch | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/patches/server/0525-fix-PlayerItemHeldEvent-firing-twice.patch b/patches/server/0525-fix-PlayerItemHeldEvent-firing-twice.patch new file mode 100644 index 0000000000..ea56241b84 --- /dev/null +++ b/patches/server/0525-fix-PlayerItemHeldEvent-firing-twice.patch @@ -0,0 +1,18 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: chickeneer <[email protected]> +Date: Thu, 22 Apr 2021 19:02:07 -0700 +Subject: [PATCH] fix PlayerItemHeldEvent firing twice + + +diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +index cf53e6270ef3cdd3baa251e813eeb3526919bbcc..22da7f7c4b033d31b7a71878e34562a4370a4bd4 100644 +--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java ++++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +@@ -1917,6 +1917,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl + PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel()); + if (this.player.isImmobile()) return; // CraftBukkit + if (packet.getSlot() >= 0 && packet.getSlot() < Inventory.getSelectionSize()) { ++ if (packet.getSlot() == this.player.getInventory().selected) { return; } // Paper - don't fire itemheldevent when there wasn't a slot change + PlayerItemHeldEvent event = new PlayerItemHeldEvent(this.getCraftPlayer(), this.player.getInventory().selected, packet.getSlot()); + this.cserver.getPluginManager().callEvent(event); + if (event.isCancelled()) { |