Interface XPrisonEnchantsAPI
public interface XPrisonEnchantsAPI
API interface for managing custom enchantments on items.
-
Method Summary
Modifier and TypeMethodDescriptiongetById
(int id) Retrieves an enchantment by its ID.Retrieves an enchantment by its raw name.int
getEnchantLevel
(org.bukkit.inventory.ItemStack item, XPrisonEnchantment enchantment) Gets the level of a specific enchantment on an item.getEnchants
(org.bukkit.inventory.ItemStack itemStack) Retrieves all custom enchantments applied to a specific item.boolean
hasEnchant
(org.bukkit.inventory.ItemStack item, XPrisonEnchantment enchantment) Checks if an item has a specific enchantment.boolean
hasEnchant
(org.bukkit.inventory.ItemStack item, XPrisonEnchantment enchantment, int level) Checks if an item has a specific enchantment at a given level.boolean
registerEnchant
(XPrisonEnchantment enchantment) Registers a new custom enchantment.org.bukkit.inventory.ItemStack
removeEnchant
(org.bukkit.entity.Player player, org.bukkit.inventory.ItemStack item, XPrisonEnchantment enchantment) Removes a specific enchantment from an item.org.bukkit.inventory.ItemStack
setEnchantLevel
(org.bukkit.entity.Player player, org.bukkit.inventory.ItemStack item, XPrisonEnchantment enchantment, int level) Sets an enchantment with a specific level on an item.boolean
unregisterEnchant
(XPrisonEnchantment enchantment) Unregisters an existing custom enchantment.
-
Method Details
-
getEnchants
Retrieves all custom enchantments applied to a specific item.- Parameters:
itemStack
- The item to check.- Returns:
- A map of
XPrisonEnchantment
to their respective levels on the item.
-
hasEnchant
Checks if an item has a specific enchantment.- Parameters:
item
- The item to check.enchantment
- The enchantment to look for.- Returns:
- True if the item has the specified enchantment, false otherwise.
-
hasEnchant
Checks if an item has a specific enchantment at a given level.- Parameters:
item
- The item to check.enchantment
- The enchantment to look for.level
- The specific enchantment level.- Returns:
- True if the item has the specified enchantment at the given level, false otherwise.
-
getEnchantLevel
Gets the level of a specific enchantment on an item.- Parameters:
item
- The item to check.enchantment
- The enchantment to retrieve the level for.- Returns:
- The level of the enchantment, or 0 if the enchantment is not present.
-
setEnchantLevel
org.bukkit.inventory.ItemStack setEnchantLevel(org.bukkit.entity.Player player, org.bukkit.inventory.ItemStack item, XPrisonEnchantment enchantment, int level) Sets an enchantment with a specific level on an item.- Parameters:
player
- The player applying the enchantment.item
- The item to enchant.enchantment
- The enchantment to apply.level
- The level of the enchantment.- Returns:
- The modified item with the enchantment applied.
-
removeEnchant
org.bukkit.inventory.ItemStack removeEnchant(org.bukkit.entity.Player player, org.bukkit.inventory.ItemStack item, XPrisonEnchantment enchantment) Removes a specific enchantment from an item.- Parameters:
player
- The player removing the enchantment.item
- The item to modify.enchantment
- The enchantment to remove.- Returns:
- The modified item with the enchantment removed.
-
getById
Retrieves an enchantment by its ID.- Parameters:
id
- The ID of the enchantment.- Returns:
- The
XPrisonEnchantment
corresponding to the ID, or null if not found.
-
getByName
Retrieves an enchantment by its raw name.- Parameters:
rawName
- The raw name of the enchantment.- Returns:
- The
XPrisonEnchantment
corresponding to the name, or null if not found.
-
registerEnchant
Registers a new custom enchantment.- Parameters:
enchantment
- The enchantment to register.- Returns:
- True if the enchantment was registered successfully, false otherwise.
-
unregisterEnchant
Unregisters an existing custom enchantment.- Parameters:
enchantment
- The enchantment to unregister.- Returns:
- True if the enchantment was unregistered successfully, false otherwise.
-