Klasse RentalService
java.lang.Object
de.delinkedde.areashopreborn.application.RentalService
Executes rental publication and initial contract purchase workflows.
-
Konstruktorübersicht
KonstruktorenKonstruktorBeschreibungRentalService(Database database, EstateRepository estates, RentalRepository rentals, EconomyGateway economy, WorldGuardGateway worldGuard, ThreadBridge threads, boolean enabled, String currency) Creates the rental service.RentalService(Database database, EstateRepository estates, RentalRepository rentals, EconomyGateway economy, WorldGuardGateway worldGuard, ThreadBridge threads, boolean enabled, String currency, EventPublisher events) Creates a rental service with an explicit event publisher.RentalService(Database database, EstateRepository estates, RentalRepository rentals, EconomyGateway economy, WorldGuardGateway worldGuard, ThreadBridge threads, boolean enabled, String currency, EventPublisher events, OfflinePlayerResolver players) Creates a rental service with fully replaceable platform boundaries.RentalService(Database database, EstateRepository estates, RentalRepository rentals, EconomyGateway economy, WorldGuardGateway worldGuard, ThreadBridge threads, boolean enabled, String currency, CompletableFuture<?> startupRecovery) Creates a rental service gated by the startup recovery scan.RentalService(Database database, EstateRepository estates, RentalRepository rentals, EconomyGateway economy, WorldGuardGateway worldGuard, ThreadBridge threads, boolean enabled, String currency, CompletableFuture<?> startupRecovery, EventPublisher events, OfflinePlayerResolver players) Creates a rental service with recovery and all platform boundaries replaceable.RentalService(Database database, EstateRepository estates, RentalRepository rentals, EconomyGateway economy, WorldGuardGateway worldGuard, ThreadBridge threads, boolean enabled, String currency, CompletableFuture<?> startupRecovery, EventPublisher events, OfflinePlayerResolver players, int maximumExpirationsPerRun) Creates the complete rental service with a bounded expiration batch. -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungVoluntarily ends a renter's active contract without a refund.end(UUID renterId, String regionName, OperationCause cause) Voluntarily ends a rental with an explicit event origin.Purchases additional periods for the renter's active contract.extend(UUID renterId, String regionName, int periods, OperationCause cause) Extends a rental contract with an explicit event origin.Processes contracts that reached their expiration time.publish(UUID actorId, String regionName, BigDecimal pricePerPeriod, Duration period, int maximumPeriods) Publishes a draft parcel for rent.Rents an available parcel for one or more periods.rent(UUID renterId, String regionName, int periods, OperationCause cause) Rents a parcel and exposes the initiating subsystem to Bukkit event listeners.setAutoExtend(UUID renterId, String regionName, boolean enabled) Enables or disables one-period automatic extension for a renter's contract.
-
Konstruktordetails
-
RentalService
public RentalService(Database database, EstateRepository estates, RentalRepository rentals, EconomyGateway economy, WorldGuardGateway worldGuard, ThreadBridge threads, boolean enabled, String currency) Creates the rental service.- Parameter:
database- asynchronous database executorestates- estate repositoryrentals- rental repositoryeconomy- Vault adapterworldGuard- WorldGuard adapterthreads- server-thread bridgeenabled- feature switchcurrency- logical currency name
-
RentalService
public RentalService(Database database, EstateRepository estates, RentalRepository rentals, EconomyGateway economy, WorldGuardGateway worldGuard, ThreadBridge threads, boolean enabled, String currency, CompletableFuture<?> startupRecovery) Creates a rental service gated by the startup recovery scan.- Parameter:
database- asynchronous database executorestates- estate repositoryrentals- rental repositoryeconomy- Vault adapterworldGuard- WorldGuard adapterthreads- server-thread bridgeenabled- feature switchcurrency- logical currency namestartupRecovery- recovery gate completed before new payments
-
RentalService
public RentalService(Database database, EstateRepository estates, RentalRepository rentals, EconomyGateway economy, WorldGuardGateway worldGuard, ThreadBridge threads, boolean enabled, String currency, EventPublisher events) Creates a rental service with an explicit event publisher.- Parameter:
database- database executorestates- estate repositoryrentals- rental repositoryeconomy- Vault economy adapterworldGuard- WorldGuard adapterthreads- Paper thread bridgeenabled- whether rental operations are enabledcurrency- logical currency nameevents- synchronous platform event publisher
-
RentalService
public RentalService(Database database, EstateRepository estates, RentalRepository rentals, EconomyGateway economy, WorldGuardGateway worldGuard, ThreadBridge threads, boolean enabled, String currency, EventPublisher events, OfflinePlayerResolver players) Creates a rental service with fully replaceable platform boundaries.- Parameter:
database- database executorestates- estate repositoryrentals- rental repositoryeconomy- Vault economy adapterworldGuard- WorldGuard adapterthreads- Paper thread bridgeenabled- whether rental operations are enabledcurrency- logical currency nameevents- synchronous platform event publisherplayers- Bukkit offline-player account resolver
-
RentalService
public RentalService(Database database, EstateRepository estates, RentalRepository rentals, EconomyGateway economy, WorldGuardGateway worldGuard, ThreadBridge threads, boolean enabled, String currency, CompletableFuture<?> startupRecovery, EventPublisher events, OfflinePlayerResolver players) Creates a rental service with recovery and all platform boundaries replaceable.- Parameter:
database- database executorestates- estate repositoryrentals- rental repositoryeconomy- Vault economy adapterworldGuard- WorldGuard adapterthreads- Paper thread bridgeenabled- whether rental operations are enabledcurrency- logical currency namestartupRecovery- recovery gate completed before new paymentsevents- synchronous platform event publisherplayers- Bukkit offline-player account resolver
-
RentalService
public RentalService(Database database, EstateRepository estates, RentalRepository rentals, EconomyGateway economy, WorldGuardGateway worldGuard, ThreadBridge threads, boolean enabled, String currency, CompletableFuture<?> startupRecovery, EventPublisher events, OfflinePlayerResolver players, int maximumExpirationsPerRun) Creates the complete rental service with a bounded expiration batch.- Parameter:
database- database executorestates- estate repositoryrentals- rental repositoryeconomy- Vault economy adapterworldGuard- WorldGuard adapterthreads- Paper thread bridgeenabled- whether rental operations are enabledcurrency- logical currency namestartupRecovery- recovery gate completed before new paymentsevents- synchronous platform event publisherplayers- offline-player account resolvermaximumExpirationsPerRun- positive scheduler batch size
-
-
Methodendetails
-
publish
public CompletableFuture<Listing> publish(UUID actorId, String regionName, BigDecimal pricePerPeriod, Duration period, int maximumPeriods) Publishes a draft parcel for rent.- Parameter:
actorId- city landlord or delegated managerregionName- parcel name or protection identifierpricePerPeriod- price for one periodperiod- billable period durationmaximumPeriods- maximum periods in a contract- Gibt zurück:
- future containing the rental listing
-
rent
Rents an available parcel for one or more periods.- Parameter:
renterId- renting playerregionName- parcel name or protection identifierperiods- number of periods to purchase- Gibt zurück:
- future containing the active contract
-
rent
public CompletableFuture<RentalContract> rent(UUID renterId, String regionName, int periods, OperationCause cause) Rents a parcel and exposes the initiating subsystem to Bukkit event listeners.- Parameter:
renterId- renting playerregionName- parcel name or protection identifierperiods- number of periods to purchasecause- initiating subsystem- Gibt zurück:
- future containing the active contract
-
extend
Purchases additional periods for the renter's active contract.- Parameter:
renterId- contract renterregionName- rented parcelperiods- additional periods- Gibt zurück:
- future containing the previous contract snapshot
-
extend
public CompletableFuture<RentalContract> extend(UUID renterId, String regionName, int periods, OperationCause cause) Extends a rental contract with an explicit event origin.- Parameter:
renterId- contract renterregionName- rented parcelperiods- additional periodscause- initiating subsystem- Gibt zurück:
- future containing the extended active contract
-
setAutoExtend
Enables or disables one-period automatic extension for a renter's contract.- Parameter:
renterId- contract renterregionName- rented parcelenabled- desired setting- Gibt zurück:
- completion future
-
end
Voluntarily ends a renter's active contract without a refund.- Parameter:
renterId- contract renterregionName- rented parcel- Gibt zurück:
- completion future
-
end
Voluntarily ends a rental with an explicit event origin.- Parameter:
renterId- contract renterregionName- rented parcelcause- initiating subsystem- Gibt zurück:
- completion future
-
processDueContracts
Processes contracts that reached their expiration time.Auto-extend contracts attempt one additional period. If payment fails, or auto extension is disabled, the contract expires and the parcel is made available again.
- Gibt zurück:
- future containing the number of due contracts processed
-