Klasse EstateRepository
-
Verschachtelte Klassen - Übersicht
Verschachtelte KlassenModifizierer und TypKlasseBeschreibungstatic final recordImmutable audit row used for one transactional batch.static final recordPlayer-facing sale card loaded without exposing internal parent or listing identifiers.static final recordExplicit sellback value carried across structural parcel merges. -
Konstruktorübersicht
KonstruktorenKonstruktorBeschreibungEstateRepository(Database database) Creates a repository backed by the supplied database. -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungvoidaddBuilder(UUID cityId, UUID playerId, UUID actorId) Adds a build-only city role.voidAdds a member or delegated manager to a region.voidaudit(UUID actorId, String action, String targetType, UUID targetId, String oldState, String newState, String detail) Appends an immutable audit entry.voidauditBatch(List<EstateRepository.AuditRecord> records) Appends a bounded audit batch using one connection and one transaction.voidcancelListing(EstateRegion previousRegion, Listing previousListing, RegionState restoredState, UUID actorId) Atomically cancels an active listing, restores its region, and writes an audit entry.intcountAvailable(String cityName) Counts active sale listings, optionally restricted to one city.intcountChildren(UUID parentId) Counts active direct children without materializing their domain snapshots.intcountManagedCities(UUID playerId) Counts cities directly controlled by a landlord or owner.intcountOwnedParcels(UUID ownerId) Counts parcels currently owned by a player for acquisition-limit enforcement.voiddeleteRegion(UUID id) Deletes an unreferenced region.findActiveListing(UUID regionId) Finds the active or reserved listing for a region.findActiveRenter(UUID regionId) Finds the renter whose active contract currently grants WorldGuard member access.findAll()Lists every active managed region with cities before parcels for hierarchy-sensitive operations.Finds the most specific managed region containing an exact block position.findAvailable(String cityName) Lists regions with active sale listings, optionally restricted to a parent city.findAvailable(String cityName, int limit) Returns a bounded prefix of active sale listings.findAvailable(String cityName, int limit, int offset) Returns one bounded market page without materializing preceding rows.findAvailableMarket(String cityName, int limit, int offset) Returns one sale-market page with the user-facing city name and price in the same query.findBuilders(UUID cityId, int limit) Lists build-only players assigned to a city.findChildren(UUID parentId) Lists active direct children of a parent region.findChildrenIntersectingFootprint(UUID parentId, CuboidBounds proposed, int expansion, int limit) Finds only direct children whose X/Z footprint can intersect an expanded proposal.findCitiesIntersectingFootprint(String worldKey, CuboidBounds proposed, int limit) Finds city bounding boxes that can intersect a proposed horizontal footprint.findCitiesManagedBy(UUID playerId) Lists cities directly or indirectly managed by a player.findGeometry(EstateRegion region) Loads the exact polygon and height range of a managed region.findLandlordRestrictedParcels(int limit) Loads parcels where inherited city membership must not grant the landlord gameplay access.findManyChildren(UUID parentId, int limit) Returns a bounded prefix of a region's active direct children.findMembers(UUID regionId, String role) Lists players assigned to a role for a region.findMembers(UUID regionId, String role, int limit) Lists a bounded prefix of players assigned to a role.findOwnedBy(UUID ownerId) Lists regions owned or managed as landlord by a player.findOwnedBy(UUID ownerId, int limit) Returns a bounded prefix of regions owned or managed by a player.findPage(EstateRegion after, int limit) Loads a hierarchy-ordered keyset page of active regions for long-running maintenance jobs.findProtectionIds(RegionType type, int limit) Loads only the lightweight protection identifiers needed by command completion.findRegion(String worldKey, String nameOrProtectionId) Finds a region by display name or protection identifier within one world.findRegionById(UUID id) Finds a region by its internal identifier.findRegionGlobally(String nameOrProtectionId) Finds the first globally matching region by display name or protection identifier.findSuggestedRegionNames(RegionType type, int limit) Loads user-facing display names and stable protection identifiers for command completion.findTeleportPoint(UUID regionId) Finds a region teleport destination.findValueBasis(UUID regionId) Loads the explicit financial value basis used by sellback and sold-parcel merges.voidinsertListing(Listing listing) Inserts a new market listing.voidinsertRegion(EstateRegion region) Inserts a new city or parcel.voidinsertRegionAudited(EstateRegion region, UUID actorId, String action, String detail) Atomically inserts a region and its creation audit entry.booleanChecks whether a player has the build-only role in a city.booleanChecks whether a player has a delegated manager role.booleanChecks whether a player is a regular member of a region.voidmergeParcels(EstateRegion target, EstateRegion source, RegionGeometry geometry, EstateRepository.ValueBasis combinedBasis, UUID actorId) Atomically persists a parcel merge and archives the source parcel.voidpublishResale(EstateRegion previousRegion, Listing listing, UUID actorId) Atomically publishes a resale listing, advances its parcel, and writes the audit entry.voidremoveBuilder(UUID cityId, UUID playerId) Removes a build-only city role.voidremoveMember(UUID regionId, UUID playerId, String role) Removes a member or delegated manager from a region.voidChanges only the user-facing display name of a managed region.voidreplaceGeometry(EstateRegion region, RegionGeometry geometry, UUID actorId, String action, String detail) Atomically replaces polygon vertices, indexed bounds, and the audit trail.booleanreserveListing(UUID listingId, Instant reservedUntil) Exclusively reserves an active listing using a compare-and-set update.voidsetCityLandlord(UUID cityId, UUID landlordId) Atomically changes a city's landlord and propagates the commercial recipient to its parcels.voidAdministratively replaces a region owner without changing its lifecycle state.voidsetTeleportPoint(UUID regionId, TeleportPoint point) Stores or replaces a region teleport destination.voidtransferOwnership(UUID regionId, UUID expectedOwner, UUID newOwner) Atomically transfers a sold parcel and removes all previous member grants.voidupdateListingState(UUID listingId, ListingState state) Updates a listing state and closes terminal listings.voidupdateRegionState(UUID id, RegionState state) Updates a region's lifecycle state.voidupdateRegionStateAndOwner(UUID id, RegionState state, UUID ownerId) Atomically updates a region's lifecycle state and owner.
-
Konstruktordetails
-
EstateRepository
Creates a repository backed by the supplied database.- Parameter:
database- SQLite database owner
-
-
Methodendetails
-
insertRegion
Inserts a new city or parcel.- Parameter:
region- region snapshot to insert- Löst aus:
SQLException- when persistence fails or a constraint is violated
-
insertRegionAudited
public void insertRegionAudited(EstateRegion region, UUID actorId, String action, String detail) throws SQLException Atomically inserts a region and its creation audit entry.- Parameter:
region- region snapshot to insertactorId- actor creating or importing the regionaction- stable audit actiondetail- bounded creation context- Löst aus:
SQLException- when either insert fails
-
findRegionById
Finds a region by its internal identifier.- Parameter:
id- internal region identifier- Gibt zurück:
- matching region, or an empty optional
- Löst aus:
SQLException- when the query fails
-
findRegion
public Optional<EstateRegion> findRegion(String worldKey, String nameOrProtectionId) throws SQLException Finds a region by display name or protection identifier within one world.- Parameter:
worldKey- owning world keynameOrProtectionId- display name or WorldGuard identifier- Gibt zurück:
- matching region, or an empty optional
- Löst aus:
SQLException- when the query fails
-
findRegionGlobally
Finds the first globally matching region by display name or protection identifier.- Parameter:
nameOrProtectionId- display name or WorldGuard identifier- Gibt zurück:
- matching region, or an empty optional
- Löst aus:
SQLException- when the query fails
-
findAt
Finds the most specific managed region containing an exact block position.Parcels are preferred over cities, followed by the smallest volume and a stable protection identifier.
- Parameter:
worldKey- Bukkit world keyx- block X coordinatey- block Y coordinatez- block Z coordinate- Gibt zurück:
- most specific containing region when managed
- Löst aus:
SQLException- when the query fails
-
findGeometry
Loads the exact polygon and height range of a managed region.Legacy databases are populated by migration V013. The rectangular fallback keeps repository fixtures and manually repaired databases readable when no geometry rows exist.
- Parameter:
region- region snapshot whose geometry is requested- Gibt zurück:
- exact persisted geometry or an equivalent rectangular fallback
- Löst aus:
SQLException- when the vertex query fails
-
replaceGeometry
public void replaceGeometry(EstateRegion region, RegionGeometry geometry, UUID actorId, String action, String detail) throws SQLException Atomically replaces polygon vertices, indexed bounds, and the audit trail.- Parameter:
region- current region snapshotgeometry- replacement geometryactorId- actor performing the changeaction- stable audit actiondetail- bounded audit detail- Löst aus:
SQLException- when optimistic locking or persistence fails
-
mergeParcels
public void mergeParcels(EstateRegion target, EstateRegion source, RegionGeometry geometry, EstateRepository.ValueBasis combinedBasis, UUID actorId) throws SQLException Atomically persists a parcel merge and archives the source parcel.Target settings remain authoritative. Source access grants, displays, teleport points, group links, home grants, offer defaults, and obsolete infrastructure metadata are removed so archived records cannot continue affecting gameplay.
- Parameter:
target- retained parcelsource- archived source parcelgeometry- combined target geometrycombinedBasis- optional combined financial basis for a sold targetactorId- actor performing the merge- Löst aus:
SQLException- when optimistic locking or persistence fails
-
findValueBasis
Loads the explicit financial value basis used by sellback and sold-parcel merges.- Parameter:
regionId- parcel identifier- Gibt zurück:
- current basis when the parcel has completed purchase history
- Löst aus:
SQLException- when the query fails
-
findChildren
Lists active direct children of a parent region.Regions archived by a parcel merge are excluded. Their WorldGuard region no longer exists, so treating them as live children would block city deletion, height changes, and access synchronization.
- Parameter:
parentId- parent region identifier- Gibt zurück:
- children ordered by display name
- Löst aus:
SQLException- when the query fails
-
findManyChildren
Returns a bounded prefix of a region's active direct children.- Parameter:
parentId- parent region identifierlimit- maximum number of rows to return- Gibt zurück:
- children ordered by display name
- Löst aus:
SQLException- when the query fails
-
countChildren
Counts active direct children without materializing their domain snapshots.- Parameter:
parentId- parent region identifier- Gibt zurück:
- direct child count excluding merged archives
- Löst aus:
SQLException- when the query fails
-
findChildrenIntersectingFootprint
public List<EstateRegion> findChildrenIntersectingFootprint(UUID parentId, CuboidBounds proposed, int expansion, int limit) throws SQLException Finds only direct children whose X/Z footprint can intersect an expanded proposal.Vertical overlap remains a domain-policy decision. Filtering X/Z in SQLite avoids materializing every parcel of a large city for one local geometry check.
- Parameter:
parentId- parent city identifierproposed- proposed parcel boundsexpansion- horizontal expansion applied on all sideslimit- maximum candidate rows- Gibt zurück:
- stable geometry candidate snapshots
- Löst aus:
SQLException- when the query fails
-
findCitiesIntersectingFootprint
public List<EstateRegion> findCitiesIntersectingFootprint(String worldKey, CuboidBounds proposed, int limit) throws SQLException Finds city bounding boxes that can intersect a proposed horizontal footprint.- Parameter:
worldKey- Bukkit world keyproposed- proposed bounding cuboidlimit- maximum candidate count- Gibt zurück:
- stable city candidates for exact polygon checks
- Löst aus:
SQLException- when the query fails
-
findOwnedBy
Lists regions owned or managed as landlord by a player.- Parameter:
ownerId- player identifier- Gibt zurück:
- matching regions
- Löst aus:
SQLException- when the query fails
-
findOwnedBy
Returns a bounded prefix of regions owned or managed by a player.- Parameter:
ownerId- player identifierlimit- maximum number of rows to return- Gibt zurück:
- matching regions ordered by display name
- Löst aus:
SQLException- when the query fails
-
findLandlordRestrictedParcels
Loads parcels where inherited city membership must not grant the landlord gameplay access. Sold player property and actively rented property are both isolated from the city landlord.- Parameter:
limit- maximum parcel count- Gibt zurück:
- immutable restricted parcel snapshots
- Löst aus:
SQLException- when the query fails
-
countOwnedParcels
Counts parcels currently owned by a player for acquisition-limit enforcement.- Parameter:
ownerId- player identifier- Gibt zurück:
- owned parcel count
- Löst aus:
SQLException- when the query fails
-
countManagedCities
Counts cities directly controlled by a landlord or owner.- Parameter:
playerId- player identifier- Gibt zurück:
- managed city count
- Löst aus:
SQLException- when the query fails
-
findAvailable
Lists regions with active sale listings, optionally restricted to a parent city.- Parameter:
cityName- optional city display name or protection identifier- Gibt zurück:
- saleable regions ordered by display name
- Löst aus:
SQLException- when the query fails
-
findAvailable
Returns a bounded prefix of active sale listings.- Parameter:
cityName- optional city display name or protection identifierlimit- maximum number of rows to return- Gibt zurück:
- saleable regions ordered by display name
- Löst aus:
SQLException- when the query fails
-
findAvailable
Returns one bounded market page without materializing preceding rows.- Parameter:
cityName- optional city display name or protection identifierlimit- maximum number of rows to returnoffset- number of matching rows to skip- Gibt zurück:
- saleable regions ordered by display name
- Löst aus:
SQLException- when the query fails
-
findAvailableMarket
public List<EstateRepository.MarketListing> findAvailableMarket(String cityName, int limit, int offset) throws SQLException Returns one sale-market page with the user-facing city name and price in the same query.- Parameter:
cityName- optional city display name or protection identifierlimit- maximum number of rowsoffset- number of matching rows to skip- Gibt zurück:
- sale cards ordered by parcel display name
- Löst aus:
SQLException- when the query fails
-
countAvailable
Counts active sale listings, optionally restricted to one city.- Parameter:
cityName- optional city display name or protection identifier- Gibt zurück:
- matching listing count
- Löst aus:
SQLException- when the query fails
-
findAll
Lists every active managed region with cities before parcels for hierarchy-sensitive operations.Merged archives are excluded because their WorldGuard region was removed during the merge. Including them would abort startup priority enforcement with a missing-region failure.
- Gibt zurück:
- all live regions in stable hierarchy order
- Löst aus:
SQLException- when the query fails
-
findPage
Loads a hierarchy-ordered keyset page of active regions for long-running maintenance jobs.Merged archives are excluded so reconciliation never reports or recreates a WorldGuard region that the merge deliberately removed.
- Parameter:
after- previous page's last region, ornullfor the first pagelimit- maximum rows returned- Gibt zurück:
- immutable page with cities before parcels
- Löst aus:
SQLException- when the query fails
-
findProtectionIds
Loads only the lightweight protection identifiers needed by command completion.- Parameter:
type- optional region type restrictionlimit- maximum number of identifiers to return- Gibt zurück:
- immutable, case-insensitively ordered identifiers
- Löst aus:
SQLException- when the query fails
-
findSuggestedRegionNames
Loads user-facing display names and stable protection identifiers for command completion. Duplicate values are removed case-insensitively while stable identifiers remain available as an unambiguous fallback.- Parameter:
type- optional region type restrictionlimit- maximum number of returned suggestions- Gibt zurück:
- immutable, case-insensitively ordered lookup values
- Löst aus:
SQLException- when the query fails
-
findActiveRenter
Finds the renter whose active contract currently grants WorldGuard member access.- Parameter:
regionId- rented region identifier- Gibt zurück:
- active renter when present
- Löst aus:
SQLException- when the query fails
-
findCitiesManagedBy
Lists cities directly or indirectly managed by a player.- Parameter:
playerId- player identifier- Gibt zurück:
- managed cities
- Löst aus:
SQLException- when the query fails
-
isManager
Checks whether a player has a delegated manager role.- Parameter:
regionId- city identifierplayerId- player identifier- Gibt zurück:
truewhen the manager assignment exists- Löst aus:
SQLException- when the query fails
-
isBuilder
Checks whether a player has the build-only role in a city.- Parameter:
cityId- city identifierplayerId- player identifier- Gibt zurück:
truewhen the builder assignment exists- Löst aus:
SQLException- when the query fails
-
findBuilders
Lists build-only players assigned to a city.- Parameter:
cityId- city identifierlimit- maximum identities returned- Gibt zurück:
- immutable builder UUIDs
- Löst aus:
SQLException- when the query fails
-
addBuilder
Adds a build-only city role.- Parameter:
cityId- city identifierplayerId- builder identifieractorId- assigning actor- Löst aus:
SQLException- when the role already exists or persistence fails
-
removeBuilder
Removes a build-only city role.- Parameter:
cityId- city identifierplayerId- builder identifier- Löst aus:
SQLException- when the role is missing or persistence fails
-
updateRegionStateAndOwner
Atomically updates a region's lifecycle state and owner.- Parameter:
id- region identifierstate- new lifecycle stateownerId- new owner, ornull- Löst aus:
SQLException- when the update fails
-
transferOwnership
Atomically transfers a sold parcel and removes all previous member grants.- Parameter:
regionId- region identifierexpectedOwner- current owner used for compare-and-set protectionnewOwner- new owner- Löst aus:
SQLException- when ownership changed concurrently or persistence fails
-
setOwner
Administratively replaces a region owner without changing its lifecycle state.- Parameter:
regionId- region identifierownerId- replacement owner- Löst aus:
SQLException- when the region is missing or persistence fails
-
setCityLandlord
Atomically changes a city's landlord and propagates the commercial recipient to its parcels.- Parameter:
cityId- city identifierlandlordId- replacement landlord- Löst aus:
SQLException- when the city is missing or persistence fails
-
rename
Changes only the user-facing display name of a managed region.- Parameter:
regionId- region identifierdisplayName- replacement display name- Löst aus:
SQLException- when the region is missing or persistence fails
-
updateRegionState
Updates a region's lifecycle state.- Parameter:
id- region identifierstate- new lifecycle state- Löst aus:
SQLException- when the update fails
-
deleteRegion
Deletes an unreferenced region.- Parameter:
id- region identifier- Löst aus:
SQLException- when deletion fails or references still exist
-
insertListing
Inserts a new market listing.- Parameter:
listing- listing snapshot- Löst aus:
SQLException- when persistence fails or an active listing already exists
-
publishResale
public void publishResale(EstateRegion previousRegion, Listing listing, UUID actorId) throws SQLException Atomically publishes a resale listing, advances its parcel, and writes the audit entry.- Parameter:
previousRegion- sold parcel snapshot used for optimistic authorizationlisting- proposed active resale listingactorId- owner publishing the listing- Löst aus:
SQLException- when the parcel changed concurrently or persistence fails
-
cancelListing
public void cancelListing(EstateRegion previousRegion, Listing previousListing, RegionState restoredState, UUID actorId) throws SQLException Atomically cancels an active listing, restores its region, and writes an audit entry.- Parameter:
previousRegion- region snapshot before cancellationpreviousListing- active listing snapshotrestoredState- resulting region stateactorId- authorized seller or administrator- Löst aus:
SQLException- when either snapshot changed concurrently or persistence fails
-
findActiveListing
Finds the active or reserved listing for a region.- Parameter:
regionId- region identifier- Gibt zurück:
- active listing, or an empty optional
- Löst aus:
SQLException- when the query fails
-
reserveListing
Exclusively reserves an active listing using a compare-and-set update.- Parameter:
listingId- listing identifierreservedUntil- reservation expiry- Gibt zurück:
truewhen this caller acquired the reservation- Löst aus:
SQLException- when the update fails
-
updateListingState
Updates a listing state and closes terminal listings.- Parameter:
listingId- listing identifierstate- new listing state- Löst aus:
SQLException- when the update fails
-
addMember
Adds a member or delegated manager to a region.- Parameter:
regionId- region identifierplayerId- assigned playerrole- persistent role nameactorId- player performing the assignment- Löst aus:
SQLException- when persistence fails
-
removeMember
Removes a member or delegated manager from a region.- Parameter:
regionId- region identifierplayerId- assigned playerrole- persistent role name- Löst aus:
SQLException- when deletion fails
-
findMembers
Lists players assigned to a role for a region.- Parameter:
regionId- region identifierrole- persistent role name- Gibt zurück:
- assigned player identifiers
- Löst aus:
SQLException- when the query fails
-
findMembers
Lists a bounded prefix of players assigned to a role.- Parameter:
regionId- region identifierrole- persistent role namelimit- maximum identities returned- Gibt zurück:
- assigned player identifiers in stable order
- Löst aus:
SQLException- when the query fails
-
setTeleportPoint
Stores or replaces a region teleport destination.- Parameter:
regionId- region identifierpoint- teleport destination- Löst aus:
SQLException- when persistence fails
-
findTeleportPoint
Finds a region teleport destination.- Parameter:
regionId- region identifier- Gibt zurück:
- saved teleport destination, or an empty optional
- Löst aus:
SQLException- when the query fails
-
isMember
Checks whether a player is a regular member of a region.- Parameter:
regionId- region identifierplayerId- player identifier- Gibt zurück:
truewhen membership exists- Löst aus:
SQLException- when the query fails
-
audit
public void audit(UUID actorId, String action, String targetType, UUID targetId, String oldState, String newState, String detail) throws SQLException Appends an immutable audit entry.- Parameter:
actorId- actor identifier, ornullfor the systemaction- action nametargetType- audited object typetargetId- audited object identifieroldState- previous statenewState- resulting statedetail- optional contextual detail- Löst aus:
SQLException- when persistence fails
-
auditBatch
Appends a bounded audit batch using one connection and one transaction.- Parameter:
records- immutable audit rows- Löst aus:
SQLException- when any row fails; no row is then committed
-