Yatopia/patches/server/0053-Custom-Locale-Support.patch
Simon Gardling d059af01b6
Updated Upstream and Sidestream(s) (Paper/Purpur/AirplaneLite) (#362)
* Updated Upstream and Sidestream(s) (Paper/Purpur/AirplaneLite)

Upstream/An Sidestream has released updates that appears to apply and compile correctly
This update has NOT been tested by YatopiaMC and as with ANY update, please do your own testing.

Paper Changes:
fc4c0bc42 Reset shield blocking on dimension change
1c8b6065e Skip distance map update when spawning is disabled
091e6700f Added PlayerStonecutterRecipeSelectEvent
fc885f966 Add toggle for always placing the dragon egg
b3a6da3a7 Updated Upstream (Bukkit/CraftBukkit)
18ccc062d [Auto] Updated Upstream (Spigot)

Purpur Changes:
df9bd08 Config to use infinity bows without arrows (#149)
9d537bc Fix PlayerEditBookEvent not saving new book
3f8816d [ci-skip] Oops
5508728 [ci-skip] Add granny to funding
4c7ab70 Updated Upstream (Paper)
5eefb52 [ci-skip] Update Gradle to 6.8.1

AirplaneLite Changes:
459bb20 Remove patch
515fec7 Remove streams
fc94d7b Correct launcher name
0b153bd Update gradle version

* add Remove-streams.patch from AirplaneLite
2021-01-25 13:22:51 -06:00

45 lines
2.4 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Zoe <duplexsys@protonmail.com>
Date: Sun, 25 Oct 2020 11:45:38 -0500
Subject: [PATCH] Custom Locale Support
All Server Jars Come with a pre-baked, usually English, locale file. This patch allows you to change the locale file by creating a locale.json file in the root directory of your server. Note that while custom locale files are supported by the server no support will be given for non-official Mojang locale files.
diff --git a/src/main/java/net/minecraft/server/LocaleLanguage.java b/src/main/java/net/minecraft/server/LocaleLanguage.java
index 29d55483510d3644a1edd3a01d7314232c358ac6..9909dd07d47ec86b71b74f66ab0e252de3441e23 100644
--- a/src/main/java/net/minecraft/server/LocaleLanguage.java
+++ b/src/main/java/net/minecraft/server/LocaleLanguage.java
@@ -30,9 +30,19 @@ public abstract class LocaleLanguage {
private static LocaleLanguage c() {
Builder<String, String> builder = ImmutableMap.builder();
BiConsumer<String, String> biconsumer = builder::put; // Paper - decompile fix
+ boolean usingCustomLocale = false; // Yatopia
try {
- InputStream inputstream = LocaleLanguage.class.getResourceAsStream("/assets/minecraft/lang/en_us.json");
+ // Yatopia Start - Custom Locale
+ InputStream inputstream;
+ java.io.File file = new java.io.File("./locale.json");
+ if (file.isFile() && file.canRead()) {
+ usingCustomLocale = true;
+ inputstream = new java.io.FileInputStream(file);
+ } else {
+ inputstream = LocaleLanguage.class.getResourceAsStream("/assets/minecraft/lang/en_us.json");
+ }
+ // Yatopia End
Throwable throwable = null;
try {
@@ -55,7 +65,11 @@ public abstract class LocaleLanguage {
}
} catch (JsonParseException | IOException ioexception) {
+ if (!usingCustomLocale) { // Yatopia
LocaleLanguage.LOGGER.error("Couldn't read strings from /assets/minecraft/lang/en_us.json", ioexception);
+ } else { // Yatopia start
+ LocaleLanguage.LOGGER.error("Couldn't read strings from custom locale file. Please check that your custom Locale File is formatted correctly", ioexception);
+ } // Yatopia end
}
final Map<String, String> map = builder.build();