geforkt von Mirrors/Paper
70ce6ce831
This makes it easier for downstream projects (forks) to replace the version fetching system with their own. It is as simple as implementing an interface and overriding the default implementation of org.bukkit.UnsafeValues#getVersionFetcher() It also makes it easier for us to organize things like the version history feature. Lastly I have updated the paper implementation to check against the site API rather than against jenkins.
49 Zeilen
2.0 KiB
Diff
49 Zeilen
2.0 KiB
Diff
From f15c9148fdb45e7f951a8621ba7ae96bd2579a6b Mon Sep 17 00:00:00 2001
|
|
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
|
|
index 5a38d8f1..01fe217d 100644
|
|
--- a/src/main/java/org/bukkit/inventory/Inventory.java
|
|
+++ b/src/main/java/org/bukkit/inventory/Inventory.java
|
|
@@ -125,6 +125,34 @@ public interface Inventory extends Iterable<ItemStack> {
|
|
@NotNull
|
|
public HashMap<Integer, ItemStack> removeItem(@NotNull ItemStack... items) throws IllegalArgumentException;
|
|
|
|
+ // 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
|
|
+ */
|
|
+ @NotNull
|
|
+ public HashMap<Integer, ItemStack> removeItemAnySlot(@NotNull ItemStack... items) throws IllegalArgumentException;
|
|
+ // Paper end
|
|
+
|
|
/**
|
|
* Returns all ItemStacks from the inventory
|
|
*
|
|
--
|
|
2.21.0
|
|
|