Package dev.selena.luacore.utils.items
Class ItemBuilder
java.lang.Object
dev.selena.luacore.utils.items.ItemBuilder
Used for easily creating custom items
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionUsed for creating the item builder with no initial material typeItemBuilder(Map<String, Object> data) Used for creating an instance of ItemBuilder from a serializable mapItemBuilder(org.bukkit.Material type) Start the creation of the ItemBuilder and setting the type -
Method Summary
Modifier and TypeMethodDescriptionaddAttributeModifier(String attributeKey, org.bukkit.attribute.AttributeModifier modifier) Used for adding an attribute modifier to the itemaddAttributeModifier(org.bukkit.attribute.Attribute attribute, org.bukkit.attribute.AttributeModifier modifier) Used for adding an attribute modifier to the itemaddCustomNBT(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 itemaddNBTFloat(String key, float 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.ItemStackbuild()Used for creating the previously created ItemStackstatic ItemBuilderfromItemStack(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 armorsetAttributeModifiers(Map<String, org.bukkit.attribute.AttributeModifier> attributeModifiers) Used for setting the attribute modifiers map of the itemsetBooleanNBT(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 enchantmentssetFloatNBT(Map<String, Float> floatNBT) Used for setting the values of the NBT float mapsetGlowing(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 ListsetMaxStackSize(int maxStackSize) Used for setting the max stack size of an item
NOTE: THIS MIGHT MAKE THE LIBRARY NOT WORK ON VERSIONS THAT DO NOT HAVE setMaxSize(int)setPlaceholderPlayer(org.bukkit.entity.Player player) Used for placeholderAPI stuffsetSkullProfile(String url, UUID uuid, String name) Used for setting the skull profile using a URL, UUID and namesetSkullProfile(@NotNull URL skullTextureUrl, @NotNull UUID skullTextureUUID, @Nullable String skullTextureName) Used for setting the skullsPlayerProfiletexture.setSkullProfile(org.bukkit.profile.PlayerProfile skullProfile) Used for setting the skullsPlayerProfilesetSkullTexture(String textureUrl) 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:
-
ItemBuilder
Used for creating an instance of ItemBuilder from a serializable map- Parameters:
data- The map you want to convert to ItemBuilder
-
-
Method Details
-
setPlaceholderPlayer
Used for placeholderAPI stuff- Parameters:
player- The player for the placeholders- Returns:
- This instance to continue the building
-
setMaxStackSize
Used for setting the max stack size of an item
NOTE: THIS MIGHT MAKE THE LIBRARY NOT WORK ON VERSIONS THAT DO NOT HAVE setMaxSize(int)- Parameters:
maxStackSize- The max stack size- Returns:
- This instance to continue building
-
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
-
addNBTFloat
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
-
setFloatNBT
Used for setting the values of the NBT float map- Parameters:
floatNBT- The map of floats 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
-
setSkullTexture
- Throws:
MalformedURLException
-
setSkullProfile
public ItemBuilder setSkullProfile(@NotNull @NotNull URL skullTextureUrl, @NotNull @NotNull UUID skullTextureUUID, @Nullable @Nullable String skullTextureName) Used for setting the skullsPlayerProfiletexture.- 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 name of the skull profile (can be null, but should be unique)- Returns:
- This instance to continue
-
setSkullProfile
Used for setting the skull profile using a URL, UUID and name- Parameters:
url- The URL of the skull texture (NOTE: MUST be a https://textures.minecraft.net texture)uuid- The UUID of the skull, used for internal minecraft stuffname- The name of the skull profile (can be null, but should be unique)- Returns:
- This instance to continue
-
setSkullProfile
Used for setting the skullsPlayerProfile- Parameters:
skullProfile- ThePlayerProfileyou want to set for the skull- Returns:
- This instance to continue
-
setAttributeModifiers
public ItemBuilder setAttributeModifiers(Map<String, org.bukkit.attribute.AttributeModifier> attributeModifiers) Used for setting the attribute modifiers map of the item- Parameters:
attributeModifiers- Map ofAttributemodifiers where the key is the attribute key (e.g. "max_health") and the value is theAttributeModifier- Returns:
- This instance to continue the building
-
addAttributeModifier
public ItemBuilder addAttributeModifier(org.bukkit.attribute.Attribute attribute, org.bukkit.attribute.AttributeModifier modifier) Used for adding an attribute modifier to the item- Parameters:
attribute- TheAttributeyou want to add the modifier tomodifier- TheAttributeModifieryou want to add- Returns:
- This instance to continue the building
-
addAttributeModifier
public ItemBuilder addAttributeModifier(String attributeKey, org.bukkit.attribute.AttributeModifier modifier) Used for adding an attribute modifier to the item- Parameters:
attributeKey- The key of the attribute you want to add the modifier to (e.g. "max_health")modifier- TheAttributeModifieryou want to add- Returns:
- This instance to continue the building
-
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
-