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
    Constructor
    Description
    ShopItem(String id, org.bukkit.inventory.ItemStack display, @Nullable Double buyPrice, @Nullable Double sellPrice, @Nullable Integer stock)
    Creates an instance of a ShopItem record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    @Nullable Double
    Returns the value of the buyPrice record component.
    org.bukkit.inventory.ItemStack
    Returns the value of the display record component.
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    id()
    Returns the value of the id record component.
    boolean
     
    boolean
     
    @Nullable Double
    Returns the value of the sellPrice record component.
    @Nullable Integer
    Returns the value of the stock record component.
    final String
    Returns a string representation of this record class.

    Methods inherited from class Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • 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 a ShopItem record class.
      Parameters:
      id - the value for the id record component
      display - the value for the display record component
      buyPrice - the value for the buyPrice record component
      sellPrice - the value for the sellPrice record component
      stock - the value for the stock record component
  • Method Details

    • isBuyable

      public boolean isBuyable()
    • isSellable

      public boolean isSellable()
    • toString

      public final String 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.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • 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.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • id

      public String id()
      Returns the value of the id record component.
      Returns:
      the value of the id record component
    • display

      public org.bukkit.inventory.ItemStack display()
      Returns the value of the display record component.
      Returns:
      the value of the display record component
    • buyPrice

      @Nullable public @Nullable Double buyPrice()
      Returns the value of the buyPrice record component.
      Returns:
      the value of the buyPrice record component
    • sellPrice

      @Nullable public @Nullable Double sellPrice()
      Returns the value of the sellPrice record component.
      Returns:
      the value of the sellPrice record component
    • stock

      @Nullable public @Nullable Integer stock()
      Returns the value of the stock record component.
      Returns:
      the value of the stock record component