Package one.tranic.t.base.message
Enum Class MessageExample
- All Implemented Interfaces:
Serializable,Comparable<MessageExample>,Constable
The
MessageExample enum defines a set of predefined message keys
used for retrieving and formatting text-based messages.
It is only used as your own MessageKey reference. Please do not use it directly in your own project. You should copy it and add your own keys.
Each enum constant is associated with a unique key, which serves as the identifier for a specific message.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum Constants -
Method Summary
Modifier and TypeMethodDescriptionnet.kyori.adventure.text.ComponentFormats a message using the provided arguments and resolves placeholders.net.md_5.bungee.api.chat.BaseComponent[]formatBungee(Object... args) Converts the given arguments into an array of BungeeCord BaseComponents using legacy text formatting, but only if the current platform is BungeeCord.formatString(Object... args) Formats a string representation of a message using specified arguments.getKey()Retrieves the key associated with thisMessageExampleinstance.getValue()Retrieves the message string associated with this enum constant.static MessageExampleReturns the enum constant of this class with the specified name.static MessageExample[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
NAME
-
DEFAULT_KICK
-
KICK_MESSAGE
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-
getKey
Retrieves the key associated with thisMessageExampleinstance.- Returns:
- the key as a
Stringthat uniquely identifies this message
-
format
Formats a message using the provided arguments and resolves placeholders.If no arguments are provided, it simply retrieves and returns the message associated with the current object key.
- Parameters:
args- the arguments used to populate placeholders in the message. This can be an array ofMessageFormatorMessageFormatStringobjects.- Returns:
- a
Componentrepresenting the formatted message with resolved placeholders. - Throws:
IllegalArgumentException- if the arguments are not of type MessageFormat[] or MessageFormatString[].
-
getValue
Retrieves the message string associated with this enum constant.The message is fetched using the key corresponding to the enum constant from the internal messages map, and is guaranteed to be non-null.
- Returns:
- the non-null message string associated with the enum constant
- Throws:
NullPointerException- if no message is found for the enum constant
-
formatString
Formats a string representation of a message using specified arguments.The method utilizes the legacy section serialization format to convert the formatted
Componentreturned by theformatmethod into a string.- Parameters:
args- the arguments to be used for formatting the message. The arguments can be of various types, includingMessageFormatorMessageFormatStringarrays.- Returns:
- the serialized string representation of the formatted message
-
formatBungee
Converts the given arguments into an array of BungeeCord BaseComponents using legacy text formatting, but only if the current platform is BungeeCord.- Parameters:
args- the arguments to format into a legacy text string and convert to BungeeCord BaseComponents- Returns:
- an array of BungeeCord BaseComponents representing the formatted text, or null if the current platform is not BungeeCord
-