Package net.kyori.adventure.text.event
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
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
An enumeration of click event actions. -
Method Summary
Modifier and TypeMethodDescription@NotNull ClickEvent.Action
action()
Gets the click event action.static @NotNull ClickEvent
callback
(@NotNull ClickCallback<Audience> function) Create a click event that, when clicked, will schedule a callback function to be executed on the server.static @NotNull ClickEvent
callback
(@NotNull ClickCallback<Audience> function, @NotNull Consumer<@NotNull ClickCallback.Options.Builder> optionsBuilder) Create a click event that, when clicked, will schedule a callback function to be executed on the server.static @NotNull ClickEvent
callback
(@NotNull ClickCallback<Audience> function, @NotNull ClickCallback.Options options) Create a click event that, when clicked, will schedule a callback function to be executed on the server.static @NotNull ClickEvent
changePage
(int page) Creates a click event that changes to a page.static @NotNull ClickEvent
changePage
(@NotNull String page) Creates a click event that changes to a page.static @NotNull ClickEvent
clickEvent
(@NotNull ClickEvent.Action action, @NotNull String value) Creates a click event.static @NotNull ClickEvent
copyToClipboard
(@NotNull String text) Creates a click event that copies text to the clipboard.boolean
@NotNull Stream<? extends net.kyori.examination.ExaminableProperty>
int
hashCode()
static @NotNull ClickEvent
Creates a click event that opens a file.static @NotNull ClickEvent
Creates a click event that opens a url.static @NotNull ClickEvent
Creates a click event that opens a url.static @NotNull ClickEvent
runCommand
(@NotNull String command) Creates a click event that runs a command.void
styleApply
(@NotNull Style.Builder style) Applies tostyle
.static @NotNull ClickEvent
suggestCommand
(@NotNull String command) Creates a click event that suggests a command.toString()
@NotNull String
value()
Gets the click event value.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface net.kyori.examination.Examinable
examinableName, examine
Methods inherited from interface net.kyori.adventure.text.format.StyleBuilderApplicable
componentBuilderApply
-
Method Details
-
openUrl
Creates a click event that opens a url.- Parameters:
url
- the url to open- Returns:
- a click event
- Since:
- 4.0.0
-
openUrl
Creates a click event that opens a url.- Parameters:
url
- the url to open- Returns:
- a click event
- Since:
- 4.0.0
-
openFile
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
Creates a click event that runs a command.- Parameters:
command
- the command to run- Returns:
- a click event
- Since:
- 4.0.0
-
suggestCommand
Creates a click event that suggests a command.- Parameters:
command
- the command to suggest- Returns:
- a click event
- Since:
- 4.0.0
-
changePage
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
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
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
- Since Minecraft:
- 1.15
-
callback
@NotNull public static @NotNull ClickEvent callback(@NotNull @NotNull ClickCallback<Audience> function) Create a click event that, when clicked, will schedule a callback function to be executed on the server.By default, this will be a single-use function that expires after the value of
ClickCallback.DEFAULT_LIFETIME
.- Parameters:
function
- the function to execute- Returns:
- a callback click event
- Since:
- 4.13.0
-
callback
@NotNull public static @NotNull ClickEvent callback(@NotNull @NotNull ClickCallback<Audience> function, @NotNull ClickCallback.Options options) Create a click event that, when clicked, will schedule a callback function to be executed on the server.- Parameters:
function
- the function to executeoptions
- options to control how the callback will be stored on the server.- Returns:
- a callback click event
- Since:
- 4.13.0
-
callback
@NotNull public static @NotNull ClickEvent callback(@NotNull @NotNull ClickCallback<Audience> function, @NotNull @NotNull Consumer<@NotNull ClickCallback.Options.Builder> optionsBuilder) Create a click event that, when clicked, will schedule a callback function to be executed on the server.- Parameters:
function
- the function to executeoptionsBuilder
- function that will be called to configure the click callback options- Returns:
- a callback click event
- Since:
- 4.13.0
-
clickEvent
@NotNull public static @NotNull ClickEvent clickEvent(@NotNull @NotNull ClickEvent.Action action, @NotNull @NotNull String value) Creates a click event.- Parameters:
action
- the actionvalue
- the value- Returns:
- a click event
- Since:
- 4.0.0
-
action
Gets the click event action.- Returns:
- the click event action
- Since:
- 4.0.0
-
value
Gets the click event value.- Returns:
- the click event value
- Since:
- 4.0.0
-
styleApply
Description copied from interface:StyleBuilderApplicable
Applies tostyle
.- Specified by:
styleApply
in interfaceStyleBuilderApplicable
- Parameters:
style
- the style builder
-
equals
-
hashCode
public int hashCode() -
examinableProperties
@NotNull public @NotNull Stream<? extends net.kyori.examination.ExaminableProperty> examinableProperties()- Specified by:
examinableProperties
in interfacenet.kyori.examination.Examinable
-
toString
-