Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-11-15 04:20:04 +01:00
49 Zeilen
2.6 KiB
Diff
49 Zeilen
2.6 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 5940c2435dba421ee8480407f14827a2c876ac94..732622344982137b5ac051c6d510c7860fbe4e0a 100644
|
|
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
|
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
|
@@ -1755,7 +1755,7 @@ public class ServerPlayer extends Player {
|
|
return s;
|
|
}
|
|
|
|
- public String locale = "en_us"; // CraftBukkit - add, lowercase
|
|
+ public String locale = null; // CraftBukkit - add, lowercase // Paper - default to null
|
|
public java.util.Locale adventure$locale = java.util.Locale.US; // Paper
|
|
public void updateOptions(ServerboundClientInformationPacket packet) {
|
|
// CraftBukkit start
|
|
@@ -1763,9 +1763,10 @@ public class ServerPlayer extends Player {
|
|
PlayerChangedMainHandEvent event = new PlayerChangedMainHandEvent(this.getBukkitEntity(), getMainArm() == HumanoidArm.LEFT ? MainHand.LEFT : MainHand.RIGHT);
|
|
this.server.server.getPluginManager().callEvent(event);
|
|
}
|
|
- if (!this.locale.equals(packet.language)) {
|
|
+ if (this.locale == null || !this.locale.equals(packet.language)) { // Paper - check for null
|
|
PlayerLocaleChangeEvent event = new PlayerLocaleChangeEvent(this.getBukkitEntity(), packet.language);
|
|
this.server.server.getPluginManager().callEvent(event);
|
|
+ this.server.server.getPluginManager().callEvent(new com.destroystokyo.paper.event.player.PlayerLocaleChangeEvent(this.getBukkitEntity(), this.locale, packet.language)); // Paper
|
|
}
|
|
this.locale = packet.language;
|
|
// Paper start
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
|
index 2f47906dffa9c11777cab6dfcc3b2eb65ab6f06a..dd3e2db7ef1e60223ef14852b14495c2573bf2e8 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
|
@@ -1959,8 +1959,10 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
|
|
|
@Override
|
|
public String getLocale() {
|
|
- return this.getHandle().locale;
|
|
-
|
|
+ // Paper start - Locale change event
|
|
+ final String locale = this.getHandle().locale;
|
|
+ return locale != null ? locale : "en_us";
|
|
+ // Paper end
|
|
}
|
|
|
|
// Paper start
|