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
    Modifier and Type
    Class
    Description
    static enum 
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    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)
    Creates an instance of a AuctionListing record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Returns the value of the auction record component.
    @Nullable UUID
    Returns the value of the buyer record component.
    @Nullable Double
    Returns the value of the currentBid record component.
    @Nullable UUID
    Returns the value of the currentBidder record component.
    @Nullable String
    Returns the value of the currentBidderUsername record component.
    double
    The price a buyer would pay right now: the current bid if any, else the starting price.
    final boolean
    Indicates whether some other object is "equal to" this one.
    long
    Returns the value of the expiresAt record component.
    final int
    Returns a hash code value for this object.
    long
    id()
    Returns the value of the id record component.
    boolean
     
    org.bukkit.inventory.ItemStack
    Returns the value of the item record component.
    long
    Returns the value of the listedAt record component.
    double
    Returns the value of the price record component.
    Returns the value of the seller record component.
    Returns the value of the sellerLastKnownUsername record component.
    Returns the value of the status 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

    • 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 a AuctionListing record class.
      Parameters:
      id - the value for the id record component
      seller - the value for the seller record component
      sellerLastKnownUsername - the value for the sellerLastKnownUsername record component
      item - the value for the item record component
      price - the value for the price record component
      listedAt - the value for the listedAt record component
      expiresAt - the value for the expiresAt record component
      status - the value for the status record component
      buyer - the value for the buyer record component
      auction - the value for the auction record component
      currentBid - the value for the currentBid record component
      currentBidder - the value for the currentBidder record component
      currentBidderUsername - the value for the currentBidderUsername record 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

      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
    • seller

      public UUID seller()
      Returns the value of the seller record component.
      Returns:
      the value of the seller record component
    • sellerLastKnownUsername

      public String sellerLastKnownUsername()
      Returns the value of the sellerLastKnownUsername record component.
      Returns:
      the value of the sellerLastKnownUsername 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
    • price

      public double price()
      Returns the value of the price record component.
      Returns:
      the value of the price record component
    • listedAt

      public long listedAt()
      Returns the value of the listedAt record component.
      Returns:
      the value of the listedAt record component
    • expiresAt

      public long expiresAt()
      Returns the value of the expiresAt record component.
      Returns:
      the value of the expiresAt record component
    • status

      public AuctionListing.Status status()
      Returns the value of the status record component.
      Returns:
      the value of the status record component
    • buyer

      @Nullable public @Nullable UUID buyer()
      Returns the value of the buyer record component.
      Returns:
      the value of the buyer record component
    • auction

      public boolean auction()
      Returns the value of the auction record component.
      Returns:
      the value of the auction record component
    • currentBid

      @Nullable public @Nullable Double currentBid()
      Returns the value of the currentBid record component.
      Returns:
      the value of the currentBid record component
    • currentBidder

      @Nullable public @Nullable UUID currentBidder()
      Returns the value of the currentBidder record component.
      Returns:
      the value of the currentBidder record component
    • currentBidderUsername

      @Nullable public @Nullable String currentBidderUsername()
      Returns the value of the currentBidderUsername record component.
      Returns:
      the value of the currentBidderUsername record component