Class VGuiServiceImpl

java.lang.Object
me.agent.vgui.core.internal.VGuiServiceImpl
All Implemented Interfaces:
VGuiService

public final class VGuiServiceImpl extends Object implements VGuiService
  • Constructor Summary

    Constructors
    Constructor
    Description
    VGuiServiceImpl(SessionManager sessionManager, org.slf4j.Logger logger)
     
  • 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.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • VGuiServiceImpl

      public VGuiServiceImpl(SessionManager sessionManager, org.slf4j.Logger logger)
  • Method Details

    • open

      public void open(com.velocitypowered.api.proxy.Player player, View view)
      Description copied from interface: VGuiService
      Opens a view. If another proxy view is open it is pushed onto the player's back-history (see VGuiService.back(Player)).
      Specified by:
      open in interface VGuiService
    • open

      public void open(com.velocitypowered.api.proxy.Player player, View view, ViewContext context)
      Description copied from interface: VGuiService
      Opens a view with a pre-populated context.
      Specified by:
      open in interface VGuiService
    • open

      public void open(com.velocitypowered.api.proxy.Player player, View view, Consumer<ViewContext> contextBuilder)
      Description copied from interface: VGuiService
      Opens a view, configuring a fresh context first.
      Specified by:
      open in interface VGuiService
    • openReplacing

      public void openReplacing(com.velocitypowered.api.proxy.Player player, View view)
      Description copied from interface: VGuiService
      Opens a view without pushing the currently open view onto the back-history.
      Specified by:
      openReplacing in interface VGuiService
    • openReplacing

      public void openReplacing(com.velocitypowered.api.proxy.Player player, View view, ViewContext context)
      Description copied from interface: VGuiService
      Opens a view without pushing history, with a pre-populated context.
      Specified by:
      openReplacing in interface VGuiService
    • back

      public boolean back(com.velocitypowered.api.proxy.Player player)
      Description copied from interface: VGuiService
      Returns to the player's previous view, if any.
      Specified by:
      back in interface VGuiService
      Returns:
      true if a previous view was reopened
    • close

      public void close(com.velocitypowered.api.proxy.Player player)
      Description copied from interface: VGuiService
      Closes the player's current view (fires CloseReason.SERVER).
      Specified by:
      close in interface VGuiService
    • closeAll

      public void closeAll()
      Description copied from interface: VGuiService
      Closes every open view on the proxy.
      Specified by:
      closeAll in interface VGuiService
    • currentView

      public View currentView(com.velocitypowered.api.proxy.Player player)
      Description copied from interface: VGuiService
      The player's open view, or null.
      Specified by:
      currentView in interface VGuiService
    • currentContext

      public ViewContext currentContext(com.velocitypowered.api.proxy.Player player)
      Description copied from interface: VGuiService
      The player's current view context, or null.
      Specified by:
      currentContext in interface VGuiService
    • currentContents

      public ViewContents currentContents(com.velocitypowered.api.proxy.Player player)
      Description copied from interface: VGuiService
      The live contents of the player's open view, or null.
      Specified by:
      currentContents in interface VGuiService
    • isViewing

      public boolean isViewing(com.velocitypowered.api.proxy.Player player)
      Description copied from interface: VGuiService
      Whether the player has a proxy view open.
      Specified by:
      isViewing in interface VGuiService
    • prompt

      public CompletableFuture<String> prompt(com.velocitypowered.api.proxy.Player player, net.kyori.adventure.text.Component title)
      Description copied from interface: VGuiService
      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.
      Specified by:
      prompt in interface VGuiService
    • prompt

      public CompletableFuture<String> prompt(com.velocitypowered.api.proxy.Player player, net.kyori.adventure.text.Component title, String initialText)
      Description copied from interface: VGuiService
      Opens an anvil text prompt with pre-filled initial text.
      Specified by:
      prompt in interface VGuiService
    • addListener

      public void addListener(VGuiListener listener)
      Description copied from interface: VGuiService
      Registers a global listener observing all views.
      Specified by:
      addListener in interface VGuiService
    • removeListener

      public void removeListener(VGuiListener listener)
      Description copied from interface: VGuiService
      Removes a previously registered global listener.
      Specified by:
      removeListener in interface VGuiService