Trace times joined & kicked (#4844)

* Trace times joined & kicked

* Make mindustry.* import obsolete
This commit is contained in:
Patrick 'Quezler' Mounier
2021-03-03 15:09:05 +01:00
committed by GitHub
parent 4d9a30b7c7
commit ae838b9392
5 changed files with 16 additions and 4 deletions

View File

@@ -216,9 +216,11 @@ server.hidden = Hidden
trace = Trace Player trace = Trace Player
trace.playername = Player name: [accent]{0} trace.playername = Player name: [accent]{0}
trace.ip = IP: [accent]{0} trace.ip = IP: [accent]{0}
trace.id = Unique ID: [accent]{0} trace.id = ID: [accent]{0}
trace.mobile = Mobile Client: [accent]{0} trace.mobile = Mobile Client: [accent]{0}
trace.modclient = Custom Client: [accent]{0} trace.modclient = Custom Client: [accent]{0}
trace.times.joined = Times Joined: [accent]{0}
trace.times.kicked = Times Kicked: [accent]{0}
invalidid = Invalid client ID! Submit a bug report. invalidid = Invalid client ID! Submit a bug report.
server.bans = Bans server.bans = Bans
server.bans.none = No banned players found! server.bans.none = No banned players found!

View File

@@ -735,7 +735,8 @@ public class NetServer implements ApplicationListener{
other.kick(KickReason.kick); other.kick(KickReason.kick);
info("&lc@ has kicked @.", player.name, other.name); info("&lc@ has kicked @.", player.name, other.name);
}else if(action == AdminAction.trace){ }else if(action == AdminAction.trace){
TraceInfo info = new TraceInfo(other.con.address, other.uuid(), other.con.modclient, other.con.mobile); PlayerInfo stats = netServer.admins.getInfo(other.uuid());
TraceInfo info = new TraceInfo(other.con.address, other.uuid(), other.con.modclient, other.con.mobile, stats.timesJoined, stats.timesKicked);
if(player.con != null){ if(player.con != null){
Call.traceInfo(player.con, other, info); Call.traceInfo(player.con, other, info);
}else{ }else{

View File

@@ -572,10 +572,12 @@ public class TypeIO{
writeString(write, trace.uuid); writeString(write, trace.uuid);
write.b(trace.modded ? (byte)1 : 0); write.b(trace.modded ? (byte)1 : 0);
write.b(trace.mobile ? (byte)1 : 0); write.b(trace.mobile ? (byte)1 : 0);
write.i(trace.timesJoined);
write.i(trace.timesKicked);
} }
public static TraceInfo readTraceInfo(Reads read){ public static TraceInfo readTraceInfo(Reads read){
return new TraceInfo(readString(read), readString(read), read.b() == 1, read.b() == 1); return new TraceInfo(readString(read), readString(read), read.b() == 1, read.b() == 1, read.i(), read.i());
} }
public static void writeStringData(DataOutput buffer, String string) throws IOException{ public static void writeStringData(DataOutput buffer, String string) throws IOException{

View File

@@ -584,12 +584,15 @@ public class Administration{
public static class TraceInfo{ public static class TraceInfo{
public String ip, uuid; public String ip, uuid;
public boolean modded, mobile; public boolean modded, mobile;
public int timesJoined, timesKicked;
public TraceInfo(String ip, String uuid, boolean modded, boolean mobile){ public TraceInfo(String ip, String uuid, boolean modded, boolean mobile, int timesJoined, int timesKicked){
this.ip = ip; this.ip = ip;
this.uuid = uuid; this.uuid = uuid;
this.modded = modded; this.modded = modded;
this.mobile = mobile; this.mobile = mobile;
this.timesJoined = timesJoined;
this.timesKicked = timesKicked;
} }
} }

View File

@@ -32,6 +32,10 @@ public class TraceDialog extends BaseDialog{
table.row(); table.row();
table.add(Core.bundle.format("trace.mobile", info.mobile)); table.add(Core.bundle.format("trace.mobile", info.mobile));
table.row(); table.row();
table.add(Core.bundle.format("trace.times.joined", info.timesJoined));
table.row();
table.add(Core.bundle.format("trace.times.kicked", info.timesKicked));
table.row();
table.add().pad(5); table.add().pad(5);
table.row(); table.row();