Class InventoryAPI

java.lang.Object
dev.cwhead.GravesX.api.inventory.InventoryAPI

public final class InventoryAPI extends Object
Inventory helper API.
  • Constructor Summary

    Constructors
    Constructor
    Description
    InventoryAPI(Graves plugin, UtilAPI util)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    equipArmor(@NotNull org.bukkit.inventory.Inventory inventory, @NotNull org.bukkit.entity.Player player)
    Equips the player's armor from the given inventory.
    void
    equipItems(@NotNull org.bukkit.inventory.Inventory inventory, @NotNull org.bukkit.entity.Player player)
    Equips the player's inventory items from the given inventory.
    int
    getInventorySize(int size)
    Gets the appropriate inventory size based on the given size.
    inventoryToString(@NotNull org.bukkit.inventory.Inventory inventory)
    Converts the given inventory to a string representation.
    org.bukkit.inventory.Inventory
    stringToInventory(@NotNull org.bukkit.inventory.InventoryHolder inventoryHolder, @NotNull String string, @NotNull String title)
    Converts a string representation of an inventory to an Inventory object.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • InventoryAPI

      public InventoryAPI(Graves plugin, UtilAPI util)
  • Method Details

    • getInventorySize

      public int getInventorySize(int size)
      Gets the appropriate inventory size based on the given size.
      Parameters:
      size - The size to be used for determining the inventory size.
      Returns:
      The appropriate inventory size.
    • equipArmor

      public void equipArmor(@NotNull @NotNull org.bukkit.inventory.Inventory inventory, @NotNull @NotNull org.bukkit.entity.Player player)
      Equips the player's armor from the given inventory.
      Parameters:
      inventory - The inventory containing the armor items.
      player - The player to be equipped with armor.
    • equipItems

      public void equipItems(@NotNull @NotNull org.bukkit.inventory.Inventory inventory, @NotNull @NotNull org.bukkit.entity.Player player)
      Equips the player's inventory items from the given inventory.
      Parameters:
      inventory - The inventory containing the items.
      player - The player to be equipped with items.
    • inventoryToString

      public String inventoryToString(@NotNull @NotNull org.bukkit.inventory.Inventory inventory)
      Converts the given inventory to a string representation.
      Parameters:
      inventory - The inventory to be converted.
      Returns:
      The string representation of the inventory.
    • stringToInventory

      public org.bukkit.inventory.Inventory stringToInventory(@NotNull @NotNull org.bukkit.inventory.InventoryHolder inventoryHolder, @NotNull @NotNull String string, @NotNull @NotNull String title)
      Converts a string representation of an inventory to an Inventory object.
      Parameters:
      inventoryHolder - The inventory holder.
      string - The string representation of the inventory.
      title - The title of the inventory.
      Returns:
      The Inventory object.