Class ItemStackUtils

java.lang.Object
me.yleoft.zAPI.utils.ItemStackUtils

public abstract class ItemStackUtils extends Object
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final HashMap<String,Integer>
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static @NotNull org.bukkit.inventory.ItemStack
    getItem(@NotNull String materialString, int amount)
     
    static @NotNull org.bukkit.inventory.ItemStack
    getItemFromConfig(@Nullable org.bukkit.entity.Player player, @NotNull org.bukkit.configuration.file.YamlConfiguration config, @Nullable String path)
     
    static @NotNull org.bukkit.inventory.ItemStack
    getItemFromConfig(@Nullable org.bukkit.entity.Player player, @NotNull org.bukkit.configuration.file.YamlConfiguration config, @Nullable String path, @Nullable HashMap<String,String> replacers)
    Creates an ItemStack from a YamlConfiguration file.
    static @NotNull org.bukkit.inventory.ItemStack
    getLegacyItem(@NotNull String modernName, int amount)
     
    static @NotNull org.bukkit.inventory.ItemStack
    getLegacyItem(@NotNull String color, @NotNull String material)
    Creates a legacy item from the given color and material.
    static void
    replaceAll(@NotNull org.bukkit.inventory.ItemStack item, @NotNull HashMap<String,String> replaces)
    Replaces all the lore and name of the item with the given replaces
    static org.bukkit.inventory.ItemStack
    replaceLore(@NotNull org.bukkit.inventory.ItemStack item, @NotNull HashMap<String,String> replaces)
    Replaces the lore of the item with the given replaces
    static org.bukkit.inventory.meta.ItemMeta
    replaceLore(@NotNull org.bukkit.inventory.meta.ItemMeta meta, @NotNull HashMap<String,String> replaces)
    Replaces the lore of the item with the given replaces
    static @NotNull org.bukkit.inventory.ItemStack
    replaceName(@NotNull org.bukkit.inventory.ItemStack item, @NotNull HashMap<String,String> replaces)
     
    static @NotNull org.bukkit.inventory.meta.ItemMeta
    replaceName(@NotNull org.bukkit.inventory.meta.ItemMeta meta, @NotNull HashMap<String,String> replaces)
    Replaces the name of the item with the given replaces

    Methods inherited from class java.lang.Object

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

  • Constructor Details

    • ItemStackUtils

      public ItemStackUtils()
  • Method Details

    • getItemFromConfig

      @NotNull public static @NotNull org.bukkit.inventory.ItemStack getItemFromConfig(@Nullable @Nullable org.bukkit.entity.Player player, @NotNull @NotNull org.bukkit.configuration.file.YamlConfiguration config, @Nullable @Nullable String path, @Nullable @Nullable HashMap<String,String> replacers)
      Creates an ItemStack from a YamlConfiguration file.
      Parameters:
      player - The player to use for string transformation.
      config - The YamlConfiguration to load the item from.
      path - The path to the item in the config file.
      Returns:
      The created ItemStack.
    • getItemFromConfig

      @NotNull public static @NotNull org.bukkit.inventory.ItemStack getItemFromConfig(@Nullable @Nullable org.bukkit.entity.Player player, @NotNull @NotNull org.bukkit.configuration.file.YamlConfiguration config, @Nullable @Nullable String path)
    • getItem

      @NotNull public static @NotNull org.bukkit.inventory.ItemStack getItem(@NotNull @NotNull String materialString, int amount)
    • replaceAll

      public static void replaceAll(@NotNull @NotNull org.bukkit.inventory.ItemStack item, @NotNull @NotNull HashMap<String,String> replaces)
      Replaces all the lore and name of the item with the given replaces
      Parameters:
      item - The ItemStack to replace the lore and name of
      replaces - The HashMap of replaces to do
    • replaceLore

      public static org.bukkit.inventory.meta.ItemMeta replaceLore(@NotNull @NotNull org.bukkit.inventory.meta.ItemMeta meta, @NotNull @NotNull HashMap<String,String> replaces)
      Replaces the lore of the item with the given replaces
      Parameters:
      meta - The ItemMeta to replace the lore of
      replaces - The HashMap of replaces to do
      Returns:
      The ItemMeta with the replaced lore
    • replaceLore

      public static org.bukkit.inventory.ItemStack replaceLore(@NotNull @NotNull org.bukkit.inventory.ItemStack item, @NotNull @NotNull HashMap<String,String> replaces)
      Replaces the lore of the item with the given replaces
      Parameters:
      item - The ItemStack to replace the lore of
      replaces - The HashMap of replaces to do
      Returns:
      The ItemMeta with the replaced lore
    • replaceName

      @NotNull public static @NotNull org.bukkit.inventory.meta.ItemMeta replaceName(@NotNull @NotNull org.bukkit.inventory.meta.ItemMeta meta, @NotNull @NotNull HashMap<String,String> replaces)
      Replaces the name of the item with the given replaces
      Parameters:
      meta - The ItemMeta to replace the name of
      replaces - The HashMap of replaces to do
      Returns:
      The ItemMeta with the replaced name
    • replaceName

      @NotNull public static @NotNull org.bukkit.inventory.ItemStack replaceName(@NotNull @NotNull org.bukkit.inventory.ItemStack item, @NotNull @NotNull HashMap<String,String> replaces)
    • getLegacyItem

      @NotNull public static @NotNull org.bukkit.inventory.ItemStack getLegacyItem(@NotNull @NotNull String color, @NotNull @NotNull String material)
      Creates a legacy item from the given color and material.
      Parameters:
      color - The color of the item.
      material - The material of the item.
      Returns:
      The created ItemStack.
    • getLegacyItem

      @NotNull public static @NotNull org.bukkit.inventory.ItemStack getLegacyItem(@NotNull @NotNull String modernName, int amount)