Package ch.njol.skript.util.chat
Class ChatMessages
java.lang.Object
ch.njol.skript.util.chat.ChatMessages
Handles parsing chat messages.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic booleanIf color codes should also function as reset code.static LinkParseModeLink parse mode for potential links which are not marked with tags. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidcopyStyles(MessageComponent from, MessageComponent to) Copies styles from component to another.static List<MessageComponent> fromParsedString(String msg) Parses a string that may only contain colour codes using the '§' character to a list of components.static List<MessageComponent> Parses a string to list of chat message components.static MessageComponent[]parseToArray(String msg) static MessageComponentConstructs plain text only message component.static voidregisterAddonCode(@Nullable SkriptAddon addon, @Nullable ChatCode code) Registers a chat code.static voidRegisters language change listener for chat system.static voidshareStyles(MessageComponent[] components) static StringstripStyles(String text) Strips all styles from given string.static Stringstatic StringtoJson(List<MessageComponent> components)
-
Field Details
-
linkParseMode
Link parse mode for potential links which are not marked with tags. -
colorResetCodes
public static boolean colorResetCodesIf 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
Parses a string to list of chat message components.- Parameters:
msg- Input string.- Returns:
- List with components.
-
parseToArray
-
fromParsedString
Parses a string that may only contain colour codes using the '§' character to a list of components. -
toJson
-
toJson
-
copyStyles
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-
-
plainText
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 implementsChatCode. For inspiration, checkSkriptChatCodesource code.
-
stripStyles
Strips all styles from given string.- Parameters:
text- String to strip styles from.- Returns:
- A string without styles.
-