Package ch.njol.skript.util.chat
Class ChatMessages
java.lang.Object
ch.njol.skript.util.chat.ChatMessages
Handles parsing chat messages.
-
Field Summary
Modifier and TypeFieldDescriptionstatic boolean
If color codes should also function as reset code.static LinkParseMode
Link parse mode for potential links which are not marked with tags. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
copyStyles(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 MessageComponent
Constructs plain text only message component.static void
registerAddonCode(@Nullable SkriptAddon addon, @Nullable ChatCode code)
Registers a chat code.static void
Registers language change listener for chat system.static void
shareStyles(MessageComponent[] components)
static String
stripStyles(String text)
Strips all styles from given string.static String
static String
toJson(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
Registers a chat code. This is for addon developers.- Parameters:
code
- Something that implementsChatCode
. For inspiration, checkSkriptChatCode
source code.
-
stripStyles
Strips all styles from given string.- Parameters:
text
- String to strip styles from.- Returns:
- A string without styles.
-