Improve Registry#getOrThrow messages

By: md_5 <git@md-5.net>
This commit is contained in:
Bukkit/Spigot 2024-09-27 08:21:26 +10:00
parent 42cd6c82ff
commit 5f8dbb00f6
2 changed files with 5 additions and 5 deletions

View file

@ -65,7 +65,7 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
public Advancement getOrThrow(@NotNull NamespacedKey key) {
Advancement advancement = get(key);
Preconditions.checkArgument(advancement != null, "No registry entry found for key " + key);
Preconditions.checkArgument(advancement != null, "No Advancement registry entry found for key %s.", key);
return advancement;
}
@ -133,7 +133,7 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
public KeyedBossBar getOrThrow(@NotNull NamespacedKey key) {
KeyedBossBar keyedBossBar = get(key);
Preconditions.checkArgument(keyedBossBar != null, "No registry entry found for key " + key);
Preconditions.checkArgument(keyedBossBar != null, "No KeyedBossBar registry entry found for key %s.", key);
return keyedBossBar;
}
@ -307,7 +307,7 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
public MemoryKey getOrThrow(@NotNull NamespacedKey key) {
MemoryKey memoryKey = get(key);
Preconditions.checkArgument(memoryKey != null, "No registry entry found for key " + key);
Preconditions.checkArgument(memoryKey != null, "No MemoryKey registry entry found for key %s.", key);
return memoryKey;
}
@ -428,7 +428,7 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
public T getOrThrow(@NotNull NamespacedKey key) {
T object = get(key);
Preconditions.checkArgument(object != null, "No registry entry found for key " + key);
Preconditions.checkArgument(object != null, "No %s registry entry found for key %s.", type, key);
return object;
}

View file

@ -63,7 +63,7 @@ public final class TestServer {
public Keyed getOrThrow(@NotNull NamespacedKey key) {
Keyed keyed = get(key);
Preconditions.checkArgument(keyed != null, "No registry entry found for key " + key);
Preconditions.checkArgument(keyed != null, "No %s registry entry found for key %s.", aClass, key);
return keyed;
}