9
0
mirror of https://github.com/Xiao-MoMi/Custom-Fishing.git synced 2025-12-19 15:09:24 +00:00

Update BukkitActionManager.java

This commit is contained in:
XiaoMoMi
2025-04-15 17:22:26 +08:00
parent 2dea598ba5
commit 9d4072003b

View File

@@ -527,7 +527,7 @@ public class BukkitActionManager implements ActionManager<Player> {
registerAction((args, chance) -> {
if (args instanceof Section section) {
String id = section.getString("item");
int amount = section.getInt("amount", 1);
MathValue<Player> 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<Player> {
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;