Package me.croabeast.prismatic.chat
Enum Class ChatComponent.Click
- All Implemented Interfaces:
Serializable,Comparable<ChatComponent.Click>,Constable
- Enclosing interface:
ChatComponent<C extends ChatComponent<C>>
Enumeration of the click actions that a
ChatComponent can carry.
Each constant wraps a Bungee ClickEvent.Action and also holds a collection of
lowercase string aliases that are recognized by fromName(String). This allows
callers to use short, human-friendly names like "run", "suggest" or
"url" instead of the verbose Bungee action constants.
Example:
component.setClick(Click.EXECUTE, "/spawn");
// or equivalently:
component.setClick("run", "/spawn");
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionChanges the current page in a written book.Copies text to the player's clipboard.Runs a command as the player who clicks the text.Opens a file on the player's local filesystem (rarely used in practice).Opens a URL in the player's default browser.Inserts text into the player's chat input without sending it. -
Method Summary
Modifier and TypeMethodDescriptionnet.md_5.bungee.api.chat.ClickEvent.ActionasBukkit()Returns the underlying BungeeClickEvent.Actionfor this click type.static ChatComponent.ClickResolves aClickconstant from a string alias.toString()Returns the primary lowercase alias for this click type (e.g.static ChatComponent.ClickReturns the enum constant of this class with the specified name.static ChatComponent.Click[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
EXECUTE
Runs a command as the player who clicks the text. -
OPEN_URL
Opens a URL in the player's default browser. -
OPEN_FILE
Opens a file on the player's local filesystem (rarely used in practice). -
SUGGEST
Inserts text into the player's chat input without sending it. -
CHANGE_PAGE
Changes the current page in a written book. -
CLIPBOARD
Copies text to the player's clipboard.
-
-
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
-
asBukkit
public net.md_5.bungee.api.chat.ClickEvent.Action asBukkit()Returns the underlying BungeeClickEvent.Actionfor this click type.- Returns:
- the corresponding Bungee click action; never
null
-
toString
Returns the primary lowercase alias for this click type (e.g."execute","open_url").- Overrides:
toStringin classEnum<ChatComponent.Click>- Returns:
- the primary alias string
-
fromName
Resolves aClickconstant from a string alias.The comparison is case-insensitive and matches against all registered aliases, including the constant name, the Bungee action name and any extra aliases declared in the constructor. When the input is blank or no alias matches,
SUGGESTis returned as a safe default.- Parameters:
name- a case-insensitive alias to look up (e.g."run","url")- Returns:
- the matching
Clickconstant, orSUGGESTif none is found
-