Class ClaimSell

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

public class ClaimSell extends ClaimTransaction
Represents a sell transaction for a claim.

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.

  • 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 sold
      player - the player initiating the sale
      price - the sale price
      sign - the location of the sign representing the sale
    • ClaimSell

      public ClaimSell(Map<String,Object> map)
      Constructs a ClaimSell transaction from a serialized map.
      Parameters:
      map - the map containing serialized data for this sale transaction
  • 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