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 -
Method Summary
Modifier and TypeMethodDescription@Nullable DoublebuyPrice()Returns the value of thebuyPricerecord component.Returns the value of thechestLocationrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.longid()Returns the value of theidrecord component.booleanbooleanorg.bukkit.inventory.ItemStackitem()Returns the value of theitemrecord component.owner()Returns the value of theownerrecord component.Returns the value of theownerLastKnownUsernamerecord component.@Nullable DoubleReturns the value of thesellPricerecord component.Returns the value of thesignLocationrecord component.final StringtoString()Returns a string representation of this record class.
-
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 aPlayerShoprecord class.- Parameters:
id- the value for theidrecord componentowner- the value for theownerrecord componentownerLastKnownUsername- the value for theownerLastKnownUsernamerecord componentsignLocation- the value for thesignLocationrecord componentchestLocation- the value for thechestLocationrecord componentitem- the value for theitemrecord componentbuyPrice- the value for thebuyPricerecord componentsellPrice- the value for thesellPricerecord 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. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
id
public long id()Returns the value of theidrecord component.- Returns:
- the value of the
idrecord component
-
owner
Returns the value of theownerrecord component.- Returns:
- the value of the
ownerrecord component
-
ownerLastKnownUsername
Returns the value of theownerLastKnownUsernamerecord component.- Returns:
- the value of the
ownerLastKnownUsernamerecord component
-
signLocation
Returns the value of thesignLocationrecord component.- Returns:
- the value of the
signLocationrecord component
-
chestLocation
Returns the value of thechestLocationrecord component.- Returns:
- the value of the
chestLocationrecord component
-
item
public org.bukkit.inventory.ItemStack item()Returns the value of theitemrecord component.- Returns:
- the value of the
itemrecord 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
-