Class ChatMessages


public class ChatMessages extends Object
Handles parsing chat messages.
  • Field Details

    • linkParseMode

      public static LinkParseMode linkParseMode
      Link parse mode for potential links which are not marked with tags.
    • colorResetCodes

      public static boolean colorResetCodes
      If color codes should also function as reset code.
  • Constructor Details

    • ChatMessages

      public ChatMessages()
  • Method Details

    • registerListeners

      public static void registerListeners()
      Registers language change listener for chat system. Called once by Skript, please don't call this addon developers.
    • parse

      public static List<MessageComponent> parse(String msg)
      Parses a string to list of chat message components.
      msg - Input string.
      List with components.
    • parseToArray

      public static MessageComponent[] parseToArray(String msg)
    • fromParsedString

      public static List<MessageComponent> fromParsedString(String msg)
      Parses a string that may only contain colour codes using the '§' character to a list of components.
    • toJson

      public static String toJson(String msg)
    • toJson

      public static String toJson(List<MessageComponent> components)
    • copyStyles

      public static void copyStyles(MessageComponent from, MessageComponent to)
      Copies styles from component to another. Note that this only copies additional styling, i.e. if text was not bold and is bold, it will remain bold.
      from -
      to -
    • shareStyles

      public static void shareStyles(MessageComponent[] components)
    • plainText

      public static MessageComponent plainText(String str)
      Constructs plain text only message component.
      str -
    • registerAddonCode

      public static void registerAddonCode(@Nullable SkriptAddon addon, @Nullable ChatCode code)
      Registers a chat code. This is for addon developers.
      code - Something that implements ChatCode. For inspiration, check SkriptChatCode source code.
    • stripStyles

      public static String stripStyles(String text)
      Strips all styles from given string.
      text - String to strip styles from.
      A string without styles.