Fix command only kits not working.
Fixes
@@ -56,6 +56,9 @@ import javax.inject.Inject;
public class KitHandler implements NucleusKitService {
+ private static final InventoryTransactionResult EMPTY_ITR =
+ InventoryTransactionResult.builder().type(InventoryTransactionResult.Type.SUCCESS).build();
+
private static final Pattern inventory = Pattern.compile("\\{\\{.+?}}");
public static String getPermissionForKit(String kitName) {
@@ -147,7 +150,9 @@ public class KitHandler implements NucleusKitService {
List<Optional<ItemStackSnapshot>> slotList = Lists.newArrayList();
Util.getStandardInventory(player).slots().forEach(x -> slotList.add(x.peek().map(ItemStack::createSnapshot)));
- InventoryTransactionResult inventoryTransactionResult = addToStandardInventory(player, kit.getStacks(), isProcessTokens);
+ InventoryTransactionResult inventoryTransactionResult = EMPTY_ITR;
+ if (!kit.getStacks().isEmpty()) {
+ inventoryTransactionResult = addToStandardInventory(player, kit.getStacks(), isProcessTokens);
if (!isFirstJoin && inventoryTransactionResult.getType() != InventoryTransactionResult.Type.SUCCESS) {
if (isMustGetAll) {
Inventory inventory = Util.getStandardInventory(player);
@@ -166,6 +171,7 @@ public class KitHandler implements NucleusKitService {
throw new KitRedeemException("No free slots in player inventory", KitRedeemException.Reason.NO_SPACE);
}
}
+ }
// If something was consumed, consider a success.
if (inventoryTransactionResult.getType() == InventoryTransactionResult.Type.SUCCESS) {
