Repository navigation
Automation Chain
The Automation Chain is SASL's ownership-aware protection layer for automated inventory transfers.
Introduced in the 2.8.2 codebase, this system evaluates item movement between inventories and checks the ownership of the automation components involved. It is designed to prevent automated transfer paths from crossing ownership boundaries without authorization.
Unlike a simple hopper cancellation system, SASL resolves the owners of the source and destination inventories before deciding whether a transfer should be blocked.
SASL monitors automated inventory movement through Bukkit's InventoryMoveItemEvent.
For each transfer attempt, the system retrieves:
- Source Inventory: The inventory from which the item is taken.
- Destination Inventory: The inventory receiving the item.
- Source Owner: The resolved owner of the source.
- Destination Owner: The resolved owner of the destination.
- Automation State: Whether either side belongs to a recognized automation component.
If neither side is recognized as an automation component, the transfer-protection handler exits without applying its ownership rules.
The system then evaluates the ownership relationship between both sides.
SASL applies three main ownership checks.
| Condition | Result |
|---|---|
| Both sides have owners, but their UUIDs are different | Transfer blocked |
| Source has an owner, destination is an unowned automation component | Transfer blocked |
| Destination has an owner, source is an unowned automation component | Transfer blocked |
When none of these conditions is met, this ownership-checking stage does not cancel the transfer.
When both sides resolve to the same owner UUID, the ownership comparison does not block the transfer.
This allows automation components belonging to the same owner to exchange items without being rejected by the different-owner rule.
An unowned automation component is not automatically treated as belonging to the player who placed another component nearby.
When one side is owned and the opposite automation side has no resolved owner, SASL blocks that transfer direction.
The transfer handler uses a unified ownership-resolution path through getTransitOwner().
It identifies the inventory holder and retrieves ownership according to its type.
Hopper ownership is resolved through the following sequence:
- Check the in-memory hopper ownership cache.
- If no cached owner exists, inspect the hopper's Persistent Data Container.
- Read and validate the stored UUID.
- If a valid UUID is found, place it into the RAM cache.
- If PDC does not provide a valid owner, query
LockSecurityManager.getOwnerSafe().
This allows SASL to reuse previously resolved ownership data instead of repeatedly performing the same lookup.
Hopper minecart ownership uses a separate entity-based lookup:
- Retrieve the minecart's entity UUID.
- Check the minecart ownership cache.
- If the cache does not contain an owner, inspect the entity's Persistent Data Container.
- Parse the stored owner UUID.
- Cache the resolved owner for subsequent lookups.
The minecart cache is keyed by entity UUID rather than block coordinates.
The unified resolver also handles other inventory holders:
-
Double Chests: Resolves ownership through the chest block and
LockSecurityManager. -
Other BlockState Inventories: Uses
LockSecurityManager.getOwnerSafe().
This lets the transfer handler compare automation ownership against the ownership of protected container inventories.
Hopper ownership is stored in a world-aware cache structure.
The cache separates entries by world UUID:
- Each world has its own hopper ownership map.
- Hopper positions are represented using packed block-coordinate keys.
- Owner UUIDs are stored as map values.
- The underlying FastUtil map is wrapped with synchronized access.
This structure prevents hopper coordinates from being treated as globally unique across different worlds.
When a hopper owner is added:
- SASL obtains the map associated with the hopper's world.
- If no map exists, a new map is created.
- The hopper's packed block key is associated with its owner UUID.
- The insertion is performed inside the map's synchronization boundary.
The current implementation also contains a per-world soft-cap eviction path. When the configured internal threshold is reached, an existing map entry is removed before the new owner entry is inserted.
When a hopper ownership entry is removed:
- SASL locates the corresponding world map.
- Removes the hopper's packed coordinate key.
- Removes the world map itself if it becomes empty.
This avoids retaining empty world-level cache containers.
Hopper minecarts use a separate cache:
minecartOwnerCache
Its key is the minecart entity UUID, and its value is the owner's UUID.
The cache provides three main operations:
| Method | Purpose |
|---|---|
getMinecartOwner(UUID) |
Retrieves the cached owner |
setMinecartOwner(UUID, UUID) |
Stores an owner association |
removeMinecartOwner(UUID) |
Removes an entity's owner association |
The insertion method checks the configured hard-cap constant before accepting a new entry.
The minecart's PDC remains an additional ownership source, allowing the resolver to repopulate the RAM cache when the entity is inspected again.
Repeatedly evaluating the same denied transfer pair can create unnecessary work.
SASL therefore maintains a separate deniedTransferCache.
This cache does not store inventory ownership. Instead, it records recently denied source-destination pairs.
The transfer handler builds a pair key using:
- The source holder's raw block key.
- The destination holder's raw block key.
- The
mix64mixing function. - A bit rotation and XOR operation to combine the values.
If a valid pair key is available, SASL checks whether that pair was denied recently.
If the denial timestamp is still inside DENY_COOLDOWN_MS, the transfer is cancelled immediately without repeating the full ownership comparison.
If the pair is not inside the cooldown period, normal ownership resolution continues.
The denied-transfer cache also has a hard-cap check.
When its capacity is reached, SASL sets the denyOverCap flag instead of inserting another entry.
This prevents the event handler from continuing to grow the cache beyond its configured internal limit.
The denied-transfer cache is also maintained by the Maximus runtime maintenance system.
The Rapid Sweeper runs every 100 ticks, approximately every 5 seconds under normal server tick timing.
It performs two maintenance operations:
Expired Entry Cleanup
- Checks stored denial timestamps.
- Removes entries older than
SecurityListener.DENY_COOLDOWN_MS.
Over-Cap Recovery
- Checks the
denyOverCapflag. - Resets the flag when triggered.
- Clears the denied-transfer cache.
This keeps temporary transfer-denial data from accumulating indefinitely.
The hopper and minecart ownership caches are separate from this temporary denial cache.
The main configuration switch is:
settings.prevent-hopper-transfer
Default configuration:
settings:
prevent-hopper-transfer: true
| Value | Behavior |
|---|---|
true |
Enables the ownership-aware transfer protection handler |
false |
The handler exits without applying its transfer ownership checks |
The default value in the inspected configuration is true.
Disabling this setting does not mean that every other SASL protection mechanism is disabled. It specifically disables this transfer-protection handler.
The inspected 2.8.2 implementation contains the following mechanisms:
- Ownership-aware inventory transfer evaluation.
- Hopper block ownership lookup.
- Hopper minecart ownership lookup.
- PDC-based owner resolution.
- Multiworld hopper ownership caching.
- Entity UUID-based minecart ownership caching.
- Double-chest owner resolution during transfer evaluation.
- Different-owner transfer rejection.
- Owned-to-unowned automation boundary protection.
- Recent denied-transfer pair caching.
- Hard-cap handling for temporary denial data.
- Maximus cleanup of expired denial entries.
The Automation Chain should be understood as an ownership-aware transfer protection system, not as a universal automation-management framework.
The current implementation does not establish the following claims:
- Every possible inventory transfer is blocked.
- Every unowned inventory is automatically protected.
- All automation types have persistent owner records.
- Hopper ownership is stored in a separate database.
- Minecart ownership is stored in a separate database.
- The transfer cache guarantees a specific TPS improvement.
- Every minecart type receives identical player-interaction protection.
The transfer handler operates on the inventory holders and ownership information it can resolve.
Its behavior is determined by the actual ownership checks and configuration state described above.
SASL Colossus v2.8.2 — Automation Chain
Ownership-aware automation transfer protection, backed by dedicated hopper and minecart ownership caches.