Fix NPE with enchantable (#11557)
This commit is contained in:
parent
9d1c91d083
commit
59b79c8bbb
44 changed files with 189 additions and 138 deletions
|
@ -187,7 +187,7 @@ index 309a79cbe65498c90d9e135607bc246688ac6274..8820dd330cee4f8463f2f39f84d4be07
|
|||
if (this.isItem()) {
|
||||
return asItemType().getTranslationKey();
|
||||
diff --git a/src/main/java/org/bukkit/MusicInstrument.java b/src/main/java/org/bukkit/MusicInstrument.java
|
||||
index 807e89d026bffae521ead39c514a872ae4d406b3..c9f02466a04d20579fe2258bb02acf98e163ca81 100644
|
||||
index 807e89d026bffae521ead39c514a872ae4d406b3..f87364de1bf24ee78e0d823d9081a5f352934405 100644
|
||||
--- a/src/main/java/org/bukkit/MusicInstrument.java
|
||||
+++ b/src/main/java/org/bukkit/MusicInstrument.java
|
||||
@@ -6,7 +6,7 @@ import java.util.Collections;
|
||||
|
@ -199,17 +199,20 @@ index 807e89d026bffae521ead39c514a872ae4d406b3..c9f02466a04d20579fe2258bb02acf98
|
|||
|
||||
public static final MusicInstrument PONDER_GOAT_HORN = getInstrument("ponder_goat_horn");
|
||||
public static final MusicInstrument SING_GOAT_HORN = getInstrument("sing_goat_horn");
|
||||
@@ -46,4 +46,11 @@ public abstract class MusicInstrument implements Keyed {
|
||||
@@ -46,4 +46,14 @@ public abstract class MusicInstrument implements Keyed {
|
||||
private static MusicInstrument getInstrument(@NotNull String key) {
|
||||
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 e3faa2c675c85a9cbdbbb1debec0ff81c58a1bbd..fd1629c2d2028a88fb3d56b0aeb833d17235080a 100644
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue