diff --git a/patches/server/Improve-Registry.patch b/patches/server/Improve-Registry.patch index cb1832e0bf..8627a2716b 100644 --- a/patches/server/Improve-Registry.patch +++ b/patches/server/Improve-Registry.patch @@ -4,6 +4,30 @@ Date: Wed, 20 Dec 2023 02:03:05 -0800 Subject: [PATCH] Improve Registry +diff --git a/src/main/java/org/bukkit/craftbukkit/CraftArt.java b/src/main/java/org/bukkit/craftbukkit/CraftArt.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/org/bukkit/craftbukkit/CraftArt.java ++++ b/src/main/java/org/bukkit/craftbukkit/CraftArt.java +@@ -0,0 +0,0 @@ public class CraftArt implements Art, Handleable { + @NotNull + @Override + public NamespacedKey getKey() { ++ if (true) return java.util.Objects.requireNonNull(org.bukkit.Registry.ART.getKey(this), () -> this + " doesn't have a key"); // Paper + return this.key; + } + +diff --git a/src/main/java/org/bukkit/craftbukkit/CraftMusicInstrument.java b/src/main/java/org/bukkit/craftbukkit/CraftMusicInstrument.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/org/bukkit/craftbukkit/CraftMusicInstrument.java ++++ b/src/main/java/org/bukkit/craftbukkit/CraftMusicInstrument.java +@@ -0,0 +0,0 @@ public class CraftMusicInstrument extends MusicInstrument implements Handleable< + @NotNull + @Override + public NamespacedKey getKey() { ++ if (true) return java.util.Objects.requireNonNull(org.bukkit.Registry.INSTRUMENT.getKey(this), () -> this + " doesn't have a key"); // Paper + return this.key; + } + diff --git a/src/main/java/org/bukkit/craftbukkit/CraftRegistry.java b/src/main/java/org/bukkit/craftbukkit/CraftRegistry.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftRegistry.java @@ -36,6 +60,42 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + // Paper end - improve Registry } +diff --git a/src/main/java/org/bukkit/craftbukkit/CraftSound.java b/src/main/java/org/bukkit/craftbukkit/CraftSound.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/org/bukkit/craftbukkit/CraftSound.java ++++ b/src/main/java/org/bukkit/craftbukkit/CraftSound.java +@@ -0,0 +0,0 @@ public class CraftSound implements Sound, Handleable { + @NotNull + @Override + public NamespacedKey getKey() { ++ if (true) return java.util.Objects.requireNonNull(org.bukkit.Registry.SOUNDS.getKey(this), () -> this + " doesn't have a key"); // Paper + return this.key; + } + +diff --git a/src/main/java/org/bukkit/craftbukkit/block/banner/CraftPatternType.java b/src/main/java/org/bukkit/craftbukkit/block/banner/CraftPatternType.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/org/bukkit/craftbukkit/block/banner/CraftPatternType.java ++++ b/src/main/java/org/bukkit/craftbukkit/block/banner/CraftPatternType.java +@@ -0,0 +0,0 @@ public class CraftPatternType implements PatternType, Handleable + + @Override + public NamespacedKey getKey() { ++ if (true) return java.util.Objects.requireNonNull(org.bukkit.Registry.BANNER_PATTERN.getKey(this), () -> this + " doesn't have a key"); // Paper + return this.key; + } + +diff --git a/src/main/java/org/bukkit/craftbukkit/generator/structure/CraftStructure.java b/src/main/java/org/bukkit/craftbukkit/generator/structure/CraftStructure.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/org/bukkit/craftbukkit/generator/structure/CraftStructure.java ++++ b/src/main/java/org/bukkit/craftbukkit/generator/structure/CraftStructure.java +@@ -0,0 +0,0 @@ public class CraftStructure extends Structure implements Handleable this + " doesn't have a key"); // Paper + return this.key; + } + } diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/trim/CraftTrimMaterial.java b/src/main/java/org/bukkit/craftbukkit/inventory/trim/CraftTrimMaterial.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/trim/CraftTrimMaterial.java