Merge branch 'development' of gitlab.com:Songoda/ultimatekits into core

This commit is contained in:
jascotty2 2019-09-16 09:07:40 -05:00
commit 98525b9367
2 changed files with 10 additions and 1 deletions

View File

@ -4,7 +4,7 @@ stages:
variables:
name: "UltimateKits"
path: "/builds/$CI_PROJECT_PATH"
version: "2.3.23"
version: "2.3.24"
build:
stage: build

View File

@ -290,11 +290,18 @@ public class Kit {
if (amt != amtToGive || kitAnimation != KitAnimation.NONE)
Collections.shuffle(innerContents);
return generateRandomItem(innerContents, amtToGive, player);
}
private boolean generateRandomItem(List<KitItem> innerContents, int amtToGive, Player player) {
boolean chosenItem = false;
for (KitItem item : innerContents) {
if (amtToGive == 0) continue;
int ch = item.getChance() == 0 ? 100 : item.getChance();
double rand = Math.random() * 100;
if (rand - ch < 0 || ch == 100) {
chosenItem = true;
if (item.getContent() instanceof KitContentEconomy) {
try {
EconomyManager.deposit(player, ((KitContentEconomy) item.getContent()).getAmount());
@ -345,6 +352,8 @@ public class Kit {
}
}
if (!chosenItem) generateRandomItem(innerContents, amtToGive, player);
player.updateInventory();
return true;
}