#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.enchantments;
import com.google.common.base.Preconditions;
import com.google.common.collect.Lists;
import java.util.Locale;
import org.bukkit.Keyed;
@@ -230,12 +229,7 @@ public abstract class Enchantment implements Keyed, Translatable {
@NotNull
private static Enchantment getEnchantment(@NotNull String key) {
NamespacedKey namespacedKey = NamespacedKey.minecraft(key);
Enchantment enchantment = Registry.ENCHANTMENT.get(namespacedKey);
Preconditions.checkNotNull(enchantment, "No Enchantment found for %s. This is a bug.", namespacedKey);
return enchantment;
return Registry.ENCHANTMENT.getOrThrow(NamespacedKey.minecraft(key));
}
/**