From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Isaac Moore Date: Tue, 19 Apr 2016 14:09:31 -0500 Subject: [PATCH] Use null Locale by default diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java index decd0dd48d8b77126b184ee21ceaf6c387085946..e61460a06708429738e0ed5f903a4226158aa334 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -237,7 +237,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player { private int levitationStartTime; private boolean disconnected; private int requestedViewDistance; - public String language = "en_us"; // CraftBukkit - default + public String language = null; // CraftBukkit - default // Paper - default to null public java.util.Locale adventure$locale = java.util.Locale.US; // Paper @Nullable private Vec3 startingToFallPosition; @@ -293,7 +293,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player { this.lastActionTime = Util.getMillis(); this.recipeBook = new ServerRecipeBook(); this.requestedViewDistance = 2; - this.language = "en_us"; + this.language = null; // Paper - default to null this.lastSectionPos = SectionPos.of(0, 0, 0); this.chunkTrackingView = ChunkTrackingView.EMPTY; this.respawnDimension = Level.OVERWORLD; @@ -2052,7 +2052,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player { PlayerChangedMainHandEvent event = new PlayerChangedMainHandEvent(this.getBukkitEntity(), this.getMainArm() == HumanoidArm.LEFT ? MainHand.LEFT : MainHand.RIGHT); this.server.server.getPluginManager().callEvent(event); } - if (!this.language.equals(clientOptions.language())) { + if (this.language == null || !this.language.equals(clientOptions.language())) { // Paper PlayerLocaleChangeEvent event = new PlayerLocaleChangeEvent(this.getBukkitEntity(), clientOptions.language()); this.server.server.getPluginManager().callEvent(event); } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java index 1a003335a4f3cc2fdeadca9c0c6cdafa61a6a1ac..fb5548b92a0fe7866cf98e25293c4b0702344c9b 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -2423,7 +2423,10 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @Override public String getLocale() { - return this.getHandle().language; + // Paper start - Locale change event + final String locale = this.getHandle().language; + return locale != null ? locale : "en_us"; + // Paper end } // Paper start