Fix server ignoring fallback for translatable components (#9134)

This commit is contained in:
Jakub Zacek 2023-04-20 09:05:41 +02:00 committed by GitHub
parent beed22d336
commit f7717c3712
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 3 deletions

View file

@ -58,4 +58,5 @@ Jakubk15 <jakubk15@protonmail.com>
Redned <redned235@gmail.com>
Luke Chambers <consolelogluke@gmail.com>
Emily <emilia.lopezf.1999@gmail.com>
dawon <dawon@dawon.eu>
```

View file

@ -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<Component> args = translatable.args();