Class VGuiBootstrap
java.lang.Object
me.agent.vgui.core.VGuiBootstrap
Wires VGui into a running proxy. Used two ways:
- Standalone plugin:
VGuiPlatformcalls this for you. Drop the jar in the plugins folder and depend on plugin idvgui. - Shaded library: shade VGui into your own plugin, then call
loadPacketEvents(ProxyServer, PluginContainer, Logger, Path)from your plugin constructor andinit(ProxyServer, Object, Logger, boolean)from yourProxyInitializeEventhandler, andshutdownonProxyShutdownEvent.
A shaded integration can share PacketEvents when it deliberately uses the same API classes and class loader. The standalone release embeds the runtime it manages.
-
Method Summary
Modifier and TypeMethodDescriptionstatic VGuiBootstrapinit(com.velocitypowered.api.proxy.ProxyServer server, Object pluginInstance, org.slf4j.Logger logger, boolean managePacketEvents) Initializes VGui: PacketEvents listeners, session manager, disconnect cleanup and theVGuiservice singleton.static VGuiBootstrapinstance()The active bootstrap, ornullbeforeinit(ProxyServer, Object, Logger, boolean).static booleanloadPacketEvents(com.velocitypowered.api.proxy.ProxyServer server, com.velocitypowered.api.plugin.PluginContainer container, org.slf4j.Logger logger, Path dataDirectory) Builds and loads the PacketEvents API if no other plugin has installed it yet.The session manager (internal API, exposed for the platform plugin).voidshutdown()Closes all views and (if VGui owns it) terminates PacketEvents.
-
Method Details
-
instance
The active bootstrap, ornullbeforeinit(ProxyServer, Object, Logger, boolean). -
loadPacketEvents
public static boolean loadPacketEvents(com.velocitypowered.api.proxy.ProxyServer server, com.velocitypowered.api.plugin.PluginContainer container, org.slf4j.Logger logger, Path dataDirectory) Builds and loads the PacketEvents API if no other plugin has installed it yet. Call from your plugin constructor (before the proxy initializes). Safe to call when PacketEvents is already present.- Returns:
trueif this call installed PacketEvents (VGui then owns its lifecycle and will terminate it on shutdown)
-
init
public static VGuiBootstrap init(com.velocitypowered.api.proxy.ProxyServer server, Object pluginInstance, org.slf4j.Logger logger, boolean managePacketEvents) Initializes VGui: PacketEvents listeners, session manager, disconnect cleanup and theVGuiservice singleton. Call once fromProxyInitializeEvent.- Parameters:
server- the proxypluginInstance- your plugin main-class instance (used to register Velocity events and scheduler tasks)logger- logger for VGui diagnosticsmanagePacketEvents- whether VGui owns the PacketEvents lifecycle (pass the result ofloadPacketEvents(ProxyServer, PluginContainer, Logger, Path))
-
sessionManager
The session manager (internal API, exposed for the platform plugin). -
shutdown
public void shutdown()Closes all views and (if VGui owns it) terminates PacketEvents.
-