From a93f08a97b61f65b2665b92550c2c9fd66abe386 Mon Sep 17 00:00:00 2001 From: galacticwarrior9 <9055352+galacticwarrior9@users.noreply.github.com> Date: Sun, 17 Nov 2024 00:11:14 +0000 Subject: [PATCH] Fix McMMOItemSpawnEvent#setItemStack being ignored in ItemUtils (#5102) --- src/main/java/com/gmail/nossr50/util/ItemUtils.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/util/ItemUtils.java b/src/main/java/com/gmail/nossr50/util/ItemUtils.java index d3aee583c..433651cb2 100644 --- a/src/main/java/com/gmail/nossr50/util/ItemUtils.java +++ b/src/main/java/com/gmail/nossr50/util/ItemUtils.java @@ -764,7 +764,7 @@ public final class ItemUtils { return null; } - return location.getWorld().dropItem(location, itemStack); + return location.getWorld().dropItem(location, event.getItemStack()); } /** @@ -791,7 +791,7 @@ public final class ItemUtils { return null; } - return location.getWorld().dropItemNaturally(location, itemStack); + return location.getWorld().dropItemNaturally(location, event.getItemStack()); } /** @@ -845,6 +845,7 @@ public final class ItemUtils { // We can't get the item until we spawn it and we want to make it cancellable, so we have a custom event. McMMOItemSpawnEvent event = new McMMOItemSpawnEvent(spawnLocation, clonedItem, itemSpawnReason, player); mcMMO.p.getServer().getPluginManager().callEvent(event); + clonedItem = event.getItemStack(); //Something cancelled the event so back out if (event.isCancelled()) {