Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-15 11:00:06 +01:00
41e6073ced
Upstream has released updates that appear to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing CraftBukkit Changes: afa0678e1 SPIGOT-6133: Chorus fruit consumption calls PlayerTeleportEvent multiple times
31 Zeilen
2.1 KiB
Diff
31 Zeilen
2.1 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: chickeneer <emcchickeneer@gmail.com>
|
|
Date: Thu, 22 Apr 2021 19:02:07 -0700
|
|
Subject: [PATCH] fix PlayerItemHeldEvent firing twice
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/network/protocol/game/PacketPlayInHeldItemSlot.java b/src/main/java/net/minecraft/network/protocol/game/PacketPlayInHeldItemSlot.java
|
|
index d68f3e6b35f0af846c8a66710c5752508c095179..0e8ee44d0104ca7c666f57bdb54e0957935d5b34 100644
|
|
--- a/src/main/java/net/minecraft/network/protocol/game/PacketPlayInHeldItemSlot.java
|
|
+++ b/src/main/java/net/minecraft/network/protocol/game/PacketPlayInHeldItemSlot.java
|
|
@@ -24,6 +24,7 @@ public class PacketPlayInHeldItemSlot implements Packet<PacketListenerPlayIn> {
|
|
packetlistenerplayin.a(this);
|
|
}
|
|
|
|
+ public int getItemInHandIndex() { return b(); } // Paper - OBFHELPER
|
|
public int b() {
|
|
return this.itemInHandIndex;
|
|
}
|
|
diff --git a/src/main/java/net/minecraft/server/network/PlayerConnection.java b/src/main/java/net/minecraft/server/network/PlayerConnection.java
|
|
index a0d48ef2b27267da0864baa9059c7c3e5aef6f48..957d3b56aea116f947ca8fb74127f652de72b701 100644
|
|
--- a/src/main/java/net/minecraft/server/network/PlayerConnection.java
|
|
+++ b/src/main/java/net/minecraft/server/network/PlayerConnection.java
|
|
@@ -1909,6 +1909,7 @@ public class PlayerConnection implements PacketListenerPlayIn {
|
|
PlayerConnectionUtils.ensureMainThread(packetplayinhelditemslot, this, this.player.getWorldServer());
|
|
if (this.player.isFrozen()) return; // CraftBukkit
|
|
if (packetplayinhelditemslot.b() >= 0 && packetplayinhelditemslot.b() < PlayerInventory.getHotbarSize()) {
|
|
+ if (packetplayinhelditemslot.getItemInHandIndex() == this.player.inventory.itemInHandIndex) { return; } // Paper - don't fire itemheldevent when there wasn't a slot change
|
|
PlayerItemHeldEvent event = new PlayerItemHeldEvent(this.getPlayer(), this.player.inventory.itemInHandIndex, packetplayinhelditemslot.b());
|
|
this.server.getPluginManager().callEvent(event);
|
|
if (event.isCancelled()) {
|