Klasse RentalService

java.lang.Object
de.delinkedde.areashopreborn.application.RentalService

public final class RentalService extends Object
Executes rental publication and initial contract purchase workflows.
  • 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 executor
      estates - estate repository
      rentals - rental repository
      economy - Vault adapter
      worldGuard - WorldGuard adapter
      threads - server-thread bridge
      enabled - feature switch
      currency - 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 executor
      estates - estate repository
      rentals - rental repository
      economy - Vault adapter
      worldGuard - WorldGuard adapter
      threads - server-thread bridge
      enabled - feature switch
      currency - logical currency name
      startupRecovery - 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 executor
      estates - estate repository
      rentals - rental repository
      economy - Vault economy adapter
      worldGuard - WorldGuard adapter
      threads - Paper thread bridge
      enabled - whether rental operations are enabled
      currency - logical currency name
      events - 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 executor
      estates - estate repository
      rentals - rental repository
      economy - Vault economy adapter
      worldGuard - WorldGuard adapter
      threads - Paper thread bridge
      enabled - whether rental operations are enabled
      currency - logical currency name
      events - synchronous platform event publisher
      players - 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 executor
      estates - estate repository
      rentals - rental repository
      economy - Vault economy adapter
      worldGuard - WorldGuard adapter
      threads - Paper thread bridge
      enabled - whether rental operations are enabled
      currency - logical currency name
      startupRecovery - recovery gate completed before new payments
      events - synchronous platform event publisher
      players - 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 executor
      estates - estate repository
      rentals - rental repository
      economy - Vault economy adapter
      worldGuard - WorldGuard adapter
      threads - Paper thread bridge
      enabled - whether rental operations are enabled
      currency - logical currency name
      startupRecovery - recovery gate completed before new payments
      events - synchronous platform event publisher
      players - offline-player account resolver
      maximumExpirationsPerRun - 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 manager
      regionName - parcel name or protection identifier
      pricePerPeriod - price for one period
      period - billable period duration
      maximumPeriods - maximum periods in a contract
      Gibt zurück:
      future containing the rental listing
    • rent

      public CompletableFuture<RentalContract> rent(UUID renterId, String regionName, int periods)
      Rents an available parcel for one or more periods.
      Parameter:
      renterId - renting player
      regionName - parcel name or protection identifier
      periods - 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 player
      regionName - parcel name or protection identifier
      periods - number of periods to purchase
      cause - initiating subsystem
      Gibt zurück:
      future containing the active contract
    • extend

      public CompletableFuture<RentalContract> extend(UUID renterId, String regionName, int periods)
      Purchases additional periods for the renter's active contract.
      Parameter:
      renterId - contract renter
      regionName - rented parcel
      periods - 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 renter
      regionName - rented parcel
      periods - additional periods
      cause - initiating subsystem
      Gibt zurück:
      future containing the extended active contract
    • setAutoExtend

      public CompletableFuture<Void> setAutoExtend(UUID renterId, String regionName, boolean enabled)
      Enables or disables one-period automatic extension for a renter's contract.
      Parameter:
      renterId - contract renter
      regionName - rented parcel
      enabled - desired setting
      Gibt zurück:
      completion future
    • end

      public CompletableFuture<Void> end(UUID renterId, String regionName)
      Voluntarily ends a renter's active contract without a refund.
      Parameter:
      renterId - contract renter
      regionName - rented parcel
      Gibt zurück:
      completion future
    • end

      public CompletableFuture<Void> end(UUID renterId, String regionName, OperationCause cause)
      Voluntarily ends a rental with an explicit event origin.
      Parameter:
      renterId - contract renter
      regionName - rented parcel
      cause - initiating subsystem
      Gibt zurück:
      completion future
    • processDueContracts

      public CompletableFuture<Integer> 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