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.ItemStack
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 replacesstatic 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 replacesstatic 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 replacesstatic @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
-
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
- TheYamlConfiguration
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
- TheItemStack
to replace the lore and name ofreplaces
- TheHashMap
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
- TheItemMeta
to replace the lore ofreplaces
- TheHashMap
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
- TheItemStack
to replace the lore ofreplaces
- TheHashMap
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
- TheItemMeta
to replace the name ofreplaces
- TheHashMap
of replaces to do- Returns:
- The
ItemMeta
with 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)
-