diff options
Diffstat (limited to 'patches/api/0202-Add-methods-to-get-translation-keys.patch')
-rw-r--r-- | patches/api/0202-Add-methods-to-get-translation-keys.patch | 53 |
1 files changed, 20 insertions, 33 deletions
diff --git a/patches/api/0202-Add-methods-to-get-translation-keys.patch b/patches/api/0202-Add-methods-to-get-translation-keys.patch index 825d506e8a..13d99de8c2 100644 --- a/patches/api/0202-Add-methods-to-get-translation-keys.patch +++ b/patches/api/0202-Add-methods-to-get-translation-keys.patch @@ -235,53 +235,40 @@ index e3faa2c675c85a9cbdbbb1debec0ff81c58a1bbd..fd1629c2d2028a88fb3d56b0aeb833d1 String getTranslationKey(); } diff --git a/src/main/java/org/bukkit/attribute/Attribute.java b/src/main/java/org/bukkit/attribute/Attribute.java -index e5a9d1692f0f6fd8e9ac4903782e9330b4da6ef3..6075cd2a88394cd7f0ce2470e732a45094b033c0 100644 +index 951c23491390c2c8693d415598ef2de712189220..21f9998b472dc18eb308554f5cdf467f6675f2f0 100644 --- a/src/main/java/org/bukkit/attribute/Attribute.java +++ b/src/main/java/org/bukkit/attribute/Attribute.java -@@ -9,7 +9,7 @@ import org.jetbrains.annotations.NotNull; +@@ -14,7 +14,7 @@ import org.jetbrains.annotations.NotNull; /** * Types of attributes which may be present on an {@link Attributable}. */ --public enum Attribute implements Keyed, Translatable { -+public enum Attribute implements Keyed, Translatable, net.kyori.adventure.translation.Translatable { // Paper - Adventure translations +-public interface Attribute extends OldEnum<Attribute>, Keyed, Translatable { ++public interface Attribute extends OldEnum<Attribute>, Keyed, Translatable, net.kyori.adventure.translation.Translatable { // Paper - Adventure translations /** * Maximum health of an Entity. -@@ -157,4 +157,12 @@ public enum Attribute implements Keyed, Translatable { - public String getTranslationKey() { - return Bukkit.getUnsafe().getTranslationKey(this); - } -+ -+ // Paper start -+ @SuppressWarnings("deprecation") -+ @Override -+ public @NotNull String translationKey() { -+ return Bukkit.getUnsafe().getTranslationKey(this); -+ } -+ // Paper end - } diff --git a/src/main/java/org/bukkit/block/Biome.java b/src/main/java/org/bukkit/block/Biome.java -index 2201b63e7335b12622268a3ef40d1fcb06c1d705..b71975b904d48e22a0e2134bb0e8231679dd9700 100644 +index f46932a12f46895ae10b63f7fbb54750da1bd2ba..b352886e697a1c9869226b583da5240592575064 100644 --- a/src/main/java/org/bukkit/block/Biome.java +++ b/src/main/java/org/bukkit/block/Biome.java -@@ -10,7 +10,7 @@ import org.jetbrains.annotations.NotNull; - /** - * Holds all accepted Biomes in the default server +@@ -22,7 +22,7 @@ import org.jetbrains.annotations.NotNull; + * There may be additional biomes present in the server, for example from a {@link DataPack} + * which can be accessed via {@link Registry#BIOME}. */ --public enum Biome implements Keyed { -+public enum Biome implements Keyed, net.kyori.adventure.translation.Translatable { // Paper - OCEAN, - PLAINS, - DESERT, -@@ -94,4 +94,11 @@ public enum Biome implements Keyed { - public NamespacedKey getKey() { - return key; +-public interface Biome extends OldEnum<Biome>, Keyed { ++public interface Biome extends OldEnum<Biome>, Keyed, net.kyori.adventure.translation.Translatable { // Paper - Adventure translations + + Biome OCEAN = getBiome("ocean"); + Biome PLAINS = getBiome("plains"); +@@ -131,4 +131,11 @@ public interface Biome extends OldEnum<Biome>, Keyed { + static Biome[] values() { + return Lists.newArrayList(Registry.BIOME).toArray(new Biome[0]); } + + // Paper start + @Override -+ public @NotNull String translationKey() { -+ return "biome.minecraft." + this.key.getKey(); ++ default @NotNull String translationKey() { ++ return "biome.minecraft." + this.getKey().getKey(); + } + // Paper end } @@ -384,7 +371,7 @@ index c4f86ba1037f3f0e5d697a0962d71d6f8c7c1fbe..ac0371285370594d4de1554871b19bbc // Paper end } diff --git a/src/main/java/org/bukkit/entity/EntityType.java b/src/main/java/org/bukkit/entity/EntityType.java -index 1c1cdfd6b5a98a378ff7bb7bb3201e84662b52f3..be1c8c9b27ad792f2b0ff1cec0c575eb1fc3023a 100644 +index e758a13ea84f472dcdf7fe31e2ea23c0e554c4c7..a5e5c252405a7b940afbb6715abcda7ec9007dd3 100644 --- a/src/main/java/org/bukkit/entity/EntityType.java +++ b/src/main/java/org/bukkit/entity/EntityType.java @@ -45,7 +45,7 @@ import org.jetbrains.annotations.Contract; @@ -396,7 +383,7 @@ index 1c1cdfd6b5a98a378ff7bb7bb3201e84662b52f3..be1c8c9b27ad792f2b0ff1cec0c575eb // These strings MUST match the strings in nms.EntityTypes and are case sensitive. /** -@@ -470,10 +470,22 @@ public enum EntityType implements Keyed, Translatable { +@@ -474,10 +474,22 @@ public enum EntityType implements Keyed, Translatable { @Override @NotNull |