Repository navigation
Structural Integrity Protocol
Traditional locking systems often treat every block as an independent object. SecureAutoSmartLocks (SASL) takes a different approach.
Its structural integrity system understands the physical relationships between supported multi-block structures and resolves their authoritative lock identity through a centralized geometry engine.
Instead of treating every structural component as an unrelated lock, SASL can identify the relationship between connected blocks and determine which block represents the structure's primary lock authority.
SASL uses a centralized Master Resolution system to determine the authoritative block of a supported multi-block structure.
The system is built around three primary operations:
- Effective Block Resolution: Determines which physical or repository-backed block identity should be used for security operations.
- Partner Detection: Identifies the other structural component of a supported multi-block structure.
- Master Resolution: Selects a deterministic authority block for the structure.
The Master is the authoritative block used for the structure's primary lock identity.
It is responsible for the canonical repository key and the associated lock record.
The Partner is the connected physical component of the structure.
For supported double chests, SASL synchronizes the physical lock state of both halves while maintaining a single authoritative repository record.
Double chests require special handling because Minecraft represents them as two connected physical blocks.
SASL's geometry engine identifies their relationship through Bukkit's chest block data.
The engine examines:
- Chest facing direction.
- Chest half type (
LEFTorRIGHT). - Physical neighboring blocks.
- Neighbor chunk availability.
When the chest already has valid LEFT or RIGHT block data, SASL calculates the expected partner direction.
If the chest is still reported as SINGLE, the engine uses a directional fallback scan to inspect the relevant neighboring positions.
This is particularly useful during block placement events, where the final double-chest state may not yet be fully reflected in the block data.
Once both halves are identified, SASL selects the Master using a deterministic coordinate comparison.
The selection order is:
- Lowest Y coordinate.
- Lowest X coordinate.
- Lowest Z coordinate.
This ensures that the same physical structure resolves to the same Master regardless of which half is accessed first.
When a double chest is formed, reconcileDoubleChest() performs the repository reconciliation process.
Its responsibilities include:
- Identifying the Master and Partner.
- Checking the existing lock records.
- Moving an eligible Partner-side record to the Master key when necessary.
- Removing the redundant Partner-side repository record.
- Invalidating the old Partner cache entry.
- Registering the Master in the security caches.
- Marking the repository as dirty.
- Scheduling an asynchronous repository save.
The resulting structure uses one authoritative lock record instead of maintaining two independent records for the same double chest.
After repository reconciliation, SASL applies the physical lock state to both chest halves.
The Master and Partner receive the corresponding owner, expiration and lock status information.
This keeps the physical representation of the double chest aligned with its authoritative lock record.
SASL also includes dedicated geometry handling for doors.
Unlike double chests, doors are resolved through their vertical structure.
A door consists of two physical blocks:
BOTTOMTOP
SASL treats the bottom half as the authoritative block.
When the geometry resolver receives the upper half, it redirects the resolution to the lower half.
The getPartnerBlock() method also identifies the lower half when processing a door's upper block.
SASL provides an additional structural lookup through getLockedDoorSupportedBy().
This method checks whether a support block has a locked door directly above it and returns the door's bottom half when the conditions are satisfied.
Important: Door geometry resolution is not the same as double-chest repository reconciliation. The implementation shown uses the bottom half as the door's authority; it does not demonstrate the same two-record migration and physical synchronization workflow used for double chests.
A block may no longer exist physically while its lock record remains in the repository.
SASL addresses this situation through getEffectiveBlock() and its repository-backed material resolution.
When the target block is AIR, the system:
- Generates the block's raw coordinate key.
- Queries the Lock Repository for its existing record.
- Reads the saved material information.
- Attempts to resolve the original material.
- Continues with geometry resolution when the recovered material belongs to a supported complex structure.
If no valid material can be recovered, the resolver stops and returns the original block reference.
This allows SASL to distinguish between a physically missing block and a block identity that may still be represented by repository data.
Structural resolution must not force unloaded chunks into memory.
SASL uses chunk availability checks before accessing neighboring blocks during chest partner detection.
The geometry engine checks whether the target chunk is already loaded before attempting to inspect the corresponding neighboring block.
If the required chunk is unavailable, partner detection is skipped rather than forcing a synchronous chunk load.
This keeps structural lookups from unnecessarily triggering chunk loading.
SASL separates a block's raw coordinate identity from its resolved structural identity.
getRawBlockKey() generates the key for the exact block coordinates without redirecting to a Master.
This is useful when the system needs to inspect or modify an individual structural component.
getBlockKey() resolves supported complex geometry through the Effective Block Resolver before generating the final key.
As a result, interactions with different parts of a supported structure can resolve to the same authoritative lock identity.
This distinction is important for preventing redundant lock records and maintaining consistent access-control decisions.
- Unified Identity: Supported multi-block structures can share one authoritative lock identity.
- Deterministic Resolution: Master selection follows a consistent coordinate-based rule.
- Repository Consistency: Double-chest reconciliation removes redundant Partner-side records.
- Physical Synchronization: Both halves of a reconciled double chest receive the corresponding physical lock state.
- Ghost Identity Handling: Repository-backed material resolution helps identify blocks whose physical state no longer matches their saved lock data.
- Chunk Awareness: Neighbor inspection is guarded by chunk availability checks.
- Centralized Geometry: Structural identity resolution is handled through shared geometry methods rather than separate ad-hoc checks.
Architected by Protocol-S Development
Lead Dev: RunningArmy6