#1058: Add tests for Minecraft registry <-> Bukkit fields

By: DerFrZocker <derrieple@gmail.com>
This commit is contained in:
Bukkit/Spigot
2024-09-27 08:15:05 +10:00
parent 49d12d442a
commit 42cd6c82ff
21 changed files with 147 additions and 121 deletions

View File

@@ -1,6 +1,5 @@
package org.bukkit;
import java.util.Objects;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
@@ -31,7 +30,7 @@ public interface JukeboxSong extends Keyed, Translatable {
public static final JukeboxSong CREATOR_MUSIC_BOX = get("creator_music_box");
@NotNull
private static JukeboxSong get(@NotNull String s) {
return Objects.requireNonNull(Registry.JUKEBOX_SONG.get(NamespacedKey.minecraft(s)), "Missing song " + s);
private static JukeboxSong get(@NotNull String key) {
return Registry.JUKEBOX_SONG.getOrThrow(NamespacedKey.minecraft(key));
}
}