Interface XPrisonEnchantsAPI


public interface XPrisonEnchantsAPI
API interface for managing custom enchantments on items.
  • Method Details

    • getEnchants

      Map<XPrisonEnchantment,Integer> getEnchants(org.bukkit.inventory.ItemStack itemStack)
      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

      boolean hasEnchant(org.bukkit.inventory.ItemStack item, XPrisonEnchantment enchantment)
      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

      boolean hasEnchant(org.bukkit.inventory.ItemStack item, XPrisonEnchantment enchantment, int level)
      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

      int getEnchantLevel(org.bukkit.inventory.ItemStack item, XPrisonEnchantment enchantment)
      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

      XPrisonEnchantment getById(int id)
      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

      XPrisonEnchantment getByName(String rawName)
      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

      boolean registerEnchant(XPrisonEnchantment enchantment)
      Registers a new custom enchantment.
      Parameters:
      enchantment - The enchantment to register.
      Returns:
      True if the enchantment was registered successfully, false otherwise.
    • unregisterEnchant

      boolean unregisterEnchant(XPrisonEnchantment enchantment)
      Unregisters an existing custom enchantment.
      Parameters:
      enchantment - The enchantment to unregister.
      Returns:
      True if the enchantment was unregistered successfully, false otherwise.