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:
@@ -527,7 +527,7 @@ public class BukkitActionManager implements ActionManager<Player> {
|
|||||||
registerAction((args, chance) -> {
|
registerAction((args, chance) -> {
|
||||||
if (args instanceof Section section) {
|
if (args instanceof Section section) {
|
||||||
String id = section.getString("item");
|
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);
|
boolean toInventory = section.getBoolean("to-inventory", false);
|
||||||
return context -> {
|
return context -> {
|
||||||
if (Math.random() > chance.evaluate(context)) return;
|
if (Math.random() > chance.evaluate(context)) return;
|
||||||
@@ -535,7 +535,7 @@ public class BukkitActionManager implements ActionManager<Player> {
|
|||||||
ItemStack itemStack = plugin.getItemManager().buildAny(context, id);
|
ItemStack itemStack = plugin.getItemManager().buildAny(context, id);
|
||||||
if (itemStack != null) {
|
if (itemStack != null) {
|
||||||
int maxStack = itemStack.getMaxStackSize();
|
int maxStack = itemStack.getMaxStackSize();
|
||||||
int amountToGive = amount;
|
int amountToGive = (int) amount.evaluate(context);
|
||||||
while (amountToGive > 0) {
|
while (amountToGive > 0) {
|
||||||
int perStackSize = Math.min(maxStack, amountToGive);
|
int perStackSize = Math.min(maxStack, amountToGive);
|
||||||
amountToGive -= perStackSize;
|
amountToGive -= perStackSize;
|
||||||
|
|||||||
Reference in New Issue
Block a user