public final class TextActions extends Object
TextAction
s.Modifier and Type | Method and Description |
---|---|
static ClickAction.ChangePage |
changePage(int page)
Creates a new
ClickAction that will change the page in a book
when it is clicked. |
static ClickAction.ExecuteCallback |
executeCallback(Consumer<CommandSource> callback)
Creates a new
ClickAction that will execute the given runnable on
the server when clicked. |
static ShiftClickAction.InsertText |
insertText(String text)
Creates a new
ShiftClickAction that will insert text at the
current cursor position in the chat when it is shift-clicked. |
static ClickAction.OpenUrl |
openUrl(URL url)
Creates a new
ClickAction that will ask the player to open an URL
when it is clicked. |
static ClickAction.RunCommand |
runCommand(String command)
Creates a new
ClickAction that will type a command on the client
when it is clicked. |
static HoverAction.ShowEntity |
showEntity(Entity entity,
String name)
Creates a new
HoverAction that will show information about an
entity when it is hovered. |
static HoverAction.ShowEntity |
showEntity(HoverAction.ShowEntity.Ref entity)
Creates a new
HoverAction that will show information about an
entity when it is hovered. |
static HoverAction.ShowEntity |
showEntity(UUID uuid,
String name)
Creates a new
HoverAction that will show information about an
entity when it is hovered. |
static HoverAction.ShowEntity |
showEntity(UUID uuid,
String name,
EntityType type)
Creates a new
HoverAction that will show information about an
entity when it is hovered. |
static HoverAction.ShowItem |
showItem(ItemStackSnapshot item)
Creates a new
HoverAction that will show information about an
item when it is hovered. |
static HoverAction.ShowText |
showText(Text text)
Creates a new
HoverAction that will show a text on the client
when it is hovered. |
static ClickAction.SuggestCommand |
suggestCommand(String command)
Creates a new
ClickAction that will suggest the player a command
when it is clicked. |
public static ClickAction.OpenUrl openUrl(URL url)
ClickAction
that will ask the player to open an URL
when it is clicked.url
- The URL to openpublic static ClickAction.RunCommand runCommand(String command)
ClickAction
that will type a command on the client
when it is clicked.command
- The command to executepublic static ClickAction.ChangePage changePage(int page)
ClickAction
that will change the page in a book
when it is clicked.page
- The book page to switch topublic static ClickAction.SuggestCommand suggestCommand(String command)
ClickAction
that will suggest the player a command
when it is clicked.command
- The command to suggestpublic static ClickAction.ExecuteCallback executeCallback(Consumer<CommandSource> callback)
ClickAction
that will execute the given runnable on
the server when clicked. The callback will expire after some amount of
time (not particularly instantly, but not like overnight really either).callback
- The callback to executepublic static HoverAction.ShowText showText(Text text)
HoverAction
that will show a text on the client
when it is hovered.text
- The text to displaypublic static HoverAction.ShowItem showItem(ItemStackSnapshot item)
HoverAction
that will show information about an
item when it is hovered.item
- The item to displaypublic static HoverAction.ShowEntity showEntity(HoverAction.ShowEntity.Ref entity)
HoverAction
that will show information about an
entity when it is hovered.entity
- The entity to displaypublic static HoverAction.ShowEntity showEntity(UUID uuid, String name, @Nullable EntityType type)
HoverAction
that will show information about an
entity when it is hovered.uuid
- The UUID of the entityname
- The name of the entitytype
- The type of the entitypublic static HoverAction.ShowEntity showEntity(UUID uuid, String name)
HoverAction
that will show information about an
entity when it is hovered.uuid
- The UUID of the entityname
- The name of the entitypublic static HoverAction.ShowEntity showEntity(Entity entity, String name)
HoverAction
that will show information about an
entity when it is hovered.entity
- The entityname
- The name of the entitypublic static ShiftClickAction.InsertText insertText(String text)
ShiftClickAction
that will insert text at the
current cursor position in the chat when it is shift-clicked.text
- The text to insert