Package de.Keyle.MyPet.api.gui
Record Class MenuDefinition
java.lang.Object
java.lang.Record
de.Keyle.MyPet.api.gui.MenuDefinition
- Record Components:
- identifies the menu this was loaded fortitleMiniMessage- the window title, in MiniMessage form, before placeholdersrows- inventory height, from 1 to 6escSupportsBack- whether ESC pops back a level instead of closing outrightsoundOnOpen- played as the menu openssoundOnClose- played as the menu closessoundOnBack- played when popping back, ornullto reusesoundOnClosesections- the menu's sections, keyed by section id
public record MenuDefinition(String menuId, String titleMiniMessage, int rows, boolean escSupportsBack, SoundSpec soundOnOpen, SoundSpec soundOnClose, @Nullable SoundSpec soundOnBack, Map<String,Section> sections)
extends Record
Immutable resolved blueprint for one menu. Produced by the loader after
deep-merging the bundled and overlay JSON. The renderer walks this to produce
the live inventory.
-
Constructor Summary
ConstructorsConstructorDescriptionMenuDefinition(String menuId, String titleMiniMessage, int rows, boolean escSupportsBack, SoundSpec soundOnOpen, SoundSpec soundOnClose, @Nullable SoundSpec soundOnBack, Map<String, Section> sections) Rejects an out-of-range row count or absent title, and substitutes silence for absent sounds. -
Method Summary
Modifier and TypeMethodDescriptionEffective sound when popping back: explicitsoundOnBackorsoundOnClose.final booleanIndicates whether some other object is "equal to" this one.booleanReturns the value of theescSupportsBackrecord component.final inthashCode()Returns a hash code value for this object.menuId()Returns the value of themenuIdrecord component.introws()Returns the value of therowsrecord component.sections()Returns the value of thesectionsrecord component.intReturns how many slots this menu has.@Nullable SoundSpecReturns the value of thesoundOnBackrecord component.Returns the value of thesoundOnCloserecord component.Returns the value of thesoundOnOpenrecord component.Returns the value of thetitleMiniMessagerecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
MenuDefinition
public MenuDefinition(String menuId, String titleMiniMessage, int rows, boolean escSupportsBack, SoundSpec soundOnOpen, SoundSpec soundOnClose, @Nullable @Nullable SoundSpec soundOnBack, Map<String, Section> sections) Rejects an out-of-range row count or absent title, and substitutes silence for absent sounds.
-
-
Method Details
-
effectiveSoundOnBack
Effective sound when popping back: explicitsoundOnBackorsoundOnClose.- Returns:
soundOnBackwhen set, otherwisesoundOnClose
-
slotCount
public int slotCount()Returns how many slots this menu has.- Returns:
rows * 9
-
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 '=='. -
titleMiniMessage
Returns the value of thetitleMiniMessagerecord component.- Returns:
- the value of the
titleMiniMessagerecord component
-
rows
public int rows()Returns the value of therowsrecord component.- Returns:
- the value of the
rowsrecord component
-
escSupportsBack
public boolean escSupportsBack()Returns the value of theescSupportsBackrecord component.- Returns:
- the value of the
escSupportsBackrecord component
-
soundOnOpen
Returns the value of thesoundOnOpenrecord component.- Returns:
- the value of the
soundOnOpenrecord component
-
soundOnClose
Returns the value of thesoundOnCloserecord component.- Returns:
- the value of the
soundOnCloserecord component
-
soundOnBack
Returns the value of thesoundOnBackrecord component.- Returns:
- the value of the
soundOnBackrecord component
-
sections
Returns the value of thesectionsrecord component.- Returns:
- the value of the
sectionsrecord component
-