Class TownyComponents

java.lang.Object
com.palmergames.bukkit.towny.utils.TownyComponents

@Internal public class TownyComponents extends Object
Internal utility class for common interactions with adventure components.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static net.kyori.adventure.text.Component
    joinList(List<net.kyori.adventure.text.Component> components, net.kyori.adventure.text.Component delimiter)
     
    static net.kyori.adventure.text.Component
    legacy(@NotNull String string)
    Converts legacy text to a component
    static net.kyori.adventure.text.Component
    miniMessage(@NotNull String string)
     
    static String
    plain(@NotNull net.kyori.adventure.text.Component component)
     
    static String
    stripClickTags(@NotNull String input)
     
    static String
    stripTags(@NotNull String input)
    Strips all tags known to the default minimessage instance.
    static String
    stripTags(@NotNull String input, net.kyori.adventure.text.minimessage.tag.resolver.TagResolver... resolvers)
    Strips the specified tags from the input
    static String
    toLegacy(@NotNull net.kyori.adventure.text.Component component)
    Converts a component to a legacy string using the legacy serializer

    Methods inherited from class java.lang.Object

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

    • TownyComponents

      public TownyComponents()
  • Method Details

    • miniMessage

      public static net.kyori.adventure.text.Component miniMessage(@NotNull @NotNull String string)
    • plain

      public static String plain(@NotNull @NotNull net.kyori.adventure.text.Component component)
    • legacy

      public static net.kyori.adventure.text.Component legacy(@NotNull @NotNull String string)
      Converts legacy text to a component
      Parameters:
      string - The input string with legacy ampersand/section characters
      Returns:
      The component equivalent
    • toLegacy

      public static String toLegacy(@NotNull @NotNull net.kyori.adventure.text.Component component)
      Converts a component to a legacy string using the legacy serializer
      Parameters:
      component - The component to convert
      Returns:
      A string with legacy section characters
    • stripTags

      public static String stripTags(@NotNull @NotNull String input)
      Strips all tags known to the default minimessage instance.
      Parameters:
      input - The input
      Returns:
      The stripped output
    • stripTags

      public static String stripTags(@NotNull @NotNull String input, net.kyori.adventure.text.minimessage.tag.resolver.TagResolver... resolvers)
      Strips the specified tags from the input
      Parameters:
      input - The input that may contain tags
      resolvers - The resolver(s) for tags to strip from the input
      Returns:
      The stripped output
    • stripClickTags

      public static String stripClickTags(@NotNull @NotNull String input)
    • joinList

      public static net.kyori.adventure.text.Component joinList(List<net.kyori.adventure.text.Component> components, net.kyori.adventure.text.Component delimiter)