Record Class MenuView
java.lang.Object
java.lang.Record
dev.itsharshxd.zentrix.api.gui.background.MenuView
- Record Components:
- the menu's ID inguis.yml, such asparty.membersname- the menu's own name: its title without the texturerows- the menu's size in rowselements- every visible element, in the order placed, mapped to the state it is drawn in; an element without states maps to an empty stringentries- how many entries each content list the menu reported holds, across all pagespage- the page on screen, counting from 1pages- how many pages there are, at least 1view- the view the menu reports, such asno-party; empty for a menu with onebackground- what the background decided, or null while conditions are being tested and for a menu whose texture Zentrix does not decide: one without rules inguis.ymlthat no resolver covers
public record MenuView(@NotNull String menuId, @NotNull String name, int rows, @NotNull Map<String,String> elements, @NotNull Map<String,Integer> entries, int page, int pages, @NotNull String view, @Nullable MenuBackgroundResult background)
extends Record
What one open Zentrix menu shows, as its background rules see it.
Zentrix records this while the menu places its buttons: every element placed through the
menu's guis.yml layout counts as shown, in the state it was drawn in. It is the same
record the shown, state, entries, page and view
conditions are tested against, and what /zx gui debug prints.
A view is a snapshot: it does not follow the menu after it was taken.
- Since:
- 1.15.0
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription@Nullable MenuBackgroundResultReturns the value of thebackgroundrecord component.@NotNull Optional<MenuBackgroundResult> What the background decided, when it decided anything.elements()Returns the value of theelementsrecord component.entries()Returns the value of theentriesrecord component.@NotNull OptionalIntHow many entries the menu's main list holds: the list named "entries", or else the only list the menu reported.@NotNull OptionalIntentryCount(@NotNull String listId) How many entries one content list holds across all its pages.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.booleanisPaged()Whether the menu has a page before this one or after it.booleanWhether an element is visible, ignoring case.@NotNull StringmenuId()Returns the value of themenuIdrecord component.@NotNull Stringname()Returns the value of thenamerecord component.intpage()Returns the value of thepagerecord component.intpages()Returns the value of thepagesrecord component.introws()Returns the value of therowsrecord component.The state a visible element is drawn in, ignoring case.final StringtoString()Returns a string representation of this record class.@NotNull Stringview()Returns the value of theviewrecord component.
-
Field Details
-
MAIN_LIST
The content list a menu with several lists calls its main one.- See Also:
-
-
Constructor Details
-
MenuView
public MenuView(@NotNull @NotNull String menuId, @NotNull @NotNull String name, int rows, @NotNull @NotNull Map<String, String> elements, @NotNull @NotNull Map<String, Integer> entries, int page, int pages, @NotNull @NotNull String view, @Nullable @Nullable MenuBackgroundResult background) Creates an instance of aMenuViewrecord class.- Parameters:
menuId- the value for themenuIdrecord componentname- the value for thenamerecord componentrows- the value for therowsrecord componentelements- the value for theelementsrecord componententries- the value for theentriesrecord componentpage- the value for thepagerecord componentpages- the value for thepagesrecord componentview- the value for theviewrecord componentbackground- the value for thebackgroundrecord component
-
-
Method Details
-
isShown
Whether an element is visible, ignoring case. -
state
The state a visible element is drawn in, ignoring case.- Returns:
- the state, an empty string for an element without states, or empty when the element is not visible
-
entryCount
How many entries one content list holds across all its pages.- Returns:
- the count, or empty when the menu did not report that list
-
entryCount
How many entries the menu's main list holds: the list named "entries", or else the only list the menu reported.- Returns:
- the count, or empty when there is no such list
-
isPaged
public boolean isPaged()Whether the menu has a page before this one or after it. -
backgroundResult
What the background decided, when it decided anything. -
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
name
Returns the value of thenamerecord component.- Returns:
- the value of the
namerecord component
-
rows
public int rows()Returns the value of therowsrecord component.- Returns:
- the value of the
rowsrecord component
-
elements
Returns the value of theelementsrecord component.- Returns:
- the value of the
elementsrecord component
-
entries
Returns the value of theentriesrecord component.- Returns:
- the value of the
entriesrecord component
-
page
public int page()Returns the value of thepagerecord component.- Returns:
- the value of the
pagerecord component
-
pages
public int pages()Returns the value of thepagesrecord component.- Returns:
- the value of the
pagesrecord component
-
view
Returns the value of theviewrecord component.- Returns:
- the value of the
viewrecord component
-
background
Returns the value of thebackgroundrecord component.- Returns:
- the value of the
backgroundrecord component
-