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 Type
    Method
    Description
    void
    Registers a global listener observing all views.
    boolean
    back(com.velocitypowered.api.proxy.Player player)
    Returns to the player's previous view, if any.
    void
    close(com.velocitypowered.api.proxy.Player player)
    Closes the player's current view (fires CloseReason.SERVER).
    void
    Closes every open view on the proxy.
    currentContents(com.velocitypowered.api.proxy.Player player)
    The live contents of the player's open view, or null.
    currentContext(com.velocitypowered.api.proxy.Player player)
    The player's current view context, or null.
    currentView(com.velocitypowered.api.proxy.Player player)
    The player's open view, or null.
    boolean
    isViewing(com.velocitypowered.api.proxy.Player player)
    Whether the player has a proxy view open.
    void
    open(com.velocitypowered.api.proxy.Player player, View view)
    Opens a view.
    void
    open(com.velocitypowered.api.proxy.Player player, View view, Consumer<ViewContext> contextBuilder)
    Opens a view, configuring a fresh context first.
    void
    open(com.velocitypowered.api.proxy.Player player, View view, ViewContext context)
    Opens a view with a pre-populated context.
    void
    openReplacing(com.velocitypowered.api.proxy.Player player, View view)
    Opens a view without pushing the currently open view onto the back-history.
    void
    openReplacing(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.
    void
    Removes a previously registered global listener.
  • Method Details

    • open

      void open(com.velocitypowered.api.proxy.Player player, View view)
      Opens a view. If another proxy view is open it is pushed onto the player's back-history (see back(Player)).
    • open

      void open(com.velocitypowered.api.proxy.Player player, View view, ViewContext context)
      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

      void openReplacing(com.velocitypowered.api.proxy.Player player, View view)
      Opens a view without pushing the currently open view onto the back-history.
    • openReplacing

      void openReplacing(com.velocitypowered.api.proxy.Player player, View view, ViewContext context)
      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:
      true if a previous view was reopened
    • close

      void close(com.velocitypowered.api.proxy.Player player)
      Closes the player's current view (fires CloseReason.SERVER).
    • closeAll

      void closeAll()
      Closes every open view on the proxy.
    • currentView

      View currentView(com.velocitypowered.api.proxy.Player player)
      The player's open view, or null.
    • currentContext

      ViewContext currentContext(com.velocitypowered.api.proxy.Player player)
      The player's current view context, or null.
    • currentContents

      ViewContents currentContents(com.velocitypowered.api.proxy.Player player)
      The live contents of the player's open view, or null.
    • 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 with null if 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

      void addListener(VGuiListener listener)
      Registers a global listener observing all views.
    • removeListener

      void removeListener(VGuiListener listener)
      Removes a previously registered global listener.