diff --git a/eco-api/src/main/java/com/willfp/eco/core/events/DropQueuePushEvent.java b/eco-api/src/main/java/com/willfp/eco/core/events/DropQueuePushEvent.java index 11148fa2..b113684f 100644 --- a/eco-api/src/main/java/com/willfp/eco/core/events/DropQueuePushEvent.java +++ b/eco-api/src/main/java/com/willfp/eco/core/events/DropQueuePushEvent.java @@ -27,7 +27,7 @@ public class DropQueuePushEvent extends PlayerEvent implements Cancellable { /** * The items. */ - private final Collection items; + private Collection items; /** * The xp. @@ -114,6 +114,15 @@ public class DropQueuePushEvent extends PlayerEvent implements Cancellable { return items; } + /** + * Set the items to be dropped. + * + * @param items The items. + */ + public void setItems(Collection items) { + this.items = items; + } + /** * Get the xp to be dropped. * diff --git a/eco-core/core-backend/src/main/kotlin/com/willfp/eco/internal/drops/EcoDropQueue.kt b/eco-core/core-backend/src/main/kotlin/com/willfp/eco/internal/drops/EcoDropQueue.kt index 5d68219a..d9e26d47 100644 --- a/eco-core/core-backend/src/main/kotlin/com/willfp/eco/internal/drops/EcoDropQueue.kt +++ b/eco-core/core-backend/src/main/kotlin/com/willfp/eco/internal/drops/EcoDropQueue.kt @@ -54,13 +54,16 @@ open class EcoDropQueue(val player: Player) : DropQueue() { hasTelekinesis = false } - val pushEvent = DropQueuePushEvent(player, items, location, xp, hasTelekinesis) + val pushEvent = DropQueuePushEvent(player, items.toMutableList(), location, xp, hasTelekinesis) Bukkit.getServer().pluginManager.callEvent(pushEvent) if (pushEvent.isCancelled) { return } + items.clear() + items.addAll(pushEvent.items) + val world = location.world!! location = location.add(0.5, 0.5, 0.5) items.removeIf { itemStack: ItemStack -> itemStack.type == Material.AIR }