Package me.yleoft.zAPI.utils
Class ItemStackUtils
java.lang.Object
me.yleoft.zAPI.utils.ItemStackUtils
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic @NotNull org.bukkit.inventory.ItemStackstatic @NotNull org.bukkit.inventory.ItemStackgetItemFromConfig(@Nullable org.bukkit.entity.Player player, @NotNull org.bukkit.configuration.file.YamlConfiguration config, @Nullable String path) static @NotNull org.bukkit.inventory.ItemStackgetItemFromConfig(@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.ItemStackgetLegacyItem(@NotNull String modernName, int amount) static @NotNull org.bukkit.inventory.ItemStackgetLegacyItem(@NotNull String color, @NotNull String material) Creates a legacy item from the given color and material.static voidreplaceAll(@NotNull org.bukkit.inventory.ItemStack item, @NotNull HashMap<String, String> replaces) Replaces all the lore and name of the item with the given replacesstatic org.bukkit.inventory.ItemStackreplaceLore(@NotNull org.bukkit.inventory.ItemStack item, @NotNull HashMap<String, String> replaces) static @NotNull org.bukkit.inventory.meta.ItemMetareplaceLore(@NotNull org.bukkit.inventory.meta.ItemMeta meta, @NotNull HashMap<String, String> replaces) Replaces the lore of the item with the given replacesstatic @NotNull org.bukkit.inventory.ItemStackreplaceName(@NotNull org.bukkit.inventory.ItemStack item, @NotNull HashMap<String, String> replaces) static @NotNull org.bukkit.inventory.meta.ItemMetareplaceName(@NotNull org.bukkit.inventory.meta.ItemMeta meta, @NotNull HashMap<String, String> replaces) Replaces the name of the item with the given replaces
-
Field Details
-
legacyColors
-
-
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- TheYamlConfigurationto 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- TheItemStackto replace the lore and name ofreplaces- TheHashMapof replaces to do
-
replaceLore
@NotNull public static @NotNull 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- TheItemMetato replace the lore ofreplaces- TheHashMapof replaces to do- Returns:
- The
ItemMetawith the replaced lore
-
replaceLore
-
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- TheItemMetato replace the name ofreplaces- TheHashMapof replaces to do- Returns:
- The
ItemMetawith the replaced name
-
replaceName
-
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)
-