aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0623-Fix-merchant-inventory-not-closing-on-entity-removal.patch
diff options
context:
space:
mode:
authorJake Potrebic <[email protected]>2024-05-29 13:58:57 -0700
committerGitHub <[email protected]>2024-05-29 22:58:57 +0200
commita31dc90741ed9c121a13a3c124c9ebf5bafd0da7 (patch)
tree81963bd94fe7772ee08bd21710230de21b6b25da /patches/server/0623-Fix-merchant-inventory-not-closing-on-entity-removal.patch
parented85aac53cfd93d29fa24e6071dbdddd0e49624b (diff)
downloadPaper-a31dc90741ed9c121a13a3c124c9ebf5bafd0da7.tar.gz
Paper-a31dc90741ed9c121a13a3c124c9ebf5bafd0da7.zip
Several fixes and new api for experience merging/stacking (#9242)
Diffstat (limited to 'patches/server/0623-Fix-merchant-inventory-not-closing-on-entity-removal.patch')
-rw-r--r--patches/server/0623-Fix-merchant-inventory-not-closing-on-entity-removal.patch22
1 files changed, 22 insertions, 0 deletions
diff --git a/patches/server/0623-Fix-merchant-inventory-not-closing-on-entity-removal.patch b/patches/server/0623-Fix-merchant-inventory-not-closing-on-entity-removal.patch
new file mode 100644
index 0000000000..11f85426c8
--- /dev/null
+++ b/patches/server/0623-Fix-merchant-inventory-not-closing-on-entity-removal.patch
@@ -0,0 +1,22 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Jake Potrebic <[email protected]>
+Date: Thu, 2 Sep 2021 00:24:06 -0700
+Subject: [PATCH] Fix merchant inventory not closing on entity removal
+
+
+diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
+index e611857d9d29e8532b4ea3e0634c8f24a396a190..134df9ad4d5d5f85429f5e3ff6d879bc5f1fb13f 100644
+--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
++++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
+@@ -2277,6 +2277,11 @@ public class ServerLevel extends Level implements WorldGenLevel {
+ // Spigot end
+ // Spigot Start
+ if (entity.getBukkitEntity() instanceof org.bukkit.inventory.InventoryHolder && (!(entity instanceof ServerPlayer) || entity.getRemovalReason() != Entity.RemovalReason.KILLED)) { // SPIGOT-6876: closeInventory clears death message
++ // Paper start - Fix merchant inventory not closing on entity removal
++ if (entity.getBukkitEntity() instanceof org.bukkit.inventory.Merchant merchant && merchant.getTrader() != null) {
++ merchant.getTrader().closeInventory(org.bukkit.event.inventory.InventoryCloseEvent.Reason.UNLOADED);
++ }
++ // Paper end - Fix merchant inventory not closing on entity removal
+ for (org.bukkit.entity.HumanEntity h : Lists.newArrayList(((org.bukkit.inventory.InventoryHolder) entity.getBukkitEntity()).getInventory().getViewers())) {
+ h.closeInventory(org.bukkit.event.inventory.InventoryCloseEvent.Reason.UNLOADED); // Paper - Inventory close reason
+ }