3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-11-14 20:10:05 +01:00
Paper/patches/server/0048-Use-null-Locale-by-default.patch

54 Zeilen
2.9 KiB
Diff

2023-09-21 21:54:46 +02:00
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
2023-09-21 21:54:46 +02:00
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
2024-10-22 20:04:31 +02:00
index 4303bde198050cd037f006234d269af406606eff..911ec630c5925b160cc05f99f0d5bb5ac46384bb 100644
2023-09-21 21:54:46 +02:00
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
2024-10-22 20:04:31 +02:00
@@ -261,7 +261,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player {
2023-09-21 21:54:46 +02:00
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;
2024-10-22 20:04:31 +02:00
@@ -321,7 +321,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player {
this.canChatColor = true;
2023-09-21 21:54:46 +02:00
this.lastActionTime = Util.getMillis();
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;
2024-10-22 20:04:31 +02:00
@@ -2314,7 +2314,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player {
2023-10-27 01:34:58 +02:00
PlayerChangedMainHandEvent event = new PlayerChangedMainHandEvent(this.getBukkitEntity(), this.getMainArm() == HumanoidArm.LEFT ? MainHand.LEFT : MainHand.RIGHT);
2023-09-21 21:54:46 +02:00
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
2024-10-25 13:52:04 +02:00
index 5600dce95548ffffa1a338f9c9f6d682d30cf02f..17a5b37a7591274a45a6818144b62b5cd1412a40 100644
2023-09-21 21:54:46 +02:00
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
2024-10-24 19:29:35 +02:00
@@ -2450,7 +2450,10 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
2023-09-21 21:54:46 +02:00
@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