Record Class PlayerShop

java.lang.Object
java.lang.Record
fr.mathildeuh.youneedme.api.playershop.PlayerShop

public record PlayerShop(long id, UUID owner, String ownerLastKnownUsername, Position signLocation, Position chestLocation, org.bukkit.inventory.ItemStack item, @Nullable Double buyPrice, @Nullable Double sellPrice) extends Record
A player-run shop: a sign (the trade point) attached to a chest (the stock). buyPrice is what a visitor pays to take one unit from the chest; sellPrice is what the owner pays a visitor to add one unit to it. Either may be null to disable that direction, but not both.
  • Constructor Summary

    Constructors
    Constructor
    Description
    PlayerShop(long id, UUID owner, String ownerLastKnownUsername, Position signLocation, Position chestLocation, org.bukkit.inventory.ItemStack item, @Nullable Double buyPrice, @Nullable Double sellPrice)
    Creates an instance of a PlayerShop record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    @Nullable Double
    Returns the value of the buyPrice record component.
    Returns the value of the chestLocation record component.
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    long
    id()
    Returns the value of the id record component.
    boolean
     
    boolean
     
    org.bukkit.inventory.ItemStack
    Returns the value of the item record component.
    Returns the value of the owner record component.
    Returns the value of the ownerLastKnownUsername record component.
    @Nullable Double
    Returns the value of the sellPrice record component.
    Returns the value of the signLocation 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

    • PlayerShop

      public PlayerShop(long id, UUID owner, String ownerLastKnownUsername, Position signLocation, Position chestLocation, org.bukkit.inventory.ItemStack item, @Nullable @Nullable Double buyPrice, @Nullable @Nullable Double sellPrice)
      Creates an instance of a PlayerShop record class.
      Parameters:
      id - the value for the id record component
      owner - the value for the owner record component
      ownerLastKnownUsername - the value for the ownerLastKnownUsername record component
      signLocation - the value for the signLocation record component
      chestLocation - the value for the chestLocation record component
      item - the value for the item record component
      buyPrice - the value for the buyPrice record component
      sellPrice - the value for the sellPrice 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. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      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 long id()
      Returns the value of the id record component.
      Returns:
      the value of the id record component
    • owner

      public UUID owner()
      Returns the value of the owner record component.
      Returns:
      the value of the owner record component
    • ownerLastKnownUsername

      public String ownerLastKnownUsername()
      Returns the value of the ownerLastKnownUsername record component.
      Returns:
      the value of the ownerLastKnownUsername record component
    • signLocation

      public Position signLocation()
      Returns the value of the signLocation record component.
      Returns:
      the value of the signLocation record component
    • chestLocation

      public Position chestLocation()
      Returns the value of the chestLocation record component.
      Returns:
      the value of the chestLocation record component
    • item

      public org.bukkit.inventory.ItemStack item()
      Returns the value of the item record component.
      Returns:
      the value of the item 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