Class TransactionsStore

java.lang.Object
me.EtienneDx.RealEstate.Transactions.TransactionsStore

public class TransactionsStore extends Object
Manages real estate transactions including selling, renting, leasing, and auctions.
  • Field Details

    • dataFilePath

      public final String dataFilePath
      Path to the transactions data file.
    • dateFormat

      public DateFormat dateFormat
      Date format used for logging transactions.
    • date

      public Date date
      Current date instance used for logging.
    • claimSell

      public HashMap<String,ClaimSell> claimSell
      Stores all claim sell transactions.
    • claimRent

      public HashMap<String,ClaimRent> claimRent
      Stores all claim rent transactions.
    • claimLease

      public HashMap<String,ClaimLease> claimLease
      Stores all claim lease transactions.
    • claimAuction

      public HashMap<String,ClaimAuction> claimAuction
      Stores all claim auction transactions.
  • Constructor Details

    • TransactionsStore

      public TransactionsStore()
      Initializes the transaction store based on the configuration settings.
  • Method Details

    • loadDataFromFile

      public void loadDataFromFile()
      Loads transaction data from a file-based storage system.
    • saveDataToFile

      public void saveDataToFile()
      Saves transaction data to a file-based storage system.
    • saveData

      public void saveData()
      Saves transaction data, either to a file or database depending on configuration.
    • anyTransaction

      public boolean anyTransaction(IClaim claim)
      Checks if there is any active transaction on a given claim.
      Parameters:
      claim - The claim to check.
      Returns:
      True if a transaction exists, otherwise false.
    • getTransaction

      public Transaction getTransaction(IClaim claim)
      Retrieves the active transaction associated with a given claim.
      Parameters:
      claim - The claim to retrieve the transaction for.
      Returns:
      The transaction if found, otherwise null.
    • cancelTransaction

      public void cancelTransaction(IClaim claim)
      Cancels an active transaction associated with a given claim.
      Parameters:
      claim - The claim whose transaction needs to be canceled.
    • cancelTransaction

      public void cancelTransaction(Transaction tr)
      Cancels a specific transaction.
      Parameters:
      tr - The transaction to cancel.
    • canCancelTransaction

      public boolean canCancelTransaction(Transaction tr)
      Determines if a given transaction can be canceled.
      Parameters:
      tr - The transaction to check.
      Returns:
      True if the transaction can be canceled, otherwise false.
    • sell

      public void sell(IClaim claim, org.bukkit.entity.Player player, double price, org.bukkit.Location sign)
      Creates a new sell transaction for a claim.
      Parameters:
      claim - The claim being sold.
      player - The player selling the claim.
      price - The price of the claim.
      sign - The location of the transaction sign.
    • rent

      public void rent(IClaim claim, org.bukkit.entity.Player player, double price, org.bukkit.Location sign, int duration, boolean buildTrust)
      Creates a new rent transaction for a claim.
      Parameters:
      claim - The claim being rented.
      player - The player renting the claim.
      price - The rental price.
      sign - The location of the transaction sign.
      duration - The rental duration in days.
      buildTrust - Whether the renter gains build trust.
    • lease

      public void lease(IClaim claim, org.bukkit.entity.Player player, double price, org.bukkit.Location sign, int frequency, int paymentsCount)
      Creates a new lease transaction for a claim.
      Parameters:
      claim - The claim being leased.
      player - The player leasing the claim.
      price - The lease price.
      sign - The location of the transaction sign.
      frequency - The payment frequency.
      paymentsCount - The number of payments required.
    • auction

      public void auction(IClaim claim, org.bukkit.entity.Player player, double price, org.bukkit.Location sign, int duration, double bidStep)
      Creates a new auction transaction for a claim.
      Parameters:
      claim - The claim being auctioned.
      player - The player starting the auction.
      price - The starting price.
      sign - The location of the transaction sign.
      duration - The auction duration in days.
      bidStep - The minimum bid step.
    • getTransaction

      public Transaction getTransaction(org.bukkit.entity.Player player)
      Retrieves the active transaction associated with a player.
      Parameters:
      player - The player to check.
      Returns:
      The transaction if found, otherwise null.