Location Store
In-memory index over every despawn location. Replaces the old flat ArrayList that was copied and linearly scanned on every query and rewritten to disk in full on every change. Provides:
a spatial index (byBlock) — block position → owners at that block;
an owner index (byOwner) — owner → their locations (for limits & bulk ops);
a flat bag with swap-remove for O(1) uniform randomOrNull draw;
dirty-owner tracking so persistence writes only the owners that changed.
Not thread-safe by design: it is mutated only from the server main thread (events and commands). Async persistence takes a snapshot on the main thread first.
Functions
Adds loc. Returns false (no-op) if that owner already has that block.
Immutable snapshot of all locations.
How many locations owner has (used for per-user limits).
Owners whose data changed since the last clearDirty.
Owners that currently have at least one location (for full flush / file cleanup).
A uniformly random location (with replacement), or null if empty.
Removes loc. Returns false if it was not present.
Removes every location owned by owner; returns how many were removed.
Replaces all contents with locations without marking anything dirty (used on load).