Check to see if there are no items left to give before continuing.

This commit is contained in:
Brianna 2020-10-26 15:40:34 -05:00
parent 85011e0453
commit 6e94ac24db
1 changed files with 3 additions and 3 deletions

View File

@ -324,13 +324,13 @@ public class Kit {
itemGiveAmount--;
if (rand < ch || ch == 100) {
ItemStack parseStack = item.getContent().process(player);
if (kitAnimation != KitAnimation.NONE) {
// TODO: this is a very bad way to solve this problem.
// Giving the player kit rewards really should be done outside of the Kit class.
plugin.getGuiManager().showGUI(player, new AnimatedKitGui(plugin, player, this, parseStack));
plugin.getGuiManager().showGUI(player, new AnimatedKitGui(plugin, player, this, item.getItemForDisplay()));
return true;
} else {
ItemStack parseStack = item.getContent().process(player);
if (item.getContent() instanceof KitContentEconomy
|| item.getContent() instanceof KitContentCommand)
continue;
@ -347,7 +347,7 @@ public class Kit {
}
}
if (itemGiveAmount != 0) {
if (itemGiveAmount > 0 && !innerContents.isEmpty()) {
return generateRandomItem(innerContents, itemGiveAmount, player);
}