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 java.lang.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
Nested Classes Modifier and Type Class Description static class
ClickEvent.Action
An enumeration of click event actions.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description @NotNull ClickEvent.Action
action()
Gets the click event action.static @NotNull ClickEvent
changePage(int page)
Creates a click event that changes to a page.static @NotNull ClickEvent
changePage(@NotNull java.lang.String page)
Creates a click event that changes to a page.static @NotNull ClickEvent
clickEvent(@NotNull ClickEvent.Action action, @NotNull java.lang.String value)
Creates a click event.static @NotNull ClickEvent
copyToClipboard(@NotNull java.lang.String text)
Creates a click event that copies text to the clipboard.boolean
equals(@Nullable java.lang.Object other)
@NotNull java.util.stream.Stream<? extends net.kyori.examination.ExaminableProperty>
examinableProperties()
int
hashCode()
static @NotNull ClickEvent
openFile(@NotNull java.lang.String file)
Creates a click event that opens a file.static @NotNull ClickEvent
openUrl(@NotNull java.lang.String url)
Creates a click event that opens a url.static @NotNull ClickEvent
openUrl(@NotNull java.net.URL url)
Creates a click event that opens a url.static @NotNull ClickEvent
runCommand(@NotNull java.lang.String command)
Creates a click event that runs a command.void
styleApply(@NotNull Style.Builder style)
Applies tostyle
.static @NotNull ClickEvent
suggestCommand(@NotNull java.lang.String command)
Creates a click event that suggests a command.java.lang.String
toString()
@NotNull java.lang.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.adventure.text.format.StyleBuilderApplicable
componentBuilderApply
-
-
-
-
Method Detail
-
openUrl
@NotNull public static @NotNull ClickEvent openUrl(@NotNull @NotNull java.lang.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
@NotNull public static @NotNull ClickEvent openUrl(@NotNull @NotNull java.net.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
@NotNull public static @NotNull ClickEvent openFile(@NotNull @NotNull java.lang.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
@NotNull public static @NotNull ClickEvent runCommand(@NotNull @NotNull java.lang.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
@NotNull public static @NotNull ClickEvent suggestCommand(@NotNull @NotNull java.lang.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
@NotNull public static @NotNull ClickEvent changePage(@NotNull @NotNull java.lang.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
@NotNull public static @NotNull 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
@NotNull public static @NotNull ClickEvent copyToClipboard(@NotNull @NotNull java.lang.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
- Since Minecraft:
- 1.15
-
clickEvent
@NotNull public static @NotNull ClickEvent clickEvent(@NotNull @NotNull ClickEvent.Action action, @NotNull @NotNull java.lang.String value)
Creates a click event.- Parameters:
action
- the actionvalue
- the value- Returns:
- a click event
- Since:
- 4.0.0
-
action
@NotNull public @NotNull ClickEvent.Action action()
Gets the click event action.- Returns:
- the click event action
- Since:
- 4.0.0
-
value
@NotNull public @NotNull java.lang.String value()
Gets the click event value.- Returns:
- the click event value
- Since:
- 4.0.0
-
styleApply
public void styleApply(@NotNull Style.Builder style)
Description copied from interface:StyleBuilderApplicable
Applies tostyle
.- Specified by:
styleApply
in interfaceStyleBuilderApplicable
- Parameters:
style
- the style builder
-
equals
public boolean equals(@Nullable @Nullable java.lang.Object other)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
examinableProperties
@NotNull public @NotNull java.util.stream.Stream<? extends net.kyori.examination.ExaminableProperty> examinableProperties()
- Specified by:
examinableProperties
in interfacenet.kyori.examination.Examinable
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-