Record Class MenuItemSnapshot
java.lang.Object
java.lang.Record
nl.pim16aap2.lightkeeper.framework.MenuItemSnapshot
- Record Components:
slot- Raw slot index.materialKey- Material key.displayName- Optional display name.lore- Lore lines.
public record MenuItemSnapshot(int slot, String materialKey, String displayName, List<String> lore)
extends Record
Menu item snapshot.
-
Constructor Summary
ConstructorsConstructorDescriptionMenuItemSnapshot(int slot, String materialKey, String displayName, List<String> lore) Copies lore and normalizes material keys and absent display names. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of thedisplayNamerecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.lore()Returns the value of thelorerecord component.booleanmatches(org.bukkit.inventory.ItemStack expected) Compares only material, display name and ordered lore, excluding unobserved metadata and amount.booleanmatchesMaterial(@Nullable String expected) Compares normalized material keys.Returns the value of thematerialKeyrecord component.intslot()Returns the value of theslotrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
MenuItemSnapshot
Copies lore and normalizes material keys and absent display names.
-
-
Method Details
-
matchesMaterial
Compares normalized material keys.- Parameters:
expected- Material name or namespaced key.- Returns:
- Whether the materials match.
-
matches
public boolean matches(org.bukkit.inventory.ItemStack expected) Compares only material, display name and ordered lore, excluding unobserved metadata and amount.- Parameters:
expected- Expected Bukkit item.- Returns:
- Whether all represented fields match.
-
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 '=='. -
slot
public int slot()Returns the value of theslotrecord component.- Returns:
- the value of the
slotrecord component
-
materialKey
Returns the value of thematerialKeyrecord component.- Returns:
- the value of the
materialKeyrecord component
-
displayName
Returns the value of thedisplayNamerecord component.- Returns:
- the value of the
displayNamerecord component
-
lore
Returns the value of thelorerecord component.- Returns:
- the value of the
lorerecord component
-