aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0642-Fix-merchant-inventory-not-closing-on-entity-removal.patch
diff options
context:
space:
mode:
authormaxcom1 <[email protected]>2024-03-23 22:26:17 +0100
committerGitHub <[email protected]>2024-03-23 17:26:17 -0400
commitb6001403e9703cadaa6e8c8558e732b91c3c6d6e (patch)
treea8c57bbc334a8ad48d4ad2b43db335667b142bee /patches/server/0642-Fix-merchant-inventory-not-closing-on-entity-removal.patch
parent9ec7dfcbc41c6e625de0050b6997160a75df9f44 (diff)
downloadPaper-b6001403e9703cadaa6e8c8558e732b91c3c6d6e.tar.gz
Paper-b6001403e9703cadaa6e8c8558e732b91c3c6d6e.zip
Add methods to change entity physics (#10334)
Diffstat (limited to 'patches/server/0642-Fix-merchant-inventory-not-closing-on-entity-removal.patch')
-rw-r--r--patches/server/0642-Fix-merchant-inventory-not-closing-on-entity-removal.patch22
1 files changed, 22 insertions, 0 deletions
diff --git a/patches/server/0642-Fix-merchant-inventory-not-closing-on-entity-removal.patch b/patches/server/0642-Fix-merchant-inventory-not-closing-on-entity-removal.patch
new file mode 100644
index 0000000000..76d51d8295
--- /dev/null
+++ b/patches/server/0642-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 10eb5c342930d2efd7d919f286fe8fa64cebaea4..03a9f82ac2af6cb64081c2bb758cb02a7ffd5b89 100644
+--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
++++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
+@@ -2325,6 +2325,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
+ }