Class ClaimAuction

java.lang.Object
me.EtienneDx.RealEstate.Transactions.ClaimTransaction
me.EtienneDx.RealEstate.Transactions.ClaimAuction
All Implemented Interfaces:
Transaction, org.bukkit.configuration.serialization.ConfigurationSerializable

public class ClaimAuction extends ClaimTransaction
Represents an auction transaction for a claim.

This transaction handles the bidding process and finalizing an auction.

  • Field Details

    • buyer

      public UUID buyer
      The UUID of the current highest bidder, or null if no bid has been made.
    • endDate

      public LocalDateTime endDate
      The time when the auction ends.
    • bidStep

      public double bidStep
      The minimum bid increment required.
  • Constructor Details

    • ClaimAuction

      public ClaimAuction(Map<String,Object> map)
      Constructs a ClaimAuction from a serialized map.
      Parameters:
      map - the map containing serialized transaction data
    • ClaimAuction

      public ClaimAuction(IClaim claim, org.bukkit.entity.Player player, double price, org.bukkit.Location sign, LocalDateTime endDate, double bidStep)
      Constructs a new ClaimAuction.
      Parameters:
      claim - the claim being auctioned
      player - the player initiating the auction
      price - the starting price of the auction
      sign - the location of the auction sign
      endDate - the end time of the auction
      bidStep - the bid increment step
  • Method Details

    • serialize

      public Map<String,Object> serialize()
      Serializes this ClaimAuction into a map for storage.
      Specified by:
      serialize in interface org.bukkit.configuration.serialization.ConfigurationSerializable
      Overrides:
      serialize in class ClaimTransaction
      Returns:
      a map containing the serialized properties of the auction
    • update

      public boolean update()
      Updates the auction status.

      This method checks if the auction has ended and, if so, finalizes the auction by transferring claim ownership and updating the auction sign accordingly. Otherwise, it updates the sign with the remaining time and current bid details.

      Returns:
      true if the auction ended and was finalized; false otherwise
    • tryCancelTransaction

      public boolean tryCancelTransaction(org.bukkit.entity.Player p, boolean force)
      Attempts to cancel the auction transaction.
      Parameters:
      p - the player attempting the cancellation
      force - if true, forces cancellation regardless of conditions
      Returns:
      true if the transaction was cancelled successfully; false otherwise
    • interact

      public void interact(org.bukkit.entity.Player player)
      Processes interaction with the auction sign.

      If the claim is invalid or the player is the owner, displays an error message. Otherwise, it initiates a bid by increasing the current price.

      Parameters:
      player - the player interacting with the auction sign
    • bid

      public void bid(org.bukkit.entity.Player player, double price)
      Processes a bid from a player.

      This method validates the bid, processes payment, updates the highest bidder, and then updates the auction status.

      Parameters:
      player - the player placing the bid
      price - the bid amount
    • preview

      public void preview(org.bukkit.entity.Player player)
      Provides a preview of the auction information to a player.

      This method sends the player details about the auction, including header, current bid, remaining time, bid step, and owner information.

      Parameters:
      player - the player requesting the preview
    • msgInfo

      public void msgInfo(org.bukkit.command.CommandSender cs)
      Sends auction information to a CommandSender.

      This method displays an oneline summary of the auction including area, location, price, remaining time, and bid step.

      Parameters:
      cs - the CommandSender to send the message to
    • getBidStep

      public double getBidStep()
      Returns the bid increment step for the auction.
      Returns:
      the bid step as a double
    • getBuyer

      public UUID getBuyer()
      Returns the UUID of the current highest bidder.
      Returns:
      the buyer's UUID, or null if no bid has been made
    • getEndDate

      public LocalDateTime getEndDate()
      Returns the end date and time of the auction.
      Returns:
      the auction's end date as a LocalDateTime