Package dev.selena.luacore.utils.items
Class ItemBuilder
java.lang.Object
dev.selena.luacore.utils.items.ItemBuilder
Used for easily creating custom items
-
Constructor Summary
ConstructorDescriptionUsed for creating the item builder with no initial material typeItemBuilder
(org.bukkit.Material type) Start the creation of the ItemBuilder and setting the type -
Method Summary
Modifier and TypeMethodDescriptionaddCustomNBT
(String nameSpace, Object content) Used for adding custom NBT data to the itemaddEnchant
(String enchant, int level) Used for adding an enchantmentaddEnchant
(org.bukkit.enchantments.Enchantment enchant, int level) Used for adding an enchantmentaddNBTBoolean
(String key, boolean value) Used for adding a boolean NBT value to the itemUsed for adding an NBT Int to the itemaddNBTString
(String key, String value) Used for adding an NBT string value to the itemorg.bukkit.inventory.ItemStack
build()
Used for creating the previously created ItemStackstatic ItemBuilder
fromItemStack
(org.bukkit.inventory.ItemStack item) Used for creating an instance of ItemBuilder from an ItemStacksetAmount
(int amount) Used for setting the amount of itemssetArmorTrim
(org.bukkit.inventory.meta.trim.ArmorTrim trim) Used to add armor trims to a piece of armorsetBooleanNBT
(Map<String, Boolean> booleanNBT) Used for setting the values of the NBT boolean mapsetColor
(org.bukkit.Color itemColor) Used for setting color of leather armorsetCustomNBT
(Map<String, Object> customNBT) Used for setting the values of the custom NBT mapsetEnchantsFromEnchantments
(Map<org.bukkit.enchantments.Enchantment, Integer> enchantments) Used for setting the enchantment map using spigot EnchantmentssetEnchantsFromKey
(Map<String, Integer> enchants) Used for setting enchantmentssetGlowing
(boolean glowing) Used for making an item glowUsed for setting the value of the NBT Int MapSets the lore using a string arrayUsed for setting the lore using ListsetSkullProfile
(@NotNull URL skullTextureUrl, @NotNull UUID skullTextureUUID, @Nullable String skullTextureName) Used for setting the skullsPlayerProfile
texture.setSkullProfile
(org.bukkit.profile.PlayerProfile skullProfile) Used for setting the skullsPlayerProfile
setSkullTexture
(URL textureUrl) Used for setting the skull texture (Won't work if the material isn'tMaterial.PLAYER_HEAD
)setStackable
(boolean stackable) Used for making items only be able to stack to 1setStringNBT
(Map<String, String> stringNBT) Used for setting the NBTString mapUsed for setting the display name of the itemsetType
(org.bukkit.Material type) Used for setting the material typesetUsable
(boolean usable) Allows you to stop users from using items that should not be used
-
Constructor Details
-
ItemBuilder
public ItemBuilder(org.bukkit.Material type) Start the creation of the ItemBuilder and setting the type- Parameters:
type
- Material you want to start with
-
ItemBuilder
public ItemBuilder()Used for creating the item builder with no initial material type- See Also:
-
-
Method Details
-
setType
Used for setting the material type- Parameters:
type
- Material you want to use- Returns:
- This instance to continue the building
-
setTitle
Used for setting the display name of the item- Parameters:
title
- The display name you want- Returns:
- This instance to continue the building
-
setLore
Sets the lore using a string array- Parameters:
lore
- The string array you want to set the lore- Returns:
- This instance to continue the building
- See Also:
-
setLore
Used for setting the lore using List- Parameters:
lore
- The List you want to set the lore to- Returns:
- This instance to continue the building
- See Also:
-
setEnchantsFromKey
Used for setting enchantments- Parameters:
enchants
- Map of the enchantment namespace key and level- Returns:
- This instance to continue the building
- See Also:
-
setEnchantsFromEnchantments
public ItemBuilder setEnchantsFromEnchantments(Map<org.bukkit.enchantments.Enchantment, Integer> enchantments) Used for setting the enchantment map using spigot Enchantments- Parameters:
enchantments
- The map of enchantments you want to set- Returns:
- This instance to continue the building
-
addEnchant
Used for adding an enchantment- Parameters:
enchant
- Namespace key of the enchantmentlevel
- Level of the enchantment- Returns:
- This instance to continue the building
-
addEnchant
Used for adding an enchantment- Parameters:
enchant
- The enchantment you want to addlevel
- Level of the enchantment- Returns:
- This instance to continue the building
-
setStackable
Used for making items only be able to stack to 1- Parameters:
stackable
- if false the item will not stack- Returns:
- This instance to continue the building
-
setGlowing
Used for making an item glow- Parameters:
glowing
- true will give it an enchantment glint- Returns:
- This instance to continue the building
-
setStringNBT
Used for setting the NBTString map- Parameters:
stringNBT
- Map of NBT strings- Returns:
- This instance to continue the building
- See Also:
-
addNBTString
Used for adding an NBT string value to the item- Parameters:
key
- The key you will use to get the string latervalue
- The string you want stored- Returns:
- This instance to continue the building
-
setIntNBT
Used for setting the value of the NBT Int Map- Parameters:
intNBT
- The map of NBT data you want to add- Returns:
- This instance to continue the building
-
addNBTInt
Used for adding an NBT Int to the item- Parameters:
key
- The key you will use to get the int latervalue
- The value you want to store- Returns:
- This instance to continue the building
-
setBooleanNBT
Used for setting the values of the NBT boolean map- Parameters:
booleanNBT
- The map of booleans you want to store- Returns:
- This instance to continue the building
-
addNBTBoolean
Used for adding a boolean NBT value to the item- Parameters:
key
- The key you will use to get the boolean latervalue
- The value you want to store- Returns:
- This instance to continue the building
-
setCustomNBT
Used for setting the values of the custom NBT map- Parameters:
customNBT
- The map of custom NBT you want to store- Returns:
- This instance to continue the building
-
addCustomNBT
Used for adding custom NBT data to the item- Parameters:
nameSpace
- The key you will use to get the custom content latercontent
- The content you want to store later- Returns:
- This instance to continue the building
-
setAmount
Used for setting the amount of items- Parameters:
amount
- The amount you want the ItemStack to be in- Returns:
- This instance to continue the building
-
setUsable
Allows you to stop users from using items that should not be used- Parameters:
usable
- set value as false to prevent players from using item- Returns:
- This instance to continue the building
-
setColor
Used for setting color of leather armor- Parameters:
itemColor
- The color you want to set using bukkit Color- Returns:
- This instance to continue
-
setArmorTrim
Used to add armor trims to a piece of armor- Parameters:
trim
- The armor trim you want to add- Returns:
- This instance to continue
-
setSkullTexture
Used for setting the skull texture (Won't work if the material isn'tMaterial.PLAYER_HEAD
)- Parameters:
textureUrl
- The skull texture (NOTE: MUST be a https://textures.minecraft.net texture)- Returns:
- This instance to continue
-
setSkullProfile
public ItemBuilder setSkullProfile(@NotNull @NotNull URL skullTextureUrl, @NotNull @NotNull UUID skullTextureUUID, @Nullable @Nullable String skullTextureName) Used for setting the skullsPlayerProfile
texture.- Parameters:
skullTextureUrl
- The skull texture (NOTE: MUST be a https://textures.minecraft.net texture)skullTextureUUID
- The UUID of the skull, used for internal minecraft stuffskullTextureName
- The texture name (from memory must be unique, but I haven't used this in a while)- Returns:
- This instance to continue
-
setSkullProfile
Used for setting the skullsPlayerProfile
- Parameters:
skullProfile
- ThePlayerProfile
you want to set for the skull- Returns:
- This instance to continue
-
build
public org.bukkit.inventory.ItemStack build()Used for creating the previously created ItemStack- Returns:
- The built ItemStack
-
fromItemStack
Used for creating an instance of ItemBuilder from an ItemStack- Parameters:
item
- The ItemStack you want to convert to ItemBuilder- Returns:
- A fresh instance of ItemBuilder
-