Added additional server commands, fixed a crash
This commit is contained in:
@@ -4,4 +4,4 @@ version=release
|
||||
androidBuildCode=503
|
||||
name=Mindustry
|
||||
code=3.5
|
||||
build=custom build
|
||||
build=37
|
||||
|
||||
@@ -73,6 +73,8 @@ public class NetServer extends Module{
|
||||
return;
|
||||
}
|
||||
|
||||
Log.info("Recieved connect packet for player '{0}' / UUID {1} / IP {2}", packet.name, uuid, trace.ip);
|
||||
|
||||
String ip = Net.getConnection(id).address;
|
||||
|
||||
admins.updatePlayerJoined(uuid, ip, packet.name);
|
||||
|
||||
@@ -184,6 +184,18 @@ public class Administration {
|
||||
return result;
|
||||
}
|
||||
|
||||
public Array<PlayerInfo> findByIPs(String ip){
|
||||
Array<PlayerInfo> result = new Array<>();
|
||||
|
||||
for(PlayerInfo info : playerInfo.values()){
|
||||
if(info.ips.contains(ip, false)){
|
||||
result.add(info);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public PlayerInfo getInfo(String id){
|
||||
return getCreateInfo(id);
|
||||
}
|
||||
|
||||
@@ -343,7 +343,9 @@ public class ServerControl extends Module {
|
||||
info("Banned player by IP: {0}.", arg[0]);
|
||||
|
||||
for(Player player : playerGroup.all()){
|
||||
if(Net.getConnection(player.clientid).address.equals(arg[0])){
|
||||
if(Net.getConnection(player.clientid) != null &&
|
||||
Net.getConnection(player.clientid).address != null &&
|
||||
Net.getConnection(player.clientid).address.equals(arg[0])){
|
||||
netServer.kick(player.clientid, KickReason.banned);
|
||||
break;
|
||||
}
|
||||
@@ -537,8 +539,8 @@ public class ServerControl extends Module {
|
||||
}
|
||||
});
|
||||
|
||||
handler.register("find", "<name> [check-all-names]", "Find player info(s) by name. Can optionally check for all names a player has had.", arg -> {
|
||||
boolean checkAll = arg.length == 2 && arg[1].equals("true");
|
||||
handler.register("find", "<name...>", "Find player info(s) by name. Can optionally check for all names a player has had.", arg -> {
|
||||
boolean checkAll = true;
|
||||
|
||||
Array<PlayerInfo> infos = netServer.admins.findByName(arg[0], checkAll);
|
||||
|
||||
@@ -564,6 +566,33 @@ public class ServerControl extends Module {
|
||||
}
|
||||
});
|
||||
|
||||
handler.register("findip", "<ip>", "Find player info(s) by IP.", arg -> {
|
||||
|
||||
Array<PlayerInfo> infos = netServer.admins.findByIPs(arg[0]);
|
||||
|
||||
if(infos.size == 1) {
|
||||
PlayerInfo info = infos.peek();
|
||||
Log.info("&lcTrace info for player '{0}' / UUID {1}:", info.lastName, info.id);
|
||||
Log.info(" &lyall names used: {0}", info.names);
|
||||
Log.info(" &lyIP: {0}", info.lastIP);
|
||||
Log.info(" &lyall IPs used: {0}", info.ips);
|
||||
Log.info(" &lytimes joined: {0}", info.timesJoined);
|
||||
Log.info(" &lytimes kicked: {0}", info.timesKicked);
|
||||
Log.info("");
|
||||
Log.info(" &lytotal blocks broken: {0}", info.totalBlocksBroken);
|
||||
Log.info(" &lytotal blocks placed: {0}", info.totalBlockPlaced);
|
||||
}else if(infos.size > 1){
|
||||
Log.info("&lcMultiple people have been found with that IP:");
|
||||
for(PlayerInfo info : infos){
|
||||
Log.info(" &ly{0}", info.id);
|
||||
}
|
||||
Log.info("&lcUse the info command to examine each person individually.");
|
||||
}else{
|
||||
info("Nobody with that name could be found.");
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
handler.register("info", "<UUID>", "Get global info for a player's UUID.", arg -> {
|
||||
PlayerInfo info = netServer.admins.getInfoOptional(arg[0]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user