Class CyberItemUtils
java.lang.Object
com.github.cyberryan1.cybercore.spigot.utils.CyberItemUtils
Item utilities
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic org.bukkit.inventory.ItemStack
addAttributes
(org.bukkit.inventory.ItemStack item, String attributeName, double amount, org.bukkit.attribute.Attribute attribute, boolean hideFlags) Adds an attribute to an itemstatic org.bukkit.inventory.ItemStack
addItemFlags
(org.bukkit.inventory.ItemStack item, org.bukkit.inventory.ItemFlag... flags) Adds a list of item flags to an itemstatic org.bukkit.inventory.ItemStack
addItemLore
(org.bukkit.inventory.ItemStack item, String... lore) Adds the provided lines to the lore of an itemstatic org.bukkit.inventory.ItemStack
createItem
(org.bukkit.Material material, String name) Creates an item from the given material and namestatic org.bukkit.inventory.ItemStack
getPlayerSkull
(org.bukkit.OfflinePlayer player) Returns the skull of the given playerstatic org.bukkit.inventory.ItemStack
removeAttributes
(org.bukkit.inventory.ItemStack item, String attributeName, double amount, org.bukkit.attribute.Attribute attribute, boolean hideFlags) Removes an attribute from an itemstatic org.bukkit.inventory.ItemStack
removeItemFlags
(org.bukkit.inventory.ItemStack item, org.bukkit.inventory.ItemFlag... flags) Removes a list of item flags from an itemstatic org.bukkit.inventory.ItemStack
setItemLore
(org.bukkit.inventory.ItemStack item, String... lore) Sets the lore of an itemstatic org.bukkit.inventory.ItemStack
setItemLore
(org.bukkit.inventory.ItemStack item, List<String> lore) Sets the lore of an itemstatic org.bukkit.inventory.ItemStack
setItemName
(org.bukkit.inventory.ItemStack item, String name) Sets the name of an item
-
Constructor Details
-
CyberItemUtils
public CyberItemUtils()
-
-
Method Details
-
setItemLore
public static org.bukkit.inventory.ItemStack setItemLore(org.bukkit.inventory.ItemStack item, List<String> lore) Sets the lore of an item- Parameters:
item
- The item to set the lore oflore
- The lore to set the item to- Returns:
- The item with the lore set
-
setItemLore
public static org.bukkit.inventory.ItemStack setItemLore(org.bukkit.inventory.ItemStack item, String... lore) Sets the lore of an item- Parameters:
item
- The item to set the lore oflore
- The lore to set the item to- Returns:
- The item with the lore set
-
addItemLore
public static org.bukkit.inventory.ItemStack addItemLore(org.bukkit.inventory.ItemStack item, String... lore) Adds the provided lines to the lore of an item- Parameters:
item
- The item to add the lore tolore
- The lore to add to the item- Returns:
- The item with the lore added
-
setItemName
public static org.bukkit.inventory.ItemStack setItemName(org.bukkit.inventory.ItemStack item, String name) Sets the name of an item- Parameters:
item
- The item to set the name ofname
- The name to set the item to- Returns:
- The item with the name set
-
createItem
Creates an item from the given material and name- Parameters:
material
- The material of the itemname
- The name of the item- Returns:
- The created item
-
addAttributes
public static org.bukkit.inventory.ItemStack addAttributes(org.bukkit.inventory.ItemStack item, String attributeName, double amount, org.bukkit.attribute.Attribute attribute, boolean hideFlags) Adds an attribute to an item- Parameters:
item
- The item to add the attribute toattributeName
- The name of the attribute to addamount
- The amount of the attribute to addattribute
- TheAttribute
to addhideFlags
- Whether to add theItemFlag.HIDE_ATTRIBUTES
flag to the item- Returns:
- The item with the attribute added
-
removeAttributes
public static org.bukkit.inventory.ItemStack removeAttributes(org.bukkit.inventory.ItemStack item, String attributeName, double amount, org.bukkit.attribute.Attribute attribute, boolean hideFlags) Removes an attribute from an item- Parameters:
item
- The item to remove the attribute fromattributeName
- The name of the attribute to addamount
- The amount of the attribute to addattribute
- TheAttribute
to removehideFlags
- Whether to add theItemFlag.HIDE_ATTRIBUTES
flag to the item- Returns:
- The item with the attribute removed
-
addItemFlags
public static org.bukkit.inventory.ItemStack addItemFlags(org.bukkit.inventory.ItemStack item, org.bukkit.inventory.ItemFlag... flags) Adds a list of item flags to an item- Parameters:
item
- The item to add the flags toflags
- A list ofItemFlag
to add to the item- Returns:
- The item with the flags added
-
removeItemFlags
public static org.bukkit.inventory.ItemStack removeItemFlags(org.bukkit.inventory.ItemStack item, org.bukkit.inventory.ItemFlag... flags) Removes a list of item flags from an item- Parameters:
item
- The item to remove the flags fromflags
- A list ofItemFlag
to remove from the item- Returns:
- The item with the flags removed
-
getPlayerSkull
public static org.bukkit.inventory.ItemStack getPlayerSkull(org.bukkit.OfflinePlayer player) Returns the skull of the given player- Parameters:
player
- The player to get the skull of- Returns:
- The skull of the player
-