From f7717c3712265fd480d6ff0ad808c430b9972004 Mon Sep 17 00:00:00 2001 From: Jakub Zacek Date: Thu, 20 Apr 2023 09:05:41 +0200 Subject: [PATCH] Fix server ignoring fallback for translatable components (#9134) --- LICENSE.md | 1 + patches/server/0010-Adventure.patch | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/LICENSE.md b/LICENSE.md index 24fa6b3ca6..f0ebc05b06 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -58,4 +58,5 @@ Jakubk15 Redned Luke Chambers Emily +dawon ``` diff --git a/patches/server/0010-Adventure.patch b/patches/server/0010-Adventure.patch index 377da5f324..bccb17db69 100644 --- a/patches/server/0010-Adventure.patch +++ b/patches/server/0010-Adventure.patch @@ -736,10 +736,10 @@ index 0000000000000000000000000000000000000000..2fd6c3e65354071af71c7d8ebb97b559 +} diff --git a/src/main/java/io/papermc/paper/adventure/PaperAdventure.java b/src/main/java/io/papermc/paper/adventure/PaperAdventure.java new file mode 100644 -index 0000000000000000000000000000000000000000..ecddb6fe55e8ee1ca3b163503dd62200ce2d7d04 +index 0000000000000000000000000000000000000000..badde58c5151f838faa4b42db02e767eafa2da18 --- /dev/null +++ b/src/main/java/io/papermc/paper/adventure/PaperAdventure.java -@@ -0,0 +1,354 @@ +@@ -0,0 +1,355 @@ +package io.papermc.paper.adventure; + +import com.mojang.brigadier.exceptions.CommandSyntaxException; @@ -799,7 +799,8 @@ index 0000000000000000000000000000000000000000..ecddb6fe55e8ee1ca3b163503dd62200 + } + } + } -+ final @NotNull String translated = Language.getInstance().getOrDefault(translatable.key()); ++ final @Nullable String fallback = translatable.fallback(); ++ final @NotNull String translated = Language.getInstance().getOrDefault(translatable.key(), fallback != null ? fallback : translatable.key()); + + final Matcher matcher = LOCALIZATION_PATTERN.matcher(translated); + final List args = translatable.args();