iutils: fix for obtain() getting stuck
This commit is contained in:
parent
616ef2e336
commit
33c20069ca
|
@ -23,7 +23,7 @@
|
|||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
version = "4.4.6"
|
||||
version = "4.4.7"
|
||||
|
||||
project.extra["PluginName"] = "iUtils"
|
||||
project.extra["PluginDescription"] = "Illumine - Utils required for plugins to function with added automation"
|
||||
|
|
|
@ -116,19 +116,21 @@ public abstract class UtilsScript extends Plugin {
|
|||
}
|
||||
|
||||
protected void obtain(List<ItemQuantity> items, boolean keepInventoryItems) {
|
||||
if (items.isEmpty() || hasItems(items)) {
|
||||
List<ItemQuantity> test = new ArrayList<>(items);
|
||||
if (test.isEmpty() || hasItems(test)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (keepInventoryItems) {
|
||||
items.addAll(inventoryList());
|
||||
log.info("Keeping items: {}", items.toString());
|
||||
test.addAll(inventoryList());
|
||||
log.info("Keeping items: {}", test.toString());
|
||||
}
|
||||
|
||||
obtain(items.toArray(ItemQuantity[]::new));
|
||||
obtain(test.toArray(ItemQuantity[]::new));
|
||||
}
|
||||
|
||||
protected List<ItemQuantity> inventoryList() {
|
||||
|
||||
return game.inventory().all().stream()
|
||||
.map(i -> new ItemQuantity(i.id(), i.quantity()))
|
||||
.collect(Collectors.toList());
|
||||
|
|
File diff suppressed because one or more lines are too long
Binary file not shown.
Loading…
Reference in New Issue