Class UberUtils

java.lang.Object
me.sciguymjm.uberenchant.api.utils.UberUtils

public class UberUtils extends Object
Custom enchantment related utility class
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    addEnchantment(UberEnchantment enchant, org.bukkit.inventory.ItemStack item, int level)
    Adds the specified UberEnchantment to the item with specified level.
    static void
    addEnchantmentLore(org.bukkit.inventory.ItemStack item)
    Adds custom enchantment lore to the specified item if it contains any custom enchantments.
    (An example would be "Sharpness V", if sharpness was custom)
    static String
    displayName(UberEnchantment enchantment, int level)
    Constructs the custom enchantment lore.
    (Formatted as "<name> <level>" ie "Sharpness V")
    static org.bukkit.inventory.ItemStack
    extractEnchantment(UberEnchantment enchantment, org.bukkit.inventory.ItemStack item)
    Extracts the specified UberEnchantment from the item and puts it as a stored enchantment on an enchanted book.
    static int
    offset(org.bukkit.inventory.ItemStack item)
    Gets the offset (if any) required for custom enchantment lore.
    static int
    removeEnchantment(UberEnchantment enchantment, org.bukkit.inventory.ItemStack item)
    Removes the specified UberEnchantment from the item, returning the level of the enchantment or 0.
    static void
    removeEnchantmentLore(org.bukkit.inventory.ItemStack item)
    Removes any custom enchantment lore on the specified item
    static String
    toRomanNumeral(int number)
    Simple Integer to Roman numeral function.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • UberUtils

      public UberUtils()
  • Method Details

    • addEnchantment

      public static void addEnchantment(UberEnchantment enchant, org.bukkit.inventory.ItemStack item, int level)
      Adds the specified UberEnchantment to the item with specified level. Also adds the lore for displaying the enchantment on the item.
      Parameters:
      enchant - - The enchantment to add
      item - - The item
      level - - The level
    • removeEnchantment

      public static int removeEnchantment(UberEnchantment enchantment, org.bukkit.inventory.ItemStack item)
      Removes the specified UberEnchantment from the item, returning the level of the enchantment or 0.
      Parameters:
      enchantment - - The enchantment to remove
      item - - The item
      Returns:
      The enchantment level or 0
    • extractEnchantment

      public static org.bukkit.inventory.ItemStack extractEnchantment(UberEnchantment enchantment, org.bukkit.inventory.ItemStack item)
      Extracts the specified UberEnchantment from the item and puts it as a stored enchantment on an enchanted book.
      Parameters:
      enchantment - - The enchantment to extract
      item - - The item
      Returns:
      An enchanted book itemstack containing the extracted enchantment
    • addEnchantmentLore

      public static void addEnchantmentLore(org.bukkit.inventory.ItemStack item)
      Adds custom enchantment lore to the specified item if it contains any custom enchantments.
      (An example would be "Sharpness V", if sharpness was custom)
      Parameters:
      item - - The item
    • removeEnchantmentLore

      public static void removeEnchantmentLore(org.bukkit.inventory.ItemStack item)
      Removes any custom enchantment lore on the specified item
      Parameters:
      item - - The item
    • displayName

      public static String displayName(UberEnchantment enchantment, int level)
      Constructs the custom enchantment lore.
      (Formatted as "<name> <level>" ie "Sharpness V")
      Parameters:
      enchantment - - The enchantment
      level - - ENchantment level
      Returns:
      A string with the formatted display name
    • offset

      public static int offset(org.bukkit.inventory.ItemStack item)
      Gets the offset (if any) required for custom enchantment lore.
      Parameters:
      item - - The item
      Returns:
      Amount of offset or 0 in case of no enchantments
    • toRomanNumeral

      public static String toRomanNumeral(int number)
      Simple Integer to Roman numeral function.
      Parameters:
      number - - The number to convert
      Returns:
      the converted number as a String or an empty String if number is less than 1