Package dev.piglin.piglinworldapi.util
Class InventoryUtils
java.lang.Object
dev.piglin.piglinworldapi.util.InventoryUtils
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanaddEverythingOrNothing(@NotNull org.bukkit.inventory.Inventory inventory, @Nullable org.bukkit.inventory.ItemStack item)Adds the item to the inventory, but don't add it if it can't be added fully (e.g.static booleancheckSpaceForItem(@NotNull org.bukkit.inventory.Inventory inventory, @Nullable org.bukkit.inventory.ItemStack item)Checks if you can safely add the item to the specified inventorygetSimilarSlots(org.bukkit.inventory.Inventory inventory, org.bukkit.inventory.ItemStack item)Get slots in the inventory with items similar to the specified item
-
Constructor Details
-
InventoryUtils
public InventoryUtils()
-
-
Method Details
-
checkSpaceForItem
public static boolean checkSpaceForItem(@NotNull @NotNull org.bukkit.inventory.Inventory inventory, @Nullable @Nullable org.bukkit.inventory.ItemStack item)Checks if you can safely add the item to the specified inventory- Parameters:
inventory- The inventoryitem- The item- Returns:
- true if there is enough free space in the inventory, false otherwise
-
addEverythingOrNothing
public static boolean addEverythingOrNothing(@NotNull @NotNull org.bukkit.inventory.Inventory inventory, @Nullable @Nullable org.bukkit.inventory.ItemStack item)Adds the item to the inventory, but don't add it if it can't be added fully (e.g. 24 items can be added, 64 can't)- Parameters:
inventory- The inventoryitem- The item- Returns:
- true if the item was added to the inventory, false otherwise
-
getSimilarSlots
public static List<Integer> getSimilarSlots(org.bukkit.inventory.Inventory inventory, org.bukkit.inventory.ItemStack item)Get slots in the inventory with items similar to the specified item- Parameters:
inventory- The inventoryitem- The item- Returns:
- Slots with similar item
-