Fix McMMOItemSpawnEvent#setItemStack being ignored in ItemUtils

This commit is contained in:
galacticwarrior9 2024-10-21 12:54:52 +01:00
parent 8087d5f647
commit 8933722576

View File

@ -760,7 +760,7 @@ public final class ItemUtils {
return null; return null;
} }
return location.getWorld().dropItem(location, itemStack); return location.getWorld().dropItem(location, event.getItemStack());
} }
/** /**
@ -787,7 +787,7 @@ public final class ItemUtils {
return null; return null;
} }
return location.getWorld().dropItemNaturally(location, itemStack); return location.getWorld().dropItemNaturally(location, event.getItemStack());
} }
/** /**
@ -841,6 +841,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. // 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); McMMOItemSpawnEvent event = new McMMOItemSpawnEvent(spawnLocation, clonedItem, itemSpawnReason, player);
mcMMO.p.getServer().getPluginManager().callEvent(event); mcMMO.p.getServer().getPluginManager().callEvent(event);
clonedItem = event.getItemStack();
//Something cancelled the event so back out //Something cancelled the event so back out
if (event.isCancelled()) { if (event.isCancelled()) {