Class AnvilInputView
java.lang.Object
me.agent.vgui.api.input.AnvilInputView
- All Implemented Interfaces:
View
A text-input prompt rendered as an anvil window: the player types in the rename
field and clicks the output slot to confirm.
AnvilInputView.builder()
.title(Component.text("Choose a nickname"))
.initialText("Steve")
.onConfirm((player, text) -> setNickname(player, text))
.open(player);
For a future-based one-liner use VGui.prompt(Player, Component).
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic AnvilInputView.Builderbuilder()Starts building an anvil input prompt.voidonAnvilInput(String text, ViewContents contents) Called when the player types in an anvil rename field (only forViewType.ANVILviews), once per keystroke with the full current text.voidonClose(com.velocitypowered.api.proxy.Player player, CloseReason reason, ViewContext context) Called exactly once when the view stops being shown, with the reason and the per-open context.voidonOpen(ViewContents contents) Called right after the window opens (and again if the view is re-opened via back-navigation).net.kyori.adventure.text.Componenttitle()Title shown on the container.type()The window type (determines slot count and shape).Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface View
cancelClientTransactions, clickCooldownMillis, onClick
-
Field Details
-
TEXT
-
-
Method Details
-
builder
Starts building an anvil input prompt. -
title
-
type
-
onOpen
Description copied from interface:ViewCalled right after the window opens (and again if the view is re-opened via back-navigation). Populatecontentshere; mutations made inside this callback are sent as one batch. -
onAnvilInput
Description copied from interface:ViewCalled when the player types in an anvil rename field (only forViewType.ANVILviews), once per keystroke with the full current text.- Specified by:
onAnvilInputin interfaceView
-
onClose
public void onClose(com.velocitypowered.api.proxy.Player player, CloseReason reason, ViewContext context) Description copied from interface:ViewCalled exactly once when the view stops being shown, with the reason and the per-open context.
-