Class DefaultViewContents
java.lang.Object
me.agent.vgui.core.internal.DefaultViewContents
- All Implemented Interfaces:
ViewContents
Live contents backing one
ViewSession. Mutations send minimal packets
unless batching, and become no-ops once the session closes.-
Method Summary
Modifier and TypeMethodDescriptionvoidapplyLayout(Layout layout) Applies aLayout: every mapped character is written to its slots.booleanback()Returns to the previous view in the player's history, if any.voidbatch(Consumer<ViewContents> mutations) Runs bulk mutations without sending per-slot packets, then pushes one full refresh at the end.voidclear()Clears every slot.voidclose()Closes this view.context()The per-open key/value context (survives view switches via history).voidFills every slot with the item.voidfillBorder(ViewItem item) Fills the outer border (first/last row and first/last column).voidfillColumn(int column, ViewItem item) Fills one column (zero-based).voidFills only slots that are currently empty.voidFills the rectangle from (rowFrom, columnFrom) to (rowTo, columnTo), both inclusive.voidFills one row (zero-based).get(int slot) The item currently at a flat slot index, ornullif empty.get(int row, int column) The item currently at a row/column position, ornullif empty.booleanisOpen()Whether this view is still open for the player.voidOpens another view, pushing the current one onto the player's back-history.voidopenReplacing(View view) Opens another view without pushing the current one onto the back-history.The pagination helper for this view (lazily created, one per open view).com.velocitypowered.api.proxy.Playerplayer()The player viewing this GUI.voidrefresh()Re-sends the full window contents to the client.voidremove(int slot) Clears one slot.schedule(Duration interval, Consumer<ViewContents> task) Schedules a repeating task on the proxy scheduler, cancelled automatically when this view closes or the player switches views.voidSets or replaces the item at a row/column position.voidSets or replaces the item at a flat slot index.voidSets or replaces the item at aSlotposition.intsize()Number of slots in the top (GUI) inventory.voidtitle(net.kyori.adventure.text.Component title) Changes the window title in place (re-opens the same window id client-side).type()The window type.view()The view definition these contents belong to.
-
Method Details
-
player
public com.velocitypowered.api.proxy.Player player()Description copied from interface:ViewContentsThe player viewing this GUI.- Specified by:
playerin interfaceViewContents
-
view
Description copied from interface:ViewContentsThe view definition these contents belong to.- Specified by:
viewin interfaceViewContents
-
type
Description copied from interface:ViewContentsThe window type.- Specified by:
typein interfaceViewContents
-
size
public int size()Description copied from interface:ViewContentsNumber of slots in the top (GUI) inventory.- Specified by:
sizein interfaceViewContents
-
context
Description copied from interface:ViewContentsThe per-open key/value context (survives view switches via history).- Specified by:
contextin interfaceViewContents
-
isOpen
public boolean isOpen()Description copied from interface:ViewContentsWhether this view is still open for the player.- Specified by:
isOpenin interfaceViewContents
-
set
Description copied from interface:ViewContentsSets or replaces the item at a flat slot index.nullclears the slot.- Specified by:
setin interfaceViewContents
-
set
Description copied from interface:ViewContentsSets or replaces the item at a row/column position.nullclears the slot.- Specified by:
setin interfaceViewContents
-
set
Description copied from interface:ViewContentsSets or replaces the item at aSlotposition.- Specified by:
setin interfaceViewContents
-
get
Description copied from interface:ViewContentsThe item currently at a flat slot index, ornullif empty.- Specified by:
getin interfaceViewContents
-
get
Description copied from interface:ViewContentsThe item currently at a row/column position, ornullif empty.- Specified by:
getin interfaceViewContents
-
remove
public void remove(int slot) Description copied from interface:ViewContentsClears one slot.- Specified by:
removein interfaceViewContents
-
fill
Description copied from interface:ViewContentsFills every slot with the item.- Specified by:
fillin interfaceViewContents
-
fillEmpty
Description copied from interface:ViewContentsFills only slots that are currently empty.- Specified by:
fillEmptyin interfaceViewContents
-
fillRow
Description copied from interface:ViewContentsFills one row (zero-based).- Specified by:
fillRowin interfaceViewContents
-
fillColumn
Description copied from interface:ViewContentsFills one column (zero-based).- Specified by:
fillColumnin interfaceViewContents
-
fillBorder
Description copied from interface:ViewContentsFills the outer border (first/last row and first/last column).- Specified by:
fillBorderin interfaceViewContents
-
fillRect
Description copied from interface:ViewContentsFills the rectangle from (rowFrom, columnFrom) to (rowTo, columnTo), both inclusive.- Specified by:
fillRectin interfaceViewContents
-
applyLayout
Description copied from interface:ViewContentsApplies aLayout: every mapped character is written to its slots.- Specified by:
applyLayoutin interfaceViewContents
-
clear
public void clear()Description copied from interface:ViewContentsClears every slot.- Specified by:
clearin interfaceViewContents
-
batch
Description copied from interface:ViewContentsRuns bulk mutations without sending per-slot packets, then pushes one full refresh at the end.- Specified by:
batchin interfaceViewContents
-
refresh
public void refresh()Description copied from interface:ViewContentsRe-sends the full window contents to the client.- Specified by:
refreshin interfaceViewContents
-
title
public void title(net.kyori.adventure.text.Component title) Description copied from interface:ViewContentsChanges the window title in place (re-opens the same window id client-side).- Specified by:
titlein interfaceViewContents
-
schedule
Description copied from interface:ViewContentsSchedules a repeating task on the proxy scheduler, cancelled automatically when this view closes or the player switches views.- Specified by:
schedulein interfaceViewContents- Parameters:
interval- time between runs (minimum 50ms)task- receives these contents on every run- Returns:
- a handle to cancel the task early
-
pagination
Description copied from interface:ViewContentsThe pagination helper for this view (lazily created, one per open view).- Specified by:
paginationin interfaceViewContents
-
close
public void close()Description copied from interface:ViewContentsCloses this view.- Specified by:
closein interfaceViewContents
-
open
Description copied from interface:ViewContentsOpens another view, pushing the current one onto the player's back-history.- Specified by:
openin interfaceViewContents
-
openReplacing
Description copied from interface:ViewContentsOpens another view without pushing the current one onto the back-history.- Specified by:
openReplacingin interfaceViewContents
-
back
public boolean back()Description copied from interface:ViewContentsReturns to the previous view in the player's history, if any.- Specified by:
backin interfaceViewContents
-