Interface View
- All Known Implementing Classes:
AnvilInputView, ChestView
public interface View
A server-controlled inventory screen rendered entirely at the proxy.
Implementations should be stateless and reusable across players: per-player state
lives in the ViewContents passed to onOpen(ViewContents) and the
ViewContext attached to it. Prefer building views with
VGui.chest(int) / ViewBuilder unless you need a class.
-
Method Summary
Modifier and TypeMethodDescriptiondefault booleanWhether client click transactions are cancelled so items can never be taken out of (or put into) the GUI.default longMinimum milliseconds between processed non-drag clicks per player.default voidonAnvilInput(String text, ViewContents contents) Called when the player types in an anvil rename field (only forViewType.ANVILviews), once per keystroke with the full current text.default voidonClick(ClickContext click) Called for every click inside the window (GUI half and player-inventory half).default voidonClose(com.velocitypowered.api.proxy.Player player, CloseReason reason, ViewContext context) Called exactly once when the view stops being shown, with the reason and the per-open context.default voidonOpen(ViewContents contents) Called right after the window opens (and again if the view is re-opened via back-navigation).net.kyori.adventure.text.Componenttitle()Title shown on the container.type()The window type (determines slot count and shape).
-
Method Details
-
title
net.kyori.adventure.text.Component title()Title shown on the container. -
type
ViewType type()The window type (determines slot count and shape). -
onOpen
Called right after the window opens (and again if the view is re-opened via back-navigation). Populatecontentshere; mutations made inside this callback are sent as one batch. -
onClick
Called for every click inside the window (GUI half and player-inventory half). Item-level handlers registered viaViewItem.clickable(ItemStack, Consumer)run before this. -
onClose
default void onClose(com.velocitypowered.api.proxy.Player player, CloseReason reason, ViewContext context) Called exactly once when the view stops being shown, with the reason and the per-open context. -
onAnvilInput
Called when the player types in an anvil rename field (only forViewType.ANVILviews), once per keystroke with the full current text. -
cancelClientTransactions
default boolean cancelClientTransactions()Whether client click transactions are cancelled so items can never be taken out of (or put into) the GUI. Defaulttrue; returnfalseonly if you know what you are doing. The proxy cannot apply inventory changes for you. -
clickCooldownMillis
default long clickCooldownMillis()Minimum milliseconds between processed non-drag clicks per player. Clicks arriving faster are cancelled and corrected without invoking handlers. Drag phases are never throttled so a configured cooldown cannot break quick-craft sequences. Return0to disable (the default).
-