Class FontImageWrapper
java.lang.Object
dev.lone.itemsadder.api.FontImages.FontImageWrapper
Wrapper for an ItemsAdder font image.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionapplyPixelsOffset(int offset) Deprecated.static StringapplyPixelsOffsetToString(String str, int offset) Applies a pixel offset to a string.booleanexists()Checks if the wrapped font image exists.net.kyori.adventure.text.format.TextColorgetColor()Gets the current font image color.intGets the font image height.Gets the font image namespaced id.Gets all font image namespaced ids and their unicode values.Gets all font image namespaced ids currently registered.intGets the current pixel offset.Gets the font image string with the current offset applied.intgetWidth()Gets the font image width.static FontImageWrapperCreates a font image wrapper if the font image exists.INTERNAL USE ONLY!static StringreplaceFontImages(String string) Replaces font image placeholders in a string.static @NotNull net.kyori.adventure.text.ComponentreplaceFontImages(net.kyori.adventure.text.Component adventureComponent) Replaces font image placeholders in an Adventure component.static StringreplaceFontImages(Permissible player, String string) Replaces font image placeholders in a string using player permissions.static @NotNull net.kyori.adventure.text.ComponentreplaceFontImages(Permissible player, net.kyori.adventure.text.Component adventureComponent) Replaces font image placeholders in an Adventure component using player permissions.setColor(net.kyori.adventure.text.format.TextColor color) Sets the font image color.Sets the font image color from a Bukkit chat color.setOffset(int offset) Sets the pixel offset applied to this font image.
-
Constructor Details
-
FontImageWrapper
Creates a font image wrapper.- Parameters:
namespacedID- the font image namespaced id.- Throws:
IllegalArgumentException- if the namespaced id is null, empty, or not registered.
-
-
Method Details
-
instance
Creates a font image wrapper if the font image exists.- Parameters:
namespacedID- the font image namespaced id.- Returns:
- the wrapper, or null if the font image does not exist.
-
getNamespacedIdsInRegistry
-
getNamespacedIdsAndValueInRegistry
-
replaceFontImages
-
replaceFontImages
@NotNull public static @NotNull net.kyori.adventure.text.Component replaceFontImages(net.kyori.adventure.text.Component adventureComponent) Replaces font image placeholders in an Adventure component.- Parameters:
adventureComponent- the source component.- Returns:
- the component with font images replaced.
-
replaceFontImages
Replaces font image placeholders in a string using player permissions.- Parameters:
player- the permissible used for permission checks.string- the source string.- Returns:
- the string with font images replaced.
-
replaceFontImages
@NotNull public static @NotNull net.kyori.adventure.text.Component replaceFontImages(Permissible player, net.kyori.adventure.text.Component adventureComponent) Replaces font image placeholders in an Adventure component using player permissions.- Parameters:
player- the permissible used for permission checks.adventureComponent- the source component.- Returns:
- the component with font images replaced.
-
applyPixelsOffsetToString
-
getNamespacedID
-
exists
public boolean exists()Checks if the wrapped font image exists.- Returns:
- true if the internal font image is present.
-
getString
Gets the font image string with the current offset applied.- Returns:
- the font image string.
-
getWidth
public int getWidth()Gets the font image width.- Returns:
- the width in pixels.
-
getHeight
public int getHeight()Gets the font image height.- Returns:
- the height in pixels.
-
applyPixelsOffset
Deprecated.usesetOffset(int)andgetString()instead.Applies an offset to this wrapper and returns the shifted font image string.- Parameters:
offset- the pixel offset.- Returns:
- the shifted font image string.
-
getColor
public net.kyori.adventure.text.format.TextColor getColor()Gets the current font image color.- Returns:
- the current text color.
-
setColor
Sets the font image color.- Parameters:
color- the new text color.- Returns:
- this wrapper.
-
setColor
Sets the font image color from a Bukkit chat color.- Parameters:
bukkitChatColor- the Bukkit chat color.- Returns:
- this wrapper.
-
setOffset
Sets the pixel offset applied to this font image.- Parameters:
offset- the pixel offset.- Returns:
- this wrapper.
-
getOffset
public int getOffset()Gets the current pixel offset.- Returns:
- the current pixel offset.
-
internalGetUnicode
INTERNAL USE ONLY!
-
setOffset(int)andgetString()instead.