Skip to content

Commit 2f2813c

Browse files
committed
Add ability to set amount of items for itemsadder
1 parent 1c38357 commit 2f2813c

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

AdvancedCore/src/com/bencodez/advancedcore/api/item/ItemBuilder.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,17 @@ public ItemBuilder(ConfigurationSection data) {
159159
} else {
160160
is = new ItemStack(Material.STONE);
161161
}
162+
int amount = data.getInt("Amount");
163+
int minAmount = data.getInt("MinAmount");
164+
int maxAmount = data.getInt("MaxAmount");
165+
166+
int currentAmount = 0;
167+
if (amount > 0) {
168+
currentAmount = amount;
169+
} else {
170+
currentAmount = ThreadLocalRandom.current().nextInt(minAmount, maxAmount + 1);
171+
}
172+
is.setAmount(currentAmount);
162173
} else {
163174

164175
Material material = null;

0 commit comments

Comments
 (0)