Enum Class ChatComponent.Click

java.lang.Object
java.lang.Enum<ChatComponent.Click>
me.croabeast.prismatic.chat.ChatComponent.Click
All Implemented Interfaces:
Serializable, Comparable<ChatComponent.Click>, Constable
Enclosing interface:
ChatComponent<C extends ChatComponent<C>>

public static enum ChatComponent.Click extends Enum<ChatComponent.Click>
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");
 
  • Enum Constant Details

    • EXECUTE

      public static final ChatComponent.Click EXECUTE
      Runs a command as the player who clicks the text.
    • OPEN_URL

      public static final ChatComponent.Click OPEN_URL
      Opens a URL in the player's default browser.
    • OPEN_FILE

      public static final ChatComponent.Click OPEN_FILE
      Opens a file on the player's local filesystem (rarely used in practice).
    • SUGGEST

      public static final ChatComponent.Click SUGGEST
      Inserts text into the player's chat input without sending it.
    • CHANGE_PAGE

      public static final ChatComponent.Click CHANGE_PAGE
      Changes the current page in a written book.
    • CLIPBOARD

      public static final ChatComponent.Click CLIPBOARD
      Copies text to the player's clipboard.
  • Method Details

    • values

      public static ChatComponent.Click[] 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

      public static ChatComponent.Click valueOf(String name)
      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 name
      NullPointerException - if the argument is null
    • asBukkit

      public net.md_5.bungee.api.chat.ClickEvent.Action asBukkit()
      Returns the underlying Bungee ClickEvent.Action for this click type.
      Returns:
      the corresponding Bungee click action; never null
    • toString

      public String toString()
      Returns the primary lowercase alias for this click type (e.g. "execute", "open_url").
      Overrides:
      toString in class Enum<ChatComponent.Click>
      Returns:
      the primary alias string
    • fromName

      public static ChatComponent.Click fromName(String name)
      Resolves a Click constant 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, SUGGEST is returned as a safe default.

      Parameters:
      name - a case-insensitive alias to look up (e.g. "run", "url")
      Returns:
      the matching Click constant, or SUGGEST if none is found