From 9d4072003b45319ef64fced8b95aaaa2a4636361 Mon Sep 17 00:00:00 2001 From: XiaoMoMi Date: Tue, 15 Apr 2025 17:22:26 +0800 Subject: [PATCH] Update BukkitActionManager.java --- .../customfishing/bukkit/action/BukkitActionManager.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/net/momirealms/customfishing/bukkit/action/BukkitActionManager.java b/core/src/main/java/net/momirealms/customfishing/bukkit/action/BukkitActionManager.java index a6d5e469..40a6cde0 100644 --- a/core/src/main/java/net/momirealms/customfishing/bukkit/action/BukkitActionManager.java +++ b/core/src/main/java/net/momirealms/customfishing/bukkit/action/BukkitActionManager.java @@ -527,7 +527,7 @@ public class BukkitActionManager implements ActionManager { registerAction((args, chance) -> { if (args instanceof Section section) { String id = section.getString("item"); - int amount = section.getInt("amount", 1); + MathValue amount = MathValue.auto(section.get("amount", 1)); boolean toInventory = section.getBoolean("to-inventory", false); return context -> { if (Math.random() > chance.evaluate(context)) return; @@ -535,7 +535,7 @@ public class BukkitActionManager implements ActionManager { ItemStack itemStack = plugin.getItemManager().buildAny(context, id); if (itemStack != null) { int maxStack = itemStack.getMaxStackSize(); - int amountToGive = amount; + int amountToGive = (int) amount.evaluate(context); while (amountToGive > 0) { int perStackSize = Math.min(maxStack, amountToGive); amountToGive -= perStackSize;