Record Class AuctionListing
java.lang.Object
java.lang.Record
fr.mathildeuh.youneedme.api.auctionhouse.AuctionListing
public record AuctionListing(long id, UUID seller, String sellerLastKnownUsername, org.bukkit.inventory.ItemStack item, double price, long listedAt, long expiresAt, AuctionListing.Status status, @Nullable UUID buyer, boolean auction, @Nullable Double currentBid, @Nullable UUID currentBidder, @Nullable String currentBidderUsername)
extends Record
A single listing, either fixed-price or an auction. For an auction listing (
auction ==
true), price is the starting/minimum bid and currentBid/currentBidder
track the highest bid so far (both null until the first bid). A fixed-price listing never touches
those three fields.-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionAuctionListing(long id, UUID seller, String sellerLastKnownUsername, org.bukkit.inventory.ItemStack item, double price, long listedAt, long expiresAt, AuctionListing.Status status, @Nullable UUID buyer, boolean auction, @Nullable Double currentBid, @Nullable UUID currentBidder, @Nullable String currentBidderUsername) Creates an instance of aAuctionListingrecord class. -
Method Summary
Modifier and TypeMethodDescriptionbooleanauction()Returns the value of theauctionrecord component.@Nullable UUIDbuyer()Returns the value of thebuyerrecord component.@Nullable DoubleReturns the value of thecurrentBidrecord component.@Nullable UUIDReturns the value of thecurrentBidderrecord component.@Nullable StringReturns the value of thecurrentBidderUsernamerecord component.doubleThe price a buyer would pay right now: the current bid if any, else the starting price.final booleanIndicates whether some other object is "equal to" this one.longReturns the value of theexpiresAtrecord component.final inthashCode()Returns a hash code value for this object.longid()Returns the value of theidrecord component.booleanisActive()org.bukkit.inventory.ItemStackitem()Returns the value of theitemrecord component.longlistedAt()Returns the value of thelistedAtrecord component.doubleprice()Returns the value of thepricerecord component.seller()Returns the value of thesellerrecord component.Returns the value of thesellerLastKnownUsernamerecord component.status()Returns the value of thestatusrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
AuctionListing
public AuctionListing(long id, UUID seller, String sellerLastKnownUsername, org.bukkit.inventory.ItemStack item, double price, long listedAt, long expiresAt, AuctionListing.Status status, @Nullable @Nullable UUID buyer, boolean auction, @Nullable @Nullable Double currentBid, @Nullable @Nullable UUID currentBidder, @Nullable @Nullable String currentBidderUsername) Creates an instance of aAuctionListingrecord class.- Parameters:
id- the value for theidrecord componentseller- the value for thesellerrecord componentsellerLastKnownUsername- the value for thesellerLastKnownUsernamerecord componentitem- the value for theitemrecord componentprice- the value for thepricerecord componentlistedAt- the value for thelistedAtrecord componentexpiresAt- the value for theexpiresAtrecord componentstatus- the value for thestatusrecord componentbuyer- the value for thebuyerrecord componentauction- the value for theauctionrecord componentcurrentBid- the value for thecurrentBidrecord componentcurrentBidder- the value for thecurrentBidderrecord componentcurrentBidderUsername- the value for thecurrentBidderUsernamerecord component
-
-
Method Details
-
isActive
public boolean isActive() -
effectivePrice
public double effectivePrice()The price a buyer would pay right now: the current bid if any, else the starting price. -
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
-
seller
Returns the value of thesellerrecord component.- Returns:
- the value of the
sellerrecord component
-
sellerLastKnownUsername
Returns the value of thesellerLastKnownUsernamerecord component.- Returns:
- the value of the
sellerLastKnownUsernamerecord component
-
item
public org.bukkit.inventory.ItemStack item()Returns the value of theitemrecord component.- Returns:
- the value of the
itemrecord component
-
price
public double price()Returns the value of thepricerecord component.- Returns:
- the value of the
pricerecord component
-
listedAt
public long listedAt()Returns the value of thelistedAtrecord component.- Returns:
- the value of the
listedAtrecord component
-
expiresAt
public long expiresAt()Returns the value of theexpiresAtrecord component.- Returns:
- the value of the
expiresAtrecord component
-
status
Returns the value of thestatusrecord component.- Returns:
- the value of the
statusrecord component
-
buyer
Returns the value of thebuyerrecord component.- Returns:
- the value of the
buyerrecord component
-
auction
public boolean auction()Returns the value of theauctionrecord component.- Returns:
- the value of the
auctionrecord component
-
currentBid
Returns the value of thecurrentBidrecord component.- Returns:
- the value of the
currentBidrecord component
-
currentBidder
Returns the value of thecurrentBidderrecord component.- Returns:
- the value of the
currentBidderrecord component
-
currentBidderUsername
Returns the value of thecurrentBidderUsernamerecord component.- Returns:
- the value of the
currentBidderUsernamerecord component
-