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 Details

    • claimId

      public String claimId
      The unique ID of the claim.
    • owner

      public UUID owner
      The UUID of the claim owner. If null, the claim is considered an admin claim.
    • price

      public double price
      The transaction price.
    • sign

      public org.bukkit.Location sign
      The 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 transaction
      player - the player initiating the transaction; may be null for admin claims
      price - the transaction price
      sign - the location of the sign associated with the transaction
    • ClaimTransaction

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

      public ClaimTransaction()
      Default constructor.
  • Method Details

    • serialize

      public Map<String,Object> serialize()
      Serializes this transaction into a map.
      Specified by:
      serialize in interface org.bukkit.configuration.serialization.ConfigurationSerializable
      Returns:
      a map containing the serialized transaction data
    • getHolder

      public org.bukkit.block.Block getHolder()
      Retrieves the Block that holds the sign for this transaction.
      Specified by:
      getHolder in interface Transaction
      Returns:
      the Block if the sign state is an instance of Sign, otherwise null
    • getOwner

      public UUID getOwner()
      Returns the owner's UUID.
      Specified by:
      getOwner in interface Transaction
      Returns:
      the UUID of the owner, or null for admin claims
    • setOwner

      public void setOwner(UUID newOwner)
      Sets the owner's UUID.
      Specified by:
      setOwner in interface Transaction
      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 interface Transaction
      Parameters:
      p - the player attempting to cancel the transaction
      Returns:
      true if the cancellation was successful, false otherwise
    • getClaim

      public IClaim getClaim()
      Retrieves the claim associated with this transaction.

      This method uses the RealEstate API to obtain the claim based on the sign location.

      Returns:
      the IClaim associated with this transaction
    • getOwnerUUID

      public UUID 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