fix(stats): skip registry entries without keys
This commit is contained in:
@@ -10,3 +10,4 @@ description: Chronological record of material changes to the design knowledge bu
|
||||
|
||||
- Established the OKF v0.1 design bundle.
|
||||
- Documented the existing configuration, event production, activity capture, snapshots, durable delivery, and release workflows as user stories.
|
||||
- Made snapshot collection skip Bukkit registry entries whose keys are unavailable.
|
||||
|
||||
@@ -13,6 +13,7 @@ As a **server analyst**, I want periodic player location and statistic snapshots
|
||||
|
||||
- [x] Each configured interval captures every online player's world identity, coordinates, orientation, game mode, and biome.
|
||||
- [x] Registry-backed snapshot values use Bukkit's stable `Keyed` contract so collection remains compatible with the supported Purpur runtime.
|
||||
- [x] Unkeyed registry entries such as `EntityType.UNKNOWN` are skipped without throwing or interrupting snapshot collection.
|
||||
- [x] Every Bukkit untyped, block, item, and entity statistic combination accepted by Bukkit is captured, including zero values.
|
||||
- [x] Invalid statistic subtype combinations are skipped without stopping the snapshot.
|
||||
- [x] Statistic reads are spread across ticks according to a configurable operation budget and run through Bukkit scheduling.
|
||||
|
||||
@@ -7,7 +7,11 @@ final class BukkitRegistryKeys {
|
||||
private BukkitRegistryKeys() {}
|
||||
|
||||
static NamespacedKey get(Keyed value) {
|
||||
try {
|
||||
return value.getKey();
|
||||
} catch (IllegalArgumentException ignored) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
static String format(Keyed value, String fallback) {
|
||||
|
||||
@@ -21,4 +21,13 @@ class BukkitRegistryKeysTest {
|
||||
|
||||
assertNull(BukkitRegistryKeys.get(keyed));
|
||||
}
|
||||
|
||||
@Test
|
||||
void reportsAKeyThatBukkitRejectsAsUnavailable() {
|
||||
Keyed keyed = () -> {
|
||||
throw new IllegalArgumentException("Registry entry does not have a key");
|
||||
};
|
||||
|
||||
assertNull(BukkitRegistryKeys.get(keyed));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user