Class ClaimSell
- All Implemented Interfaces:
Transaction
,org.bukkit.configuration.serialization.ConfigurationSerializable
This transaction is used when a claim is put up for sale. It handles updating the sign display with sale information, processing the transaction, and transferring ownership.
-
Field Summary
Fields inherited from class me.EtienneDx.RealEstate.Transactions.ClaimTransaction
claimId, owner, price, sign
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
interact
(org.bukkit.entity.Player player) Processes player interaction with the sale sign.void
msgInfo
(org.bukkit.command.CommandSender cs) Sends a one-line summary of the sale transaction to a command sender.void
preview
(org.bukkit.entity.Player player) Sends a detailed preview of the sale transaction to a player.boolean
tryCancelTransaction
(org.bukkit.entity.Player p, boolean force) Attempts to cancel the sale transaction.boolean
update()
Updates the sign associated with this sale transaction.Methods inherited from class me.EtienneDx.RealEstate.Transactions.ClaimTransaction
getClaim, getHolder, getOwner, getOwnerUUID, getPrice, getSign, serialize, setOwner, tryCancelTransaction
-
Constructor Details
-
ClaimSell
public ClaimSell(IClaim claim, org.bukkit.entity.Player player, double price, org.bukkit.Location sign) Constructs a new ClaimSell transaction.- Parameters:
claim
- the claim being soldplayer
- the player initiating the saleprice
- the sale pricesign
- the location of the sign representing the sale
-
ClaimSell
-
-
Method Details
-
update
public boolean update()Updates the sign associated with this sale transaction.If the sign is valid, it updates each line with the sale information (header, sale type, owner, and price). If the sign is not valid, the transaction is canceled.
- Returns:
- false to indicate that the transaction remains active.
-
tryCancelTransaction
public boolean tryCancelTransaction(org.bukkit.entity.Player p, boolean force) Attempts to cancel the sale transaction.In the case of a sale, the transaction can only be canceled by removing the sign.
- Parameters:
p
- the player attempting cancellation (unused in this context)force
- if true, forces cancellation- Returns:
- true after the transaction is canceled
-
interact
public void interact(org.bukkit.entity.Player player) Processes player interaction with the sale sign.Checks that the claim exists, that the player has permission to buy the claim, and that the player has enough claim blocks if required. If the payment succeeds, ownership is transferred and appropriate messages are sent.
- Parameters:
player
- the player interacting with the sale sign
-
preview
public void preview(org.bukkit.entity.Player player) Sends a detailed preview of the sale transaction to a player.The preview includes the sale header, sale details (type and price), and the owner information.
- Parameters:
player
- the player to receive the preview
-
msgInfo
public void msgInfo(org.bukkit.command.CommandSender cs) Sends a one-line summary of the sale transaction to a command sender.- Parameters:
cs
- the command sender to receive the sale summary
-