Merge pull request #108 from Soxs/master

added boolean inventoryHasItems(boolean any, ItemQuantity... items)
This commit is contained in:
illumineawake 2021-07-19 19:55:42 +10:00 committed by GitHub
commit 0ed87c0304
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 3 deletions

View File

@ -167,12 +167,16 @@ public abstract class UtilsScript extends Plugin {
}
protected boolean inventoryHasItems(ItemQuantity... items) {
return inventoryHasItems(false, items);
}
protected boolean inventoryHasItems(boolean any, ItemQuantity... items) {
for (var item : items) {
if (game.inventory().withId(item.id).quantity() < item.quantity) {
return false;
if (any == (game.inventory().withId(item.id).quantity() >= item.quantity)) {
return any;
}
}
return true;
return !any;
}
protected boolean hasItems(ItemQuantity... items) {