mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-30 04:02:50 +01:00
56 lines
3.1 KiB
Diff
56 lines
3.1 KiB
Diff
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] Implement PlayerLocaleChangeEvent
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
|
index 61ec0ed91457e4b04a72010199be520c9d4a9488..b5a8d2505fa41c68abb1400a4269f833537b6ebe 100644
|
|
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
|
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
|
@@ -214,7 +214,7 @@ public class ServerPlayer extends 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;
|
|
@@ -308,7 +308,7 @@ public class ServerPlayer extends 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;
|
|
@@ -1862,9 +1862,10 @@ public class ServerPlayer extends 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);
|
|
+ this.server.server.getPluginManager().callEvent(new com.destroystokyo.paper.event.player.PlayerLocaleChangeEvent(this.getBukkitEntity(), this.language, clientOptions.language())); // Paper
|
|
}
|
|
// CraftBukkit end
|
|
this.language = clientOptions.language();
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
|
index c06f9da7d33c8d86fdcdd1f293f28e66f63e4de1..850ea32a2ebc192a89c9feec5dbc83f3f7314bfc 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
|
@@ -2247,7 +2247,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
|