aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0049-Use-null-Locale-by-default.patch
blob: e731a4f4c462e660bd8d44d24d2e2b3b78113ac6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Isaac Moore <rmsy@me.com>
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 9f38010f247694e1014c9c93bfcf46d103d8fd20..1115655b1e8090c52840e85b75265da881bbc713 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -236,7 +236,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;
@@ -2054,7 +2054,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 a9df824ae0a28256f3469e085c891a3a2af0fd30..4079cf3d515718a18b41333fbdc96d0c8f56648a 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -2422,7 +2422,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