Interface VGuiService
- All Known Implementing Classes:
VGuiServiceImpl
public interface VGuiService
The VGui service: open/close views, query sessions, register global listeners.
Obtain via
VGui.get().-
Method Summary
Modifier and TypeMethodDescriptionvoidaddListener(VGuiListener listener) Registers a global listener observing all views.booleanback(com.velocitypowered.api.proxy.Player player) Returns to the player's previous view, if any.voidclose(com.velocitypowered.api.proxy.Player player) Closes the player's current view (firesCloseReason.SERVER).voidcloseAll()Closes every open view on the proxy.currentContents(com.velocitypowered.api.proxy.Player player) The live contents of the player's open view, ornull.currentContext(com.velocitypowered.api.proxy.Player player) The player's current view context, ornull.currentView(com.velocitypowered.api.proxy.Player player) The player's open view, ornull.booleanisViewing(com.velocitypowered.api.proxy.Player player) Whether the player has a proxy view open.voidOpens a view.voidopen(com.velocitypowered.api.proxy.Player player, View view, Consumer<ViewContext> contextBuilder) Opens a view, configuring a fresh context first.voidopen(com.velocitypowered.api.proxy.Player player, View view, ViewContext context) Opens a view with a pre-populated context.voidopenReplacing(com.velocitypowered.api.proxy.Player player, View view) Opens a view without pushing the currently open view onto the back-history.voidopenReplacing(com.velocitypowered.api.proxy.Player player, View view, ViewContext context) Opens a view without pushing history, with a pre-populated context.prompt(com.velocitypowered.api.proxy.Player player, net.kyori.adventure.text.Component title) Opens an anvil text prompt.prompt(com.velocitypowered.api.proxy.Player player, net.kyori.adventure.text.Component title, String initialText) Opens an anvil text prompt with pre-filled initial text.voidremoveListener(VGuiListener listener) Removes a previously registered global listener.
-
Method Details
-
open
Opens a view. If another proxy view is open it is pushed onto the player's back-history (seeback(Player)). -
open
Opens a view with a pre-populated context. -
open
void open(com.velocitypowered.api.proxy.Player player, View view, Consumer<ViewContext> contextBuilder) Opens a view, configuring a fresh context first. -
openReplacing
Opens a view without pushing the currently open view onto the back-history. -
openReplacing
Opens a view without pushing history, with a pre-populated context. -
back
boolean back(com.velocitypowered.api.proxy.Player player) Returns to the player's previous view, if any.- Returns:
trueif a previous view was reopened
-
close
void close(com.velocitypowered.api.proxy.Player player) Closes the player's current view (firesCloseReason.SERVER). -
closeAll
void closeAll()Closes every open view on the proxy. -
currentView
The player's open view, ornull. -
currentContext
The player's current view context, ornull. -
currentContents
The live contents of the player's open view, ornull. -
isViewing
boolean isViewing(com.velocitypowered.api.proxy.Player player) Whether the player has a proxy view open. -
prompt
CompletableFuture<String> prompt(com.velocitypowered.api.proxy.Player player, net.kyori.adventure.text.Component title) Opens an anvil text prompt. The future completes with the entered text when the player confirms, or withnullif the prompt closes, is replaced, or cannot be opened. -
prompt
CompletableFuture<String> prompt(com.velocitypowered.api.proxy.Player player, net.kyori.adventure.text.Component title, String initialText) Opens an anvil text prompt with pre-filled initial text. -
addListener
Registers a global listener observing all views. -
removeListener
Removes a previously registered global listener.
-