fix(stats): skip registry entries without keys
Release / release (push) Successful in 2m18s
CI / build (push) Successful in 1m3s

This commit is contained in:
dmg
2026-08-08 14:52:01 -04:00
parent 03acea6ba5
commit bd48e33ace
4 changed files with 16 additions and 1 deletions
@@ -7,7 +7,11 @@ final class BukkitRegistryKeys {
private BukkitRegistryKeys() {}
static NamespacedKey get(Keyed value) {
return value.getKey();
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));
}
}