add player.locale (#4633)

This commit is contained in:
Fatonndev
2021-02-08 23:26:48 +03:00
committed by GitHub
parent d8177daada
commit 1d3dbddaef
4 changed files with 10 additions and 1 deletions

View File

@@ -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;

View File

@@ -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

View File

@@ -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;

View File

@@ -160,7 +160,7 @@ public class Packets{
public int version;
public String versionType;
public Seq<String> 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);