Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-11-15 12:30:06 +01:00
49 Zeilen
2.7 KiB
Diff
49 Zeilen
2.7 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/EntityPlayer.java b/src/main/java/net/minecraft/server/level/EntityPlayer.java
|
|
index ad55212370e3d814a397680927a1514ea0fe85b5..120cad4e7330900fa11d278cf87a6ab4484469c3 100644
|
|
--- a/src/main/java/net/minecraft/server/level/EntityPlayer.java
|
|
+++ b/src/main/java/net/minecraft/server/level/EntityPlayer.java
|
|
@@ -1686,7 +1686,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
|
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 a(PacketPlayInSettings packetplayinsettings) {
|
|
// CraftBukkit start
|
|
@@ -1694,9 +1694,10 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
|
PlayerChangedMainHandEvent event = new PlayerChangedMainHandEvent(getBukkitEntity(), getMainHand() == EnumMainHand.LEFT ? MainHand.LEFT : MainHand.RIGHT);
|
|
this.server.server.getPluginManager().callEvent(event);
|
|
}
|
|
- if (!this.locale.equals(packetplayinsettings.locale)) {
|
|
+ if (this.locale == null || !this.locale.equals(packetplayinsettings.locale)) { // Paper - check for null
|
|
PlayerLocaleChangeEvent event = new PlayerLocaleChangeEvent(getBukkitEntity(), packetplayinsettings.locale);
|
|
this.server.server.getPluginManager().callEvent(event);
|
|
+ new com.destroystokyo.paper.event.player.PlayerLocaleChangeEvent(this.getBukkitEntity(), this.locale, packetplayinsettings.locale).callEvent(); // Paper
|
|
}
|
|
this.locale = packetplayinsettings.locale;
|
|
// 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 facf2a79144a2d0fbea907c084becaea7bbdc48c..6d7f1dee9ae2fb0b9620d85969de86eee09020cc 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
|
@@ -1874,8 +1874,10 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
|
// Paper end
|
|
@Override
|
|
public String getLocale() {
|
|
- return getHandle().locale;
|
|
-
|
|
+ // Paper start - Locale change event
|
|
+ final String locale = getHandle().locale;
|
|
+ return locale != null ? locale : "en_us";
|
|
+ // Paper end
|
|
}
|
|
|
|
// Paper start
|