Klasse EstateApplicationService

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

public final class EstateApplicationService extends Object
Coordinates city, parcel, and listing use cases across persistence and WorldGuard.
  • Konstruktordetails

    • EstateApplicationService

      public EstateApplicationService(Database database, EstateRepository repository, WorldGuardGateway worldGuard, ThreadBridge threads, RegionPolicy policy, BigDecimal minimumPrice, BigDecimal maximumPrice, String currency, LimitService limits)
      Creates the central estate application service.
      Parameter:
      database - database executor
      repository - estate repository
      worldGuard - WorldGuard adapter
      threads - Paper thread bridge
      policy - parcel validation policy
      minimumPrice - minimum allowed listing price
      maximumPrice - maximum allowed listing price
      currency - logical currency name
      limits - permission-selected creation limits
    • EstateApplicationService

      public EstateApplicationService(Database database, EstateRepository repository, WorldGuardGateway worldGuard, ThreadBridge threads, RegionPolicy policy, BigDecimal minimumPrice, BigDecimal maximumPrice, String currency, LimitService limits, EventPublisher events)
      Creates the central estate application service with an explicit event publisher.
      Parameter:
      database - database executor
      repository - estate repository
      worldGuard - WorldGuard adapter
      threads - Paper thread bridge
      policy - parcel validation policy
      minimumPrice - minimum allowed listing price
      maximumPrice - maximum allowed listing price
      currency - logical currency name
      limits - permission-selected creation limits
      events - synchronous platform event publisher
    • EstateApplicationService

      public EstateApplicationService(Database database, EstateRepository repository, WorldGuardGateway worldGuard, ThreadBridge threads, RegionPolicy policy, BigDecimal minimumPrice, BigDecimal maximumPrice, String currency, LimitService limits, EventPublisher events, int maximumGeometryCandidates)
      Creates the service with an absolute city geometry safety ceiling.
      Parameter:
      database - database executor
      repository - estate repository
      worldGuard - WorldGuard adapter
      threads - Paper thread bridge
      policy - parcel validation policy
      minimumPrice - minimum allowed listing price
      maximumPrice - maximum allowed listing price
      currency - logical currency name
      limits - permission-selected creation limits
      events - synchronous platform event publisher
      maximumGeometryCandidates - absolute maximum children accepted in one city
    • EstateApplicationService

      public EstateApplicationService(Database database, EstateRepository repository, WorldGuardGateway worldGuard, ThreadBridge threads, RegionPolicy policy, BigDecimal minimumPrice, BigDecimal maximumPrice, String currency, LimitService limits, EventPublisher events, int maximumGeometryCandidates, GeometryJournalRepository journal)
      Creates the service with an explicit geometry journal for isolated tests.
      Parameter:
      database - database executor
      repository - estate repository
      worldGuard - WorldGuard adapter
      threads - Paper thread bridge
      policy - parcel validation policy
      minimumPrice - minimum allowed listing price
      maximumPrice - maximum allowed listing price
      currency - logical currency name
      limits - permission-selected creation limits
      events - synchronous platform event publisher
      maximumGeometryCandidates - absolute maximum children accepted in one city
      journal - restartable geometry operation journal
  • Methodendetails

    • findUnfinishedGeometryOperations

      public CompletableFuture<List<GeometryOperation>> findUnfinishedGeometryOperations(int limit)
      Lists geometry operations that never reached a terminal journal state.

      An unfinished entry means WorldGuard and SQLite may describe different shapes. The startup scan uses this to block mutations instead of silently continuing.

      Parameter:
      limit - maximum entries returned
      Gibt zurück:
      future containing unfinished geometry operations
    • importCity

      public CompletableFuture<EstateRegion> importCity(UUID actorId, UUID landlordId, String displayName, WorldGuardGateway.ProtectionRegion protection)
      Imports an existing WorldGuard region as a managed city.
      Parameter:
      actorId - administrator performing the import
      landlordId - initial city landlord
      displayName - city display name
      protection - existing WorldGuard region snapshot
      Gibt zurück:
      future containing the created city
    • createCity

      public CompletableFuture<EstateRegion> createCity(UUID actorId, UUID landlordId, String protectionId, String displayName, Selection selection)
      Creates a new city in both WorldGuard and the estate database from an administrator's selection. This use case deliberately uses the WorldGuard API so administrators do not need to issue a separate /rg define command.
      Parameter:
      actorId - administrator creating the city
      landlordId - initial city landlord and WorldGuard owner
      protectionId - unique WorldGuard identifier chosen for the city
      displayName - human-readable city name
      selection - selected city cuboid
      Gibt zurück:
      future containing the newly created city
    • createCity

      public CompletableFuture<EstateRegion> createCity(UUID actorId, UUID landlordId, String protectionId, String displayName, Selection selection, int minY, int maxY)
      Creates a new city with an explicit inclusive height range.
      Parameter:
      actorId - administrator creating the city
      landlordId - initial city landlord
      protectionId - stable city and WorldGuard identifier
      displayName - human-readable city name
      selection - selected horizontal footprint
      minY - inclusive minimum build height
      maxY - inclusive maximum build height
      Gibt zurück:
      future containing the created city
    • createParcel

      public CompletableFuture<EstateRegion> createParcel(UUID actorId, String cityName, String displayName, Selection selection, boolean bypassLimits)
      Creates a draft parcel inside a city and mirrors it to WorldGuard.
      Parameter:
      actorId - landlord or delegated manager
      cityName - city display name or protection identifier
      displayName - new parcel display name
      selection - selected cuboid
      bypassLimits - whether administrative size/count limits may be bypassed
      Gibt zurück:
      future containing the created parcel
    • createParcel

      public CompletableFuture<EstateRegion> createParcel(UUID actorId, String cityName, String parcelKey, String displayName, Selection selection, boolean bypassLimits)
      Creates a draft parcel with an explicit city-local technical key.
      Parameter:
      actorId - landlord or delegated manager
      cityName - city display name or protection identifier
      parcelKey - city-local stable key used in city_parcel WorldGuard names
      displayName - human-readable parcel name
      selection - selected horizontal footprint
      bypassLimits - whether administrative size/count limits may be bypassed
      Gibt zurück:
      future containing the created parcel
    • createParcel

      public CompletableFuture<EstateRegion> createParcel(UUID actorId, String cityName, String parcelKey, String displayName, Selection selection, int minY, int maxY, boolean bypassLimits)
      Creates a draft parcel with an explicit key and height range.
      Parameter:
      actorId - landlord or delegated manager
      cityName - city display name or protection identifier
      parcelKey - city-local technical key
      displayName - human-readable parcel name
      selection - selected horizontal footprint
      minY - inclusive minimum height
      maxY - inclusive maximum height
      bypassLimits - whether administrative limits may be bypassed
      Gibt zurück:
      future containing the created parcel
    • expandCity

      public CompletableFuture<EstateRegion> expandCity(UUID actorId, String cityName, Selection selection)
      Expands an existing city by unioning its polygon with an administrator selection.

      The selection contributes only X/Z coordinates. The city's configured height range is retained. Disconnected islands, holes, and overlaps with another managed city are rejected.

      Parameter:
      actorId - administrator performing the expansion
      cityName - city display name or protection identifier
      selection - selected horizontal extension
      Gibt zurück:
      future containing the updated city snapshot
    • previewCityExpansion

      public CompletableFuture<RegionGeometry> previewCityExpansion(String cityName, Selection selection)
      Validates and returns the exact city geometry that a selection would produce.
      Parameter:
      cityName - city display name or protection identifier
      selection - proposed horizontal extension
      Gibt zurück:
      future containing the non-mutating expansion preview geometry
    • setCityHeight

      public CompletableFuture<EstateRegion> setCityHeight(UUID actorId, String cityName, int minY, int maxY)
      Changes a city's inclusive build-height range.
      Parameter:
      actorId - administrator performing the change
      cityName - city display name or protection identifier
      minY - new inclusive minimum height
      maxY - new inclusive maximum height
      Gibt zurück:
      future containing the updated city
    • setParcelHeight

      public CompletableFuture<EstateRegion> setParcelHeight(UUID actorId, String parcelName, int minY, int maxY, boolean administrative)
      Changes the height of a free draft parcel.
      Parameter:
      actorId - landlord or manager performing the change
      parcelName - parcel display name or protection identifier
      minY - new inclusive minimum height
      maxY - new inclusive maximum height
      administrative - whether the caller uses the dedicated administrative permission
      Gibt zurück:
      future containing the updated parcel
    • mergeParcels

      public CompletableFuture<EstateRegion> mergeParcels(UUID actorId, String targetName, String sourceName, boolean administrative)
      Merges two adjacent parcels while retaining the target parcel identity.
      Parameter:
      actorId - city landlord or administrator
      targetName - retained parcel display name or protection identifier
      sourceName - source parcel that becomes archived
      administrative - whether the dedicated administrative merge permission is used
      Gibt zurück:
      future containing the expanded target parcel
    • publishInitialSale

      public CompletableFuture<Listing> publishInitialSale(UUID actorId, String regionName, BigDecimal price)
      Publishes a draft parcel for initial sale.
      Parameter:
      actorId - landlord or delegated manager
      regionName - parcel display name or protection identifier
      price - gross listing price
      Gibt zurück:
      future containing the active listing
    • publishInitialSaleAdministrative

      public CompletableFuture<Listing> publishInitialSaleAdministrative(UUID actorId, String regionName, BigDecimal price)
      Publishes a draft parcel for initial sale while bypassing landlord management checks.

      The listing recipient remains the configured city landlord, including the virtual Server landlord. Administrative execution changes authorization only; it never redirects the money recipient to the administrator.

      Parameter:
      actorId - administrator creating the listing
      regionName - parcel display name or protection identifier
      price - gross listing price
      Gibt zurück:
      future containing the active listing
    • publishResale

      public CompletableFuture<Listing> publishResale(UUID ownerId, String regionName, BigDecimal price)
      Publishes an owned parcel for resale.
      Parameter:
      ownerId - current parcel owner
      regionName - parcel display name or protection identifier
      price - gross resale price
      Gibt zurück:
      future containing the active resale listing
    • publishResale

      public CompletableFuture<Listing> publishResale(UUID ownerId, String regionName, BigDecimal price, OperationCause cause)
      Publishes an owned parcel for resale with an explicit event origin.
      Parameter:
      ownerId - current parcel owner
      regionName - parcel display name or protection identifier
      price - gross resale price
      cause - initiating subsystem
      Gibt zurück:
      future containing the active resale listing
    • cancelListing

      public CompletableFuture<Void> cancelListing(UUID actorId, String regionName, boolean administrative)
      Cancels an active listing and restores the appropriate region state.
      Parameter:
      actorId - listing owner or administrator
      regionName - region display name or protection identifier
      administrative - whether ownership checks may be bypassed
      Gibt zurück:
      completion future
    • cancelListing

      public CompletableFuture<Void> cancelListing(UUID actorId, String regionName, boolean administrative, OperationCause cause)
      Cancels an active listing with an explicit event origin.
      Parameter:
      actorId - listing owner or administrator
      regionName - region display name or protection identifier
      administrative - whether ownership checks may be bypassed
      cause - initiating subsystem
      Gibt zurück:
      completion future
    • unpublishManagedListing

      public CompletableFuture<Void> unpublishManagedListing(UUID actorId, String regionName)
      Unpublishes a free landlord-controlled initial-sale or rental listing.
      Parameter:
      actorId - landlord or delegated city manager
      regionName - parcel display name or protection identifier
      Gibt zurück:
      completion future
    • findOwned

      public CompletableFuture<List<EstateRegion>> findOwned(UUID playerId)
      Lists regions owned or managed by a player.
      Parameter:
      playerId - player identifier
      Gibt zurück:
      future containing matching regions
    • findOwned

      public CompletableFuture<List<EstateRegion>> findOwned(UUID playerId, int limit)
      Returns a bounded player-facing ownership list.
      Parameter:
      playerId - player identifier
      limit - maximum number of regions to return
      Gibt zurück:
      future containing the bounded matching regions
    • findAvailable

      public CompletableFuture<List<EstateRegion>> findAvailable(String cityName)
      Lists parcels currently offered for initial sale or resale.
      Parameter:
      cityName - optional city display name or WorldGuard identifier
      Gibt zurück:
      future containing matching saleable parcels
    • findAvailable

      public CompletableFuture<List<EstateRegion>> findAvailable(String cityName, int limit)
      Returns a bounded player-facing market list.
      Parameter:
      cityName - optional city display name or WorldGuard identifier
      limit - maximum number of regions to return
      Gibt zurück:
      future containing the bounded saleable regions
    • findMarketListings

      public CompletableFuture<List<EstateRepository.MarketListing>> findMarketListings(String cityName, int limit)
      Loads bounded player-facing sale cards including city names and prices.
      Parameter:
      cityName - optional city display name or WorldGuard identifier
      limit - maximum cards to return
      Gibt zurück:
      future containing sale cards without internal parent identifiers
    • findAvailablePage

      public CompletableFuture<EstateApplicationService.MarketPage> findAvailablePage(String cityName, int requestedPage, int pageSize)
      Loads one exact GUI market page and its total count without loading the whole market.
      Parameter:
      cityName - optional city filter
      requestedPage - zero-based requested page
      pageSize - rows per page
      Gibt zurück:
      normalized page snapshot
    • findAt

      public CompletableFuture<EstateRegion> findAt(String worldKey, int x, int y, int z)
      Resolves the most specific managed region at a block position without blocking Paper.
      Parameter:
      worldKey - Bukkit world key
      x - block X coordinate
      y - block Y coordinate
      z - block Z coordinate
      Gibt zurück:
      future containing the region or failing when the position is unmanaged
    • findCityAt

      public CompletableFuture<EstateRegion> findCityAt(String worldKey, int x, int y, int z)
      Resolves the containing city when the position lies in either a city or one of its parcels.
      Parameter:
      worldKey - Bukkit world key
      x - block X coordinate
      y - block Y coordinate
      z - block Z coordinate
      Gibt zurück:
      future containing the enclosing city
    • findManagedParcels

      public CompletableFuture<List<EstateRegion>> findManagedParcels(UUID actorId, String cityName)
      Lists direct parcels of a city after verifying management authority.
      Parameter:
      actorId - landlord or delegated manager
      cityName - city display name or protection identifier
      Gibt zurück:
      future containing direct city parcels
    • findManagedParcels

      public CompletableFuture<List<EstateRegion>> findManagedParcels(UUID actorId, String cityName, int limit)
      Returns a bounded direct-parcel list after verifying management authority.
      Parameter:
      actorId - landlord or delegated manager
      cityName - city display name or protection identifier
      limit - maximum number of parcels to return
      Gibt zurück:
      future containing the bounded direct city parcels
    • renameParcel

      public CompletableFuture<EstateRegion> renameParcel(UUID actorId, String regionName, String displayName)
      Renames a parcel without changing its stable UUID or WorldGuard identifier.
      Parameter:
      actorId - landlord, delegated manager, or parcel owner
      regionName - parcel display name or protection identifier
      displayName - replacement display name
      Gibt zurück:
      future containing the previous region snapshot
    • deleteDraftParcel

      public CompletableFuture<Void> deleteDraftParcel(UUID actorId, String regionName)
      Permanently deletes an unlisted draft parcel from WorldGuard and SQLite.
      Parameter:
      actorId - landlord or delegated manager
      regionName - parcel display name or protection identifier
      Gibt zurück:
      completion future
    • deleteEmptyCity

      public CompletableFuture<Void> deleteEmptyCity(UUID actorId, String cityName)
      Permanently deletes an empty managed city from WorldGuard and SQLite.

      A city with any managed child parcel is rejected regardless of the child state. This deliberately prevents cascading destruction of ownership, listings, contracts, displays, or financial history through a deceptively small command.

      Parameter:
      actorId - administrator performing the deletion
      cityName - city display name or protection identifier
      Gibt zurück:
      completion future
    • changeCityManager

      public CompletableFuture<Void> changeCityManager(UUID landlordId, String cityName, UUID managerId, boolean adding)
      Adds or removes a delegated city manager without granting WorldGuard build membership.
      Parameter:
      landlordId - current city landlord
      cityName - city display name or protection identifier
      managerId - delegated manager
      adding - whether the manager should be added
      Gibt zurück:
      completion future
    • changeCityManager

      public CompletableFuture<Void> changeCityManager(UUID actorId, String cityName, UUID managerId, boolean adding, boolean administrative)
      Adds or removes a city manager with an optional administrative authority bypass.
      Parameter:
      actorId - city landlord or administrator performing the change
      cityName - city display name or protection identifier
      managerId - delegated manager
      adding - whether the manager should be added
      administrative - whether the dedicated administrative permission is used
      Gibt zurück:
      completion future
    • findCityManagers

      public CompletableFuture<List<UUID>> findCityManagers(UUID actorId, String cityName)
      Lists delegated managers of a city.
      Parameter:
      actorId - city landlord or delegated manager
      cityName - city display name or protection identifier
      Gibt zurück:
      future containing manager UUIDs
    • findCityManagers

      public CompletableFuture<List<UUID>> findCityManagers(UUID actorId, String cityName, int limit)
      Lists a bounded manager prefix after checking city management authority.
      Parameter:
      actorId - city landlord or delegated manager
      cityName - city display name or protection identifier
      limit - maximum identities returned
      Gibt zurück:
      future containing manager UUIDs
    • findCityManagers

      public CompletableFuture<List<UUID>> findCityManagers(UUID actorId, String cityName, boolean administrative, int limit)
      Lists a bounded manager prefix with an optional administrative authority bypass.
      Parameter:
      actorId - city manager, landlord, or administrator
      cityName - city display name or protection identifier
      administrative - whether the dedicated administrative permission is used
      limit - maximum identities returned
      Gibt zurück:
      future containing manager UUIDs
    • changeCityBuilder

      public CompletableFuture<Void> changeCityBuilder(UUID actorId, String cityName, UUID builderId, boolean adding, boolean administrative)
      Adds or removes a build-only city role and synchronizes all landlord-controlled protection.
      Parameter:
      actorId - city landlord or administrator
      cityName - city display name or protection identifier
      builderId - affected player
      adding - whether the role is added
      administrative - whether the dedicated administrative permission is used
      Gibt zurück:
      completion future
    • findCityBuilders

      public CompletableFuture<List<UUID>> findCityBuilders(UUID actorId, String cityName, boolean administrative, int limit)
      Lists build-only players of a city.
      Parameter:
      actorId - city landlord, manager, or administrator
      cityName - city display name or protection identifier
      administrative - whether management authority may be bypassed
      limit - maximum identities returned
      Gibt zurück:
      future containing builder UUIDs
    • findRegion

      public CompletableFuture<EstateRegion> findRegion(String name)
      Finds a region globally by display name or WorldGuard identifier.
      Parameter:
      name - region name
      Gibt zurück:
      future containing the region
    • migratePriorityModel

      public CompletableFuture<Integer> migratePriorityModel()
      Migrates existing managed WorldGuard regions to the priority-only hierarchy.

      Cities become priority 1, parcels become priority 2, and every legacy parent is removed. Free landlord-controlled parcels receive explicit owner/member domains so removing inherited access never creates a protection lockout.

      Gibt zurück:
      future containing the migrated region count