diff --git a/core/src/mindustry/core/NetClient.java b/core/src/mindustry/core/NetClient.java index 8aaffa2eca..2b0e4322c0 100644 --- a/core/src/mindustry/core/NetClient.java +++ b/core/src/mindustry/core/NetClient.java @@ -75,6 +75,7 @@ public class NetClient implements ApplicationListener{ ConnectPacket c = new ConnectPacket(); c.name = player.name; + c.locale = Core.settings.getString("locale"); c.mods = mods.getModStrings(); c.mobile = mobile; c.versionType = Version.type; diff --git a/core/src/mindustry/core/NetServer.java b/core/src/mindustry/core/NetServer.java index 7ff3705925..73fcf3b8e4 100644 --- a/core/src/mindustry/core/NetServer.java +++ b/core/src/mindustry/core/NetServer.java @@ -195,6 +195,10 @@ public class NetServer implements ApplicationListener{ return; } + if(packet.locale == null){ + packet.locale = "en_US"; + } + String ip = con.address; admins.updatePlayerJoined(uuid, ip, packet.name); @@ -215,6 +219,7 @@ public class NetServer implements ApplicationListener{ player.con.uuid = uuid; player.con.mobile = packet.mobile; player.name = packet.name; + player.locale = packet.locale; player.color.set(packet.color).a(1f); //save admin ID but don't overwrite it diff --git a/core/src/mindustry/entities/comp/PlayerComp.java b/core/src/mindustry/entities/comp/PlayerComp.java index 914c074d4d..efc82172ca 100644 --- a/core/src/mindustry/entities/comp/PlayerComp.java +++ b/core/src/mindustry/entities/comp/PlayerComp.java @@ -41,6 +41,7 @@ abstract class PlayerComp implements UnitController, Entityc, Syncc, Timerc, Dra boolean admin; @SyncLocal float mouseX, mouseY; String name = "noname"; + String locale = "en"; Color color = new Color(); transient float deathTimer; diff --git a/core/src/mindustry/net/Packets.java b/core/src/mindustry/net/Packets.java index 91d5557e52..779be43b03 100644 --- a/core/src/mindustry/net/Packets.java +++ b/core/src/mindustry/net/Packets.java @@ -160,7 +160,7 @@ public class Packets{ public int version; public String versionType; public Seq mods; - public String name, uuid, usid; + public String name, locale, uuid, usid; public boolean mobile; public int color; @@ -169,6 +169,7 @@ public class Packets{ buffer.putInt(Version.build); TypeIO.writeString(buffer, versionType); TypeIO.writeString(buffer, name); + TypeIO.writeString(buffer, locale); TypeIO.writeString(buffer, usid); byte[] b = Base64Coder.decode(uuid); @@ -190,6 +191,7 @@ public class Packets{ version = buffer.getInt(); versionType = TypeIO.readString(buffer); name = TypeIO.readString(buffer); + locale = TypeIO.readString(buffer); usid = TypeIO.readString(buffer); byte[] idbytes = new byte[16]; buffer.get(idbytes);