Class ChatMessages

java.lang.Object
ch.njol.skript.util.chat.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.
      Parameters:
      msg - Input string.
      Returns:
      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.
      Parameters:
      from -
      to -
    • shareStyles

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

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

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

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