Class ClaimAuction
- All Implemented Interfaces:
Transaction
,org.bukkit.configuration.serialization.ConfigurationSerializable
This transaction handles the bidding process and finalizing an auction.
-
Field Summary
FieldsModifier and TypeFieldDescriptiondouble
The minimum bid increment required.The UUID of the current highest bidder, ornull
if no bid has been made.The time when the auction ends.Fields inherited from class me.EtienneDx.RealEstate.Transactions.ClaimTransaction
claimId, owner, price, sign
-
Constructor Summary
ConstructorsConstructorDescriptionClaimAuction
(Map<String, Object> map) Constructs a ClaimAuction from a serialized map.ClaimAuction
(IClaim claim, org.bukkit.entity.Player player, double price, org.bukkit.Location sign, LocalDateTime endDate, double bidStep) Constructs a new ClaimAuction. -
Method Summary
Modifier and TypeMethodDescriptionvoid
bid
(org.bukkit.entity.Player player, double price) Processes a bid from a player.double
Returns the bid increment step for the auction.getBuyer()
Returns the UUID of the current highest bidder.Returns the end date and time of the auction.void
interact
(org.bukkit.entity.Player player) Processes interaction with the auction sign.void
msgInfo
(org.bukkit.command.CommandSender cs) Sends auction information to a CommandSender.void
preview
(org.bukkit.entity.Player player) Provides a preview of the auction information to a player.Serializes this ClaimAuction into a map for storage.boolean
tryCancelTransaction
(org.bukkit.entity.Player p, boolean force) Attempts to cancel the auction transaction.boolean
update()
Updates the auction status.Methods inherited from class me.EtienneDx.RealEstate.Transactions.ClaimTransaction
getClaim, getHolder, getOwner, getOwnerUUID, getPrice, getSign, setOwner, tryCancelTransaction
-
Field Details
-
buyer
The UUID of the current highest bidder, ornull
if no bid has been made. -
endDate
The time when the auction ends. -
bidStep
public double bidStepThe minimum bid increment required.
-
-
Constructor Details
-
ClaimAuction
-
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 auctionedplayer
- the player initiating the auctionprice
- the starting price of the auctionsign
- the location of the auction signendDate
- the end time of the auctionbidStep
- the bid increment step
-
-
Method Details
-
serialize
Serializes this ClaimAuction into a map for storage.- Specified by:
serialize
in interfaceorg.bukkit.configuration.serialization.ConfigurationSerializable
- Overrides:
serialize
in classClaimTransaction
- 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 cancellationforce
- iftrue
, 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 bidprice
- 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
Returns the UUID of the current highest bidder.- Returns:
- the buyer's UUID, or
null
if no bid has been made
-
getEndDate
Returns the end date and time of the auction.- Returns:
- the auction's end date as a
LocalDateTime
-