Class TransactionsStore
java.lang.Object
me.EtienneDx.RealEstate.Transactions.TransactionsStore
Manages real estate transactions including selling, renting, leasing, and auctions.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
Enumeration of storage types supported by the plugin. -
Field Summary
FieldsModifier and TypeFieldDescriptionStores all claim auction transactions.Stores all claim lease transactions.Stores all claim rent transactions.Stores all claim sell transactions.final String
Path to the transactions data file.Current date instance used for logging.Date format used for logging transactions. -
Constructor Summary
ConstructorsConstructorDescriptionInitializes the transaction store based on the configuration settings. -
Method Summary
Modifier and TypeMethodDescriptionboolean
anyTransaction
(IClaim claim) Checks if there is any active transaction on a given claim.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.boolean
Determines if a given transaction can be canceled.void
cancelTransaction
(IClaim claim) Cancels an active transaction associated with a given claim.void
Cancels a specific transaction.getTransaction
(IClaim claim) Retrieves the active transaction associated with a given claim.getTransaction
(org.bukkit.entity.Player player) Retrieves the active transaction associated with a player.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.void
Loads transaction data from a file-based storage system.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.void
saveData()
Saves transaction data, either to a file or database depending on configuration.void
Saves transaction data to a file-based storage system.void
Creates a new sell transaction for a claim.
-
Field Details
-
dataFilePath
Path to the transactions data file. -
dateFormat
Date format used for logging transactions. -
date
Current date instance used for logging. -
claimSell
-
claimRent
-
claimLease
Stores all claim lease transactions. -
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
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
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
Cancels an active transaction associated with a given claim.- Parameters:
claim
- The claim whose transaction needs to be canceled.
-
cancelTransaction
Cancels a specific transaction.- Parameters:
tr
- The transaction to cancel.
-
canCancelTransaction
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
Retrieves the active transaction associated with a player.- Parameters:
player
- The player to check.- Returns:
- The transaction if found, otherwise null.
-