Class ClaimRent

All Implemented Interfaces:
Transaction, org.bukkit.configuration.serialization.ConfigurationSerializable

public class ClaimRent extends BoughtTransaction
Represents a rental transaction for a claim.

This transaction handles the leasing of claims by a renter. It supports auto-renewal, periodic lease payments, and updates the sign display with the current lease status.

  • Field Details

    • autoRenew

      public boolean autoRenew
      If true, the lease is set to auto-renew once the duration expires.
    • buildTrust

      public boolean buildTrust
      Indicates whether the lease grants building trust (if true) or container trust (if false).
  • Constructor Details

    • ClaimRent

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

      public ClaimRent(IClaim claim, org.bukkit.entity.Player player, double price, org.bukkit.Location sign, int duration, boolean buildTrust)
      Constructs a new ClaimRent transaction.
      Parameters:
      claim - the claim being rented
      player - the player initiating the rent
      price - the rental price per period
      sign - the location of the sign representing the rent
      duration - the lease period (in days)
      buildTrust - if true, grants building permissions; if false, grants container trust only
  • Method Details

    • serialize

      public Map<String,Object> serialize()
      Serializes this ClaimRent transaction to a Map.
      Specified by:
      serialize in interface org.bukkit.configuration.serialization.ConfigurationSerializable
      Overrides:
      serialize in class BoughtTransaction
      Returns:
      a Map representation of this lease transaction
    • update

      public boolean update()
      Updates the state of the lease transaction.

      If no buyer is present, it updates the sign with rental information. Otherwise, it checks if the lease period has expired. If so, it processes a payment via payRent(). If the lease is ongoing, the sign is updated with the remaining time.

      Returns:
      false to indicate the transaction remains active
    • tryCancelTransaction

      public boolean tryCancelTransaction(org.bukkit.entity.Player p, boolean force)
      Attempts to cancel this lease transaction.

      If the player has admin permission or cancellation is forced, the lease is cancelled. Otherwise, an error message is sent.

      Parameters:
      p - the player attempting cancellation
      force - if true, forces cancellation regardless of other conditions
      Returns:
      true if the transaction is cancelled; false otherwise
    • interact

      public void interact(org.bukkit.entity.Player player)
      Processes player interaction with the rent sign.

      Validates the player's eligibility to rent the claim and, if payment succeeds, updates the claim permissions, logs the transaction, and destroys the sign.

      Parameters:
      player - the player interacting with the rent sign
    • preview

      public void preview(org.bukkit.entity.Player player)
      Previews detailed lease information to a player.

      This includes the lease header, current renter (if any), remaining time, and owner information.

      Parameters:
      player - the player to receive the lease preview
    • msgInfo

      public void msgInfo(org.bukkit.command.CommandSender cs)
      Sends a one-line summary of the lease transaction to a command sender.
      Parameters:
      cs - the command sender (console or player) to receive the summary