Class FontImageWrapper

java.lang.Object
dev.lone.itemsadder.api.FontImages.FontImageWrapper

public class FontImageWrapper extends Object
Class representing ItemAdder custom images feature.
  • Constructor Details

    • FontImageWrapper

      public FontImageWrapper(String namespacedID)
      Get a wrapper for the internal font image of ItemsAdder.
      Parameters:
      namespacedID -
  • Method Details

    • instance

      public static FontImageWrapper instance(String namespacedID)
    • getNamespacedIdsInRegistry

      public static Set<String> getNamespacedIdsInRegistry()
    • getNamespacedIdsAndValueInRegistry

      public static Map<String,String> getNamespacedIdsAndValueInRegistry()
    • replaceFontImages

      public static String replaceFontImages(String string)
      Static utility method to replace all the font images placeholders in a String.
      Parameters:
      string - String you want to get placeholders replaced.
      Returns:
      String with placeholders replaced with unicode characters.
    • replaceFontImages

      public static net.kyori.adventure.text.Component replaceFontImages(net.kyori.adventure.text.Component adventureComponent)
      Static utility method to replace all the font images placeholders in a Component.
      Parameters:
      adventureComponent - Component you want to get placeholders replaced.
      Returns:
      Component with placeholders replaced with unicode characters.
      Throws:
      NotActuallyItemsAdderException - Always thrown to indicate this is a placeholder.
    • replaceFontImages

      public static String replaceFontImages(org.bukkit.permissions.Permissible player, String string)
      Static utility method to replace all the font images placeholders in a String.
      Parameters:
      player - Player to check permissions to use the placeholders. Each placeholder permission is checked, and it won't be replaced if the player has no permission to use it.
      string - String you want to get placeholders replaced.
      Returns:
      String with placeholders replaced with unicode characters.
    • replaceFontImages

      @NotNull public static @NotNull net.kyori.adventure.text.Component replaceFontImages(org.bukkit.permissions.Permissible player, net.kyori.adventure.text.Component adventureComponent)
      Static utility method to replace all the font images placeholders in a Component.
      Parameters:
      player - Player to check permissions to use the placeholders.
      adventureComponent - Component you want to get placeholders replaced.
      Returns:
      Component with placeholders replaced with unicode characters.
    • applyPixelsOffsetToString

      public static String applyPixelsOffsetToString(String str, int offset)
      Shift a text/font image back or forward. Useful to create complex HUDs or similar effects.
      Parameters:
      str - the String you want to apply the offset to.
      offset - int offset in pixels
      Returns:
      the modified String.
    • getInternal

      @Nullable public @Nullable Object getInternal()
      Gets the internal ItemsAdder object. Should only be used by the plugin developer.
    • getNamespacedID

      public String getNamespacedID()
      Gets the Namespace and ID in the format namespace:id for this font_image.
      Returns:
      String representing the namespace and ID of the font_image.
    • exists

      public boolean exists()
      Checks if the font_image exists in ItemsAdder registry.
      Returns:
      true if the font_image exists in ItemsAdder registry.
    • getString

      public String getString()
      Get the color + font_image unicode character + ChatColor.RESET.
      Returns:
      color + font_image unicode character + ChatColor.RESET.
    • getWidth

      public int getWidth()
      Get width of the font_image character.
      Returns:
      Width of the font_image character.
    • getHeight

      public int getHeight()
      Get height of the font_image character.
      Returns:
      Height of the font_image character.
    • applyPixelsOffset

      @Deprecated public String applyPixelsOffset(int offset)
      Deprecated.
      Get a copy of the font_image String with pixel offset applied to it. Doesn't modify the original one.
      Parameters:
      offset - int offset in pixels.
      Returns:
      A copy of the font_image String with pixel offset applied to it. Doesn't modify the original one.
    • getColor

      public net.kyori.adventure.text.format.TextColor getColor()
      Get the text color of this wrapper.
      Returns:
      Text color of this wrapper.
    • setColor

      public FontImageWrapper setColor(net.kyori.adventure.text.format.TextColor color)
      Set color of this wrapper.
      Parameters:
      color - Color to set.
    • setColor

      public FontImageWrapper setColor(org.bukkit.ChatColor bukkitChatColor)
      Set color of this wrapper.
      Parameters:
      bukkitChatColor - Color to set.
    • setOffset

      public FontImageWrapper setOffset(int offset)
    • getOffset

      public int getOffset()