Class VGui
java.lang.Object
me.agent.vgui.api.VGui
Static entry point to VGui. The instance is installed by the platform bootstrap
(
VGuiPlatform when running as a plugin, or VGuiBootstrap when shaded
as a library) during proxy initialization.
View shop = VGui.chest(3)
.title(Component.text("Shop"))
.layout("#########",
"#..a.b..#",
"####c####")
.map('#', ViewItem.of(filler))
.map('a', ViewItem.clickable(sword, click -> buySword(click.player())))
.map('c', ViewItem.closeButton(barrier))
.build();
VGui.open(player, shop);
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddListener(VGuiListener listener) static booleanback(com.velocitypowered.api.proxy.Player player) static ViewBuilderchest(int rows) Starts building a chest view with the given number of rows (1-6).static voidclose(com.velocitypowered.api.proxy.Player player) static ViewContentscurrentContents(com.velocitypowered.api.proxy.Player player) static ViewContextcurrentContext(com.velocitypowered.api.proxy.Player player) static ViewcurrentView(com.velocitypowered.api.proxy.Player player) static VGuiServiceget()The service instance.static booleanWhether the service is initialized and ready.static booleanisViewing(com.velocitypowered.api.proxy.Player player) static voidstatic voidopen(com.velocitypowered.api.proxy.Player player, View view, Consumer<ViewContext> contextBuilder) static voidopen(com.velocitypowered.api.proxy.Player player, View view, ViewContext context) static voidopenReplacing(com.velocitypowered.api.proxy.Player player, View view) static CompletableFuture<String> prompt(com.velocitypowered.api.proxy.Player player, net.kyori.adventure.text.Component title) static CompletableFuture<String> prompt(com.velocitypowered.api.proxy.Player player, net.kyori.adventure.text.Component title, String initialText) static voidremoveListener(VGuiListener listener) static voidsetInstance(VGuiService service) Installs the service instance.static ViewBuilderStarts building a view of the given type.
-
Method Details
-
get
The service instance.- Throws:
IllegalStateException- if VGui has not initialized yet. Declare a dependency onvguiso it loads first.
-
setInstance
Installs the service instance. Called by the platform bootstrap; do not call yourself. -
isInitialized
public static boolean isInitialized()Whether the service is initialized and ready. -
chest
Starts building a chest view with the given number of rows (1-6). -
view
Starts building a view of the given type. -
open
- See Also:
-
open
public static void open(com.velocitypowered.api.proxy.Player player, View view, ViewContext context) - See Also:
-
open
public static void open(com.velocitypowered.api.proxy.Player player, View view, Consumer<ViewContext> contextBuilder) - See Also:
-
openReplacing
- See Also:
-
back
public static boolean back(com.velocitypowered.api.proxy.Player player) - See Also:
-
close
public static void close(com.velocitypowered.api.proxy.Player player) - See Also:
-
currentView
- See Also:
-
currentContext
- See Also:
-
currentContents
- See Also:
-
isViewing
public static boolean isViewing(com.velocitypowered.api.proxy.Player player) - See Also:
-
prompt
public static CompletableFuture<String> prompt(com.velocitypowered.api.proxy.Player player, net.kyori.adventure.text.Component title) - See Also:
-
prompt
public static CompletableFuture<String> prompt(com.velocitypowered.api.proxy.Player player, net.kyori.adventure.text.Component title, String initialText) - See Also:
-
addListener
- See Also:
-
removeListener
- See Also:
-