Class ClickEvent

java.lang.Object
net.kyori.adventure.text.event.ClickEvent
All Implemented Interfaces:
ComponentBuilderApplicable, StyleBuilderApplicable, net.kyori.examination.Examinable

public final class ClickEvent
extends Object
implements net.kyori.examination.Examinable, StyleBuilderApplicable
A click event.

A click event processes an ClickEvent.Action when clicked on.

Since:
4.0.0
  • Method Details

    • openUrl

      public static @NonNull ClickEvent openUrl​(@NonNull String url)
      Creates a click event that opens a url.
      Parameters:
      url - the url to open
      Returns:
      a click event
      Since:
      4.0.0
    • openUrl

      public static @NonNull ClickEvent openUrl​(@NonNull URL url)
      Creates a click event that opens a url.
      Parameters:
      url - the url to open
      Returns:
      a click event
      Since:
      4.0.0
    • openFile

      public static @NonNull ClickEvent openFile​(@NonNull String file)
      Creates a click event that opens a file.

      This action is not readable, and may only be used locally on the client.

      Parameters:
      file - the file to open
      Returns:
      a click event
      Since:
      4.0.0
    • runCommand

      public static @NonNull ClickEvent runCommand​(@NonNull String command)
      Creates a click event that runs a command.
      Parameters:
      command - the command to run
      Returns:
      a click event
      Since:
      4.0.0
    • suggestCommand

      public static @NonNull ClickEvent suggestCommand​(@NonNull String command)
      Creates a click event that suggests a command.
      Parameters:
      command - the command to suggest
      Returns:
      a click event
      Since:
      4.0.0
    • changePage

      public static @NonNull ClickEvent changePage​(@NonNull String page)
      Creates a click event that changes to a page.
      Parameters:
      page - the page to change to
      Returns:
      a click event
      Since:
      4.0.0
    • changePage

      public static @NonNull ClickEvent changePage​(int page)
      Creates a click event that changes to a page.
      Parameters:
      page - the page to change to
      Returns:
      a click event
      Since:
      4.0.0
    • copyToClipboard

      public static @NonNull ClickEvent copyToClipboard​(@NonNull String text)
      Creates a click event that copies text to the clipboard.
      Parameters:
      text - the text to copy to the clipboard
      Returns:
      a click event
      Since:
      4.0.0
    • clickEvent

      public static @NonNull ClickEvent clickEvent​(@NonNull ClickEvent.Action action, @NonNull String value)
      Creates a click event.
      Parameters:
      action - the action
      value - the value
      Returns:
      a click event
      Since:
      4.0.0
    • action

      public @NonNull ClickEvent.Action action()
      Gets the click event action.
      Returns:
      the click event action
      Since:
      4.0.0
    • value

      public @NonNull String value()
      Gets the click event value.
      Returns:
      the click event value
      Since:
      4.0.0
    • styleApply

      public void styleApply​(@NonNull Style.Builder style)
      Description copied from interface: StyleBuilderApplicable
      Applies to style.
      Specified by:
      styleApply in interface StyleBuilderApplicable
      Parameters:
      style - the style builder
    • equals

      public boolean equals​(@Nullable Object other)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • examinableProperties

      public @NonNull Stream<? extends net.kyori.examination.ExaminableProperty> examinableProperties()
      Specified by:
      examinableProperties in interface net.kyori.examination.Examinable
    • toString

      public String toString()
      Overrides:
      toString in class Object