Update UtilsScript.java

This commit is contained in:
snarLox 2021-08-22 11:39:32 +10:00 committed by GitHub
parent 43470feb1e
commit a89766c8e7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 27 additions and 1 deletions

View File

@ -109,7 +109,9 @@ public abstract class UtilsScript extends Plugin {
}
protected void obtain(List<ItemQuantity> items) {
if (items.isEmpty() || hasItems(items)) {
if (items.isEmpty() ||
Items(items)) {
return;
}
obtain(items.toArray(ItemQuantity[]::new));
@ -191,6 +193,30 @@ public abstract class UtilsScript extends Plugin {
return bankItem == null ? 0 : bankItem.quantity();
}
protected boolean equipmentHasItemsID(Integer items) {
return game.equipment().withId(items).findFirst().isPresent();
}
protected boolean equipmentHasItemsID(Collection<Integer> items) {
return game.equipment().withId(items).findFirst().isPresent();
}
protected boolean inventoryHasItemsName(String items) {
return game.inventory().withNamePart(items).findFirst().isPresent();
}
protected boolean inventoryHasItemsName(Collection<String> items) {
for (String item : items) {
return game.inventory().withNamePart(item).findFirst().isPresent();
}
return false;
}
protected boolean inventoryHasItems(Integer items) {
return game.inventory().withId(items).findFirst().isPresent();
}
protected boolean inventoryHasItems(Collection<Integer> items) {
return game.inventory().withId(items).findFirst().isPresent();
}
protected boolean inventoryHasItems(ItemQuantity... items) {
return inventoryHasItems(false, items);
}