Class ClaimTransaction
java.lang.Object
me.EtienneDx.RealEstate.Transactions.ClaimTransaction
- All Implemented Interfaces:
Transaction
,org.bukkit.configuration.serialization.ConfigurationSerializable
- Direct Known Subclasses:
BoughtTransaction
,ClaimAuction
,ClaimSell
public abstract class ClaimTransaction
extends Object
implements org.bukkit.configuration.serialization.ConfigurationSerializable, Transaction
Represents a generic claim transaction.
This abstract class provides the base for all claim-related transactions (e.g. selling, renting, leasing). It handles common data such as the claim ID, owner, price, and sign location, and implements serialization for storage.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor.ClaimTransaction
(Map<String, Object> map) Constructs a ClaimTransaction from a serialized map.ClaimTransaction
(IClaim claim, org.bukkit.entity.Player player, double price, org.bukkit.Location sign) Constructs a new ClaimTransaction. -
Method Summary
Modifier and TypeMethodDescriptiongetClaim()
Retrieves the claim associated with this transaction.org.bukkit.block.Block
Retrieves the Block that holds the sign for this transaction.getOwner()
Returns the owner's UUID.Returns the owner's UUID.double
getPrice()
Returns the transaction price.org.bukkit.Location
getSign()
Returns the location of the sign associated with this transaction.Serializes this transaction into a map.void
Sets the owner's UUID.boolean
tryCancelTransaction
(org.bukkit.entity.Player p) Attempts to cancel the transaction using the specified player.Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface me.EtienneDx.RealEstate.Transactions.Transaction
interact, msgInfo, preview, tryCancelTransaction, update
-
Field Details
-
claimId
The unique ID of the claim. -
owner
The UUID of the claim owner. If null, the claim is considered an admin claim. -
price
public double priceThe transaction price. -
sign
public org.bukkit.Location signThe location of the sign representing this transaction.
-
-
Constructor Details
-
ClaimTransaction
public ClaimTransaction(IClaim claim, org.bukkit.entity.Player player, double price, org.bukkit.Location sign) Constructs a new ClaimTransaction.- Parameters:
claim
- the claim involved in the transactionplayer
- the player initiating the transaction; may be null for admin claimsprice
- the transaction pricesign
- the location of the sign associated with the transaction
-
ClaimTransaction
-
ClaimTransaction
public ClaimTransaction()Default constructor.
-
-
Method Details
-
serialize
-
getHolder
public org.bukkit.block.Block getHolder()Retrieves the Block that holds the sign for this transaction.- Specified by:
getHolder
in interfaceTransaction
- Returns:
- the Block if the sign state is an instance of
Sign
, otherwise null
-
getOwner
Returns the owner's UUID.- Specified by:
getOwner
in interfaceTransaction
- Returns:
- the UUID of the owner, or null for admin claims
-
setOwner
Sets the owner's UUID.- Specified by:
setOwner
in interfaceTransaction
- Parameters:
newOwner
- the new owner's UUID
-
tryCancelTransaction
public boolean tryCancelTransaction(org.bukkit.entity.Player p) Attempts to cancel the transaction using the specified player.- Specified by:
tryCancelTransaction
in interfaceTransaction
- Parameters:
p
- the player attempting to cancel the transaction- Returns:
- true if the cancellation was successful, false otherwise
-
getClaim
-
getOwnerUUID
Returns the owner's UUID.- Returns:
- the UUID of the owner, or null if not set
-
getPrice
public double getPrice()Returns the transaction price.- Returns:
- the price of the transaction
-
getSign
public org.bukkit.Location getSign()Returns the location of the sign associated with this transaction.- Returns:
- the sign
Location
-