Record Class ShopItem
java.lang.Object
java.lang.Record
fr.mathildeuh.youneedme.api.shop.ShopItem
public record ShopItem(String id, org.bukkit.inventory.ItemStack display, @Nullable Double buyPrice, @Nullable Double sellPrice, @Nullable Integer stock)
extends Record
One shop entry.
buyPrice/sellPrice of null disables that direction (an
item that can only be sold to the shop, or only bought from it). stock of null
means unlimited.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription@Nullable DoublebuyPrice()Returns the value of thebuyPricerecord component.org.bukkit.inventory.ItemStackdisplay()Returns the value of thedisplayrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.id()Returns the value of theidrecord component.booleanboolean@Nullable DoubleReturns the value of thesellPricerecord component.@Nullable Integerstock()Returns the value of thestockrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
ShopItem
public ShopItem(String id, org.bukkit.inventory.ItemStack display, @Nullable @Nullable Double buyPrice, @Nullable @Nullable Double sellPrice, @Nullable @Nullable Integer stock) Creates an instance of aShopItemrecord class.- Parameters:
id- the value for theidrecord componentdisplay- the value for thedisplayrecord componentbuyPrice- the value for thebuyPricerecord componentsellPrice- the value for thesellPricerecord componentstock- the value for thestockrecord component
-
-
Method Details
-
isBuyable
public boolean isBuyable() -
isSellable
public boolean isSellable() -
toString
-
hashCode
-
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. All components in this record class are compared withObjects::equals(Object,Object). -
id
Returns the value of theidrecord component.- Returns:
- the value of the
idrecord component
-
display
public org.bukkit.inventory.ItemStack display()Returns the value of thedisplayrecord component.- Returns:
- the value of the
displayrecord component
-
buyPrice
Returns the value of thebuyPricerecord component.- Returns:
- the value of the
buyPricerecord component
-
sellPrice
Returns the value of thesellPricerecord component.- Returns:
- the value of the
sellPricerecord component
-
stock
Returns the value of thestockrecord component.- Returns:
- the value of the
stockrecord component
-