Package me.yleoft.zAPI.inventory
Class CustomInventory
java.lang.Object
me.yleoft.zAPI.inventory.CustomInventory
CustomInventory class to create a custom inventory with a specified name and number of rows.
The inventory can hold items and can be retrieved as an Inventory object.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCustomInventory(@NotNull String inventoryName, int rows) Creates a custom inventory with the specified name and number of rows.CustomInventory(@NotNull org.bukkit.configuration.file.YamlConfiguration config) CustomInventory(@Nullable org.bukkit.entity.Player player, @NotNull org.bukkit.configuration.file.YamlConfiguration config) Creates a custom inventory from a YamlConfiguration file. -
Method Summary
Modifier and TypeMethodDescriptionorg.bukkit.inventory.InventoryCreates and returns the final inventory@NotNull StringGets the name of the inventory.intgetRows()Gets the number of rows in the inventory.voidremoveItem(int slot) Removes an item from the inventory at the specified slot.voidsetInventoryName(@NotNull String inventoryName) voidsetInventoryName(@Nullable org.bukkit.OfflinePlayer player, @NotNull String inventoryName) Sets the name of the inventory.voidsetItem(int slot, @NotNull org.bukkit.inventory.ItemStack item) voidvoidsetItem(int slot, @NotNull org.bukkit.inventory.ItemStack item, @NotNull String command, @Nullable HashMap<String, String> replaces) voidsetItem(int slot, @NotNull org.bukkit.inventory.ItemStack item, @NotNull List<String> commands, @Nullable HashMap<String, String> replaces) Adds an item to the inventory at the specified slot.voidsetItem(int slot, @NotNull org.bukkit.inventory.ItemStack item, @Nullable HashMap<String, String> replaces) voidsetItem(@Nullable org.bukkit.configuration.file.YamlConfiguration config, @Nullable String materialPath, @NotNull String slot, @NotNull org.bukkit.inventory.ItemStack item, @Nullable HashMap<String, String> replaces) voidsetItem(@Nullable org.bukkit.entity.Player player, @NotNull org.bukkit.configuration.file.YamlConfiguration config, @NotNull String path, @Nullable String replace, @Nullable List<String> replacers) voidsetItem(@Nullable org.bukkit.entity.Player player, @NotNull org.bukkit.configuration.file.YamlConfiguration config, @NotNull String path, @Nullable String replace, @Nullable List<String> replacers, boolean addIfEmpty)
-
Field Details
-
mark
The mark used to identify items in the inventory. -
configPathInventory
-
configPathItems
-
-
Constructor Details
-
CustomInventory
Creates a custom inventory with the specified name and number of rows.- Parameters:
inventoryName- The name of the inventory.rows- The number of rows (1-6).- Throws:
IllegalArgumentException- if the number of rows is not between 1 and 6.
-
CustomInventory
public CustomInventory(@Nullable @Nullable org.bukkit.entity.Player player, @NotNull @NotNull org.bukkit.configuration.file.YamlConfiguration config) Creates a custom inventory from a YamlConfiguration file.- Parameters:
config- The YamlConfiguration file to load the inventory from.
-
CustomInventory
public CustomInventory(@NotNull @NotNull org.bukkit.configuration.file.YamlConfiguration config)
-
-
Method Details
-
setItem
public void setItem(int slot, @NotNull @NotNull org.bukkit.inventory.ItemStack item, @NotNull @NotNull List<String> commands, @Nullable @Nullable HashMap<String, String> replaces) Adds an item to the inventory at the specified slot.- Parameters:
slot- The slot to add the item to (0-53).item- The item to add.- Throws:
IllegalArgumentException- if the slot is out of bounds.
-
setItem
-
setItem
public void setItem(int slot, @NotNull @NotNull org.bukkit.inventory.ItemStack item, @NotNull @NotNull String command) -
setItem
-
setItem
public void setItem(int slot, @NotNull @NotNull org.bukkit.inventory.ItemStack item) -
setItem
-
setItem
-
setItem
-
removeItem
public void removeItem(int slot) Removes an item from the inventory at the specified slot.- Parameters:
slot- The slot to remove the item from (0-53).- Throws:
IllegalArgumentException- if the slot is out of bounds.
-
setInventoryName
public void setInventoryName(@Nullable @Nullable org.bukkit.OfflinePlayer player, @NotNull @NotNull String inventoryName) Sets the name of the inventory.- Parameters:
inventoryName- The name of the inventory.
-
setInventoryName
-
getInventoryName
Gets the name of the inventory.- Returns:
- The name of the inventory.
-
getRows
public int getRows()Gets the number of rows in the inventory.- Returns:
- The number of rows in the inventory.
-
getInventory
public org.bukkit.inventory.Inventory getInventory()Creates and returns the final inventory- Returns:
- The created inventory.
-