2020-05-06 11:48:49 +02:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
2018-08-30 03:41:39 +02:00
|
|
|
From: Zach Brown <zach.brown@destroystokyo.com>
|
|
|
|
Date: Tue, 28 Aug 2018 23:04:06 -0400
|
|
|
|
Subject: [PATCH] Inventory#removeItemAnySlot
|
|
|
|
|
|
|
|
|
|
|
|
diff --git a/src/main/java/org/bukkit/inventory/Inventory.java b/src/main/java/org/bukkit/inventory/Inventory.java
|
2020-05-06 11:48:49 +02:00
|
|
|
index 5a38d8f13b5ee38f9d1ec01ce10b2666f5883e37..01fe217dfa93c20bdec53eb981bd6e885a9f7a25 100644
|
2018-08-30 03:41:39 +02:00
|
|
|
--- a/src/main/java/org/bukkit/inventory/Inventory.java
|
|
|
|
+++ b/src/main/java/org/bukkit/inventory/Inventory.java
|
2019-04-23 06:47:07 +02:00
|
|
|
@@ -125,6 +125,34 @@ public interface Inventory extends Iterable<ItemStack> {
|
2019-03-20 01:28:15 +01:00
|
|
|
@NotNull
|
|
|
|
public HashMap<Integer, ItemStack> removeItem(@NotNull ItemStack... items) throws IllegalArgumentException;
|
2018-08-30 03:41:39 +02:00
|
|
|
|
|
|
|
+ // Paper start
|
|
|
|
+ /**
|
|
|
|
+ * Searches all possible inventory slots in order to remove the given ItemStacks.
|
|
|
|
+ * <p>
|
|
|
|
+ * Similar to {@link Inventory#removeItem(ItemStack...)} in behavior, except this
|
|
|
|
+ * method will check all possible slots in the inventory, rather than just the main
|
|
|
|
+ * storage contents.
|
|
|
|
+ * <p>
|
|
|
|
+ * It will try to remove 'as much as possible' from the types and amounts
|
|
|
|
+ * you give as arguments.
|
|
|
|
+ * <p>
|
|
|
|
+ * The returned HashMap contains what it couldn't remove, where the key is
|
|
|
|
+ * the index of the parameter, and the value is the ItemStack at that
|
|
|
|
+ * index of the varargs parameter. If all the given ItemStacks are
|
|
|
|
+ * removed, it will return an empty HashMap.
|
|
|
|
+ * <p>
|
|
|
|
+ * It is known that in some implementations this method will also set the
|
|
|
|
+ * inputted argument amount to the number of that item not removed from
|
|
|
|
+ * slots.
|
|
|
|
+ *
|
|
|
|
+ * @param items The ItemStacks to remove
|
|
|
|
+ * @return A HashMap containing items that couldn't be removed.
|
|
|
|
+ * @throws IllegalArgumentException if items is null
|
|
|
|
+ */
|
2019-03-20 01:28:15 +01:00
|
|
|
+ @NotNull
|
|
|
|
+ public HashMap<Integer, ItemStack> removeItemAnySlot(@NotNull ItemStack... items) throws IllegalArgumentException;
|
2018-08-30 03:41:39 +02:00
|
|
|
+ // Paper end
|
|
|
|
+
|
|
|
|
/**
|
|
|
|
* Returns all ItemStacks from the inventory
|
|
|
|
*
|