Fix NPE with enchantable (#11557)

This commit is contained in:
Lulu13022002
2024-11-09 23:26:01 +01:00
parent bbc8fc8fec
commit 16f8d0f984
41 changed files with 161 additions and 110 deletions

View File

@@ -204,12 +204,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
return Registry.INSTRUMENT.getOrThrow(NamespacedKey.minecraft(key));
}
+
+ // Paper start - translation key
+ // Paper start - mark translation key as deprecated
+ /**
+ * @deprecated this method assumes that the instrument description
+ * always be a translatable component which is not guaranteed.
+ */
+ @Override
+ public @NotNull String translationKey() {
+ return "instrument.minecraft." + this.getKey().value();
+ }
+ // Paper end - translation key
+ @Deprecated(forRemoval = true)
+ public abstract @NotNull String translationKey();
+ // Paper end - mark translation key as deprecated
}
diff --git a/src/main/java/org/bukkit/Translatable.java b/src/main/java/org/bukkit/Translatable.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644