Broke and cleaned up server commands

This commit is contained in:
Anuken 2018-10-28 14:26:58 -04:00
parent 2a21e7c2cb
commit 80aed31135
23 changed files with 92 additions and 348 deletions

View File

@ -1,4 +1,6 @@
apply plugin: "java"
sourceCompatibility = 1.8
sourceSets.main.java.srcDirs = [ "src/" ]
sourceSets.main.java.srcDirs = [ "src/main/java/" ]
sourceSets.main.resources.srcDirs = [ "src/main/resources/" ]

View File

@ -1,5 +1,7 @@
package io.anuke.annotations;
import io.anuke.annotations.MethodEntry;
import java.util.ArrayList;
/** Represents a class witha list method entries to include in it. */

View File

@ -2,6 +2,8 @@ package io.anuke.annotations;
import com.squareup.javapoet.*;
import io.anuke.annotations.IOFinder.ClassSerializer;
import io.anuke.annotations.MethodEntry;
import io.anuke.annotations.Utils;
import javax.lang.model.element.Modifier;
import javax.lang.model.element.TypeElement;

View File

@ -52,7 +52,7 @@ public class SerializeAnnotationProcessor extends AbstractProcessor{
TypeSpec.Builder serializer = TypeSpec.anonymousClassBuilder("")
.addSuperinterface(ParameterizedTypeName.get(
ClassName.get(Class.forName("io.anuke.ucore.io.TypeSerializer")), type));
ClassName.bestGuess("io.anuke.ucore.io.TypeSerializer"), type));
MethodSpec.Builder writeMethod = MethodSpec.methodBuilder("write")
.returns(void.class)

View File

@ -0,0 +1,2 @@
io.anuke.annotations.RemoteMethodAnnotationProcessor
io.anuke.annotations.SerializeAnnotationProcessor

View File

@ -178,11 +178,14 @@ project(":core") {
compile "com.badlogicgames.gdx:gdx:$gdxVersion"
compile "com.badlogicgames.gdx:gdx-controllers:$gdxVersion"
annotationProcessor project(":annotations")
}
/*
compileJava.options.compilerArgs = [
"-processor", "io.anuke.annotations.RemoteMethodAnnotationProcessor,io.anuke.annotations.SerializeAnnotationProcessor"
]
]*/
}
project(":server") {

Binary file not shown.

Before

Width:  |  Height:  |  Size: 111 B

After

Width:  |  Height:  |  Size: 191 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 103 KiB

After

Width:  |  Height:  |  Size: 103 KiB

View File

@ -21,7 +21,6 @@ import io.anuke.mindustry.net.Net;
import io.anuke.mindustry.net.Net.SendMode;
import io.anuke.mindustry.net.NetworkIO;
import io.anuke.mindustry.net.Packets.*;
import io.anuke.mindustry.net.TraceInfo;
import io.anuke.mindustry.net.ValidateException;
import io.anuke.mindustry.world.Tile;
import io.anuke.mindustry.world.modules.ItemModule;
@ -207,12 +206,6 @@ public class NetClient extends Module{
players[0].y = y;
}
@Remote(variants = Variant.one)
public static void onTraceInfo(TraceInfo info){
Player player = playerGroup.getByID(info.playerid);
ui.traces.show(player, info);
}
@Remote
public static void onPlayerDisconnect(int playerid){
playerGroup.removeByID(playerid);

View File

@ -106,11 +106,9 @@ public class NetServer extends Module{
connection.hasBegunConnecting = true;
TraceInfo trace = admins.getTraceByID(uuid);
PlayerInfo info = admins.getInfo(uuid);
trace.uuid = uuid;
trace.ip = connection.address;
trace.android = packet.mobile;
connection.mobile = packet.mobile;
if(admins.isIDBanned(uuid)){
kick(id, KickReason.banned);
@ -150,7 +148,7 @@ public class NetServer extends Module{
return;
}
Log.info("Recieved connect packet for player '{0}' / UUID {1} / IP {2}", packet.name, uuid, trace.ip);
Log.info("Recieved connect packet for player '{0}' / UUID {1} / IP {2}", packet.name, uuid, connection.address);
String ip = Net.getConnection(id).address;
@ -162,7 +160,7 @@ public class NetServer extends Module{
}
if(packet.version == -1){
trace.modclient = true;
connection.modclient = true;
}
Player player = new Player();
@ -207,8 +205,6 @@ public class NetServer extends Module{
connections.put(id, player);
trace.playerid = player.id;
sendWorldData(player, id);
Platform.instance.updateRPC();
@ -395,11 +391,11 @@ public class NetServer extends Module{
netServer.kick(other.con.id, KickReason.kick);
Log.info("&lc{0} has kicked {1}.", player.name, other.name);
}else if(action == AdminAction.trace){
//TODO
//TODO implement
if(player.con != null){
Call.onTraceInfo(player.con.id, netServer.admins.getTraceByID(other.uuid));
//Call.onTraceInfo(player.con.id, other.con.trace);
}else{
NetClient.onTraceInfo(netServer.admins.getTraceByID(other.uuid));
//NetClient.onTraceInfo(other.con.trace);
}
Log.info("&lc{0} has requested trace info of {1}.", player.name, other.name);
}
@ -424,7 +420,6 @@ public class NetServer extends Module{
if(!headless && !closing && Net.server() && state.is(State.menu)){
closing = true;
reset();
threads.runGraphics(() -> ui.loadfrag.show("$text.server.closing"));
Timers.runTask(5f, () -> {
Net.closeServer();
@ -438,10 +433,6 @@ public class NetServer extends Module{
}
}
public void reset(){
admins.clearTraces();
}
public void kickAll(KickReason reason){
for(NetConnection con : Net.getConnections()){
kick(con.id, reason);

View File

@ -1,7 +1,6 @@
package io.anuke.mindustry.io;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.utils.Base64Coder;
import io.anuke.annotations.Annotations.ReadClass;
import io.anuke.annotations.Annotations.WriteClass;
import io.anuke.mindustry.entities.Player;
@ -17,7 +16,6 @@ import io.anuke.mindustry.entities.units.UnitCommand;
import io.anuke.mindustry.game.Team;
import io.anuke.mindustry.net.Packets.AdminAction;
import io.anuke.mindustry.net.Packets.KickReason;
import io.anuke.mindustry.net.TraceInfo;
import io.anuke.mindustry.type.*;
import io.anuke.mindustry.world.Block;
import io.anuke.mindustry.world.Tile;
@ -364,45 +362,4 @@ public class TypeIO{
buffer.get(bytes);
return bytes;
}
@WriteClass(TraceInfo.class)
public static void writeTrace(ByteBuffer buffer, TraceInfo info){
buffer.putInt(info.playerid);
buffer.putShort((short) info.ip.getBytes().length);
buffer.put(info.ip.getBytes());
buffer.put(info.modclient ? (byte) 1 : 0);
buffer.put(info.android ? (byte) 1 : 0);
buffer.putInt(info.totalBlocksBroken);
buffer.putInt(info.structureBlocksBroken);
buffer.putInt(info.lastBlockBroken.id);
buffer.putInt(info.totalBlocksPlaced);
buffer.putInt(info.lastBlockPlaced.id);
buffer.put(Base64Coder.decode(info.uuid));
}
@ReadClass(TraceInfo.class)
public static TraceInfo readTrace(ByteBuffer buffer){
int id = buffer.getInt();
short iplen = buffer.getShort();
byte[] ipb = new byte[iplen];
buffer.get(ipb);
TraceInfo info = new TraceInfo(new String(ipb));
info.playerid = id;
info.modclient = buffer.get() == 1;
info.android = buffer.get() == 1;
info.totalBlocksBroken = buffer.getInt();
info.structureBlocksBroken = buffer.getInt();
info.lastBlockBroken = content.block(buffer.getInt());
info.totalBlocksPlaced = buffer.getInt();
info.lastBlockPlaced = content.block(buffer.getInt());
byte[] uuid = new byte[8];
buffer.get(uuid);
info.uuid = new String(Base64Coder.encode(uuid));
return info;
}
}

View File

@ -2,6 +2,7 @@ package io.anuke.mindustry.net;
import com.badlogic.gdx.utils.Array;
import com.badlogic.gdx.utils.ObjectMap;
import com.badlogic.gdx.utils.ObjectSet;
import io.anuke.annotations.Annotations.Serialize;
import io.anuke.ucore.core.Settings;
@ -11,8 +12,6 @@ public class Administration{
/**All player info. Maps UUIDs to info. This persists throughout restarts.*/
private ObjectMap<String, PlayerInfo> playerInfo = new ObjectMap<>();
/**Maps UUIDs to trace infos. This is wiped when a player logs off.*/
private ObjectMap<String, TraceInfo> traceInfo = new ObjectMap<>();
private Array<String> bannedIPs = new Array<>();
public Administration(){
@ -53,17 +52,20 @@ public class Administration{
if(!info.ips.contains(ip, false)) info.ips.add(ip);
}
/**
* Returns trace info by UUID.
*/
public TraceInfo getTraceByID(String uuid){
if(!traceInfo.containsKey(uuid)) traceInfo.put(uuid, new TraceInfo(uuid));
public boolean banPlayer(String uuid){
if(bannedIPs.contains(ip, false))
return false;
return traceInfo.get(uuid);
}
for(PlayerInfo info : playerInfo.values()){
if(info.ips.contains(ip, false)){
info.banned = true;
}
}
public void clearTraces(){
traceInfo.clear();
bannedIPs.add(ip);
save();
return true;
}
/**
@ -86,9 +88,7 @@ public class Administration{
return true;
}
/**
* Bans a player by UUID; returns whether this player was already banned.
*/
/**Bans a player by UUID; returns whether this player was already banned.*/
public boolean banPlayerID(String id){
if(playerInfo.containsKey(id) && playerInfo.get(id).banned)
return false;
@ -215,11 +215,13 @@ public class Administration{
return info.admin && usip.equals(info.adminUsid);
}
public Array<PlayerInfo> findByName(String name, boolean last){
Array<PlayerInfo> result = new Array<>();
/**Finds player info by IP, UUID and name.*/
public ObjectSet<PlayerInfo> findByName(String name){
ObjectSet<PlayerInfo> result = new ObjectSet<>();
for(PlayerInfo info : playerInfo.values()){
if(info.lastName.toLowerCase().equals(name.toLowerCase()) || (last && info.names.contains(name, false))){
if(info.lastName.toLowerCase().equals(name.toLowerCase()) || (info.names.contains(name, false))
|| info.ips.contains(name, false) || info.id.equals(name)){
result.add(info);
}
}
@ -287,8 +289,6 @@ public class Administration{
public String adminUsid;
public int timesKicked;
public int timesJoined;
public int totalBlockPlaced;
public int totalBlocksBroken;
public boolean banned, admin;
public long lastKicked; //last kicked timestamp

View File

@ -6,6 +6,9 @@ public abstract class NetConnection{
public final int id;
public final String address;
public boolean modclient;
public boolean mobile;
public int lastSentSnapshotID = -1;
/**ID of last recieved client snapshot.*/

View File

@ -1,27 +0,0 @@
package io.anuke.mindustry.net;
import com.badlogic.gdx.utils.IntIntMap;
import io.anuke.mindustry.content.blocks.Blocks;
import io.anuke.mindustry.world.Block;
public class TraceInfo{
public int playerid;
public String ip;
public boolean modclient;
public boolean android;
public IntIntMap fastShots = new IntIntMap();
public int totalBlocksBroken;
public int structureBlocksBroken;
public Block lastBlockBroken = Blocks.air;
public int totalBlocksPlaced;
public Block lastBlockPlaced = Blocks.air;
public String uuid;
public TraceInfo(String uuid){
this.uuid = uuid;
}
}

View File

@ -1,10 +1,5 @@
package io.anuke.mindustry.ui.dialogs;
import io.anuke.mindustry.entities.Player;
import io.anuke.mindustry.net.TraceInfo;
import io.anuke.ucore.scene.ui.layout.Table;
import io.anuke.ucore.util.Bundles;
public class TraceDialog extends FloatingDialog{
public TraceDialog(){
@ -12,14 +7,15 @@ public class TraceDialog extends FloatingDialog{
addCloseButton();
}
public void show(Player player, TraceInfo info){
/*
public void show(Player player, SessionInfo info){
content().clear();
Table table = new Table("clear");
table.margin(14);
table.defaults().pad(1);
/*
table.defaults().left();
table.add(Bundles.format("text.trace.playername", player.name));
table.row();
@ -50,10 +46,10 @@ public class TraceDialog extends FloatingDialog{
table.add(Bundles.format("text.trace.totalblocksplaced", info.totalBlocksPlaced));
table.row();
table.add(Bundles.format("text.trace.lastblockplaced", info.lastBlockPlaced.formalName));
table.row();*/
table.row();
content().add(table);
show();
}
}*/
}

View File

@ -119,7 +119,7 @@ public class PlayerListFragment extends Fragment{
t.addImageButton("icon-admin", "toggle", 14 * 2, () -> {
if(Net.client()) return;
String id = netServer.admins.getTraceByID(player.uuid).uuid;
String id = player.uuid;
if(netServer.admins.isAdmin(id, connection.address)){
ui.showConfirm("$text.confirm", "$text.confirmunadmin", () -> netServer.admins.unAdminPlayer(id));

View File

@ -2,6 +2,7 @@ package io.anuke.mindustry.server;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.utils.Array;
import com.badlogic.gdx.utils.ObjectSet;
import com.badlogic.gdx.utils.Timer;
import com.badlogic.gdx.utils.Timer.Task;
import io.anuke.mindustry.core.GameState.State;
@ -18,7 +19,6 @@ import io.anuke.mindustry.maps.Map;
import io.anuke.mindustry.net.Administration.PlayerInfo;
import io.anuke.mindustry.net.Net;
import io.anuke.mindustry.net.Packets.KickReason;
import io.anuke.mindustry.net.TraceInfo;
import io.anuke.mindustry.type.Item;
import io.anuke.mindustry.type.ItemType;
import io.anuke.mindustry.world.Tile;
@ -157,7 +157,7 @@ public class ServerControl extends Module{
handler.register("help", "Displays this command list.", arg -> {
info("Commands:");
for(Command command : handler.getCommandList()){
print(" &y" + command.text + (command.paramText.isEmpty() ? "" : " ") + command.paramText + " - &lm" + command.description);
info(" &y" + command.text + (command.paramText.isEmpty() ? "" : " ") + command.paramText + " - &lm" + command.description);
}
});
@ -176,7 +176,6 @@ public class ServerControl extends Module{
Net.closeServer();
if(lastTask != null) lastTask.cancel();
state.set(State.menu);
netServer.reset();
Log.info("Stopped server.");
});
@ -268,7 +267,7 @@ public class ServerControl extends Module{
if(playerGroup.size() > 0){
info("&lyPlayers: {0}", playerGroup.size());
for(Player p : playerGroup.all()){
print(" &y" + p.name);
info(" &y{0} / {1}", p.name, p.uuid);
}
}else{
info("&lyNo players connected.");
@ -277,21 +276,6 @@ public class ServerControl extends Module{
}
});
handler.register("players", "Display player info.", arg -> {
if(state.is(State.menu)){
info("&lyServer is closed.");
}else{
if(playerGroup.size() > 0){
info("&lyPlayers: {0}", playerGroup.size());
for(Player p : playerGroup.all()){
print(" &y{0} / Connection {1} / IP: {2}", p.name, p.con.id, p.con.address);
}
}else{
info("&lyNo players connected.");
}
}
});
handler.register("say", "<message...>", "Send a message to all players.", arg -> {
if(!state.is(State.playing)){
err("Not hosting. Host a game first.");
@ -384,14 +368,7 @@ public class ServerControl extends Module{
return;
}
Player target = null;
for(Player player : playerGroup.all()){
if(player.name.equalsIgnoreCase(arg[0])){
target = player;
break;
}
}
Player target = playerGroup.find(p -> p.name.equals(arg[0]));
if(target != null){
netServer.kick(target.con.id, KickReason.kick);
@ -401,17 +378,27 @@ public class ServerControl extends Module{
}
});
handler.register("ban", "<username...>", "Ban a person by name.", arg -> {
if(!state.is(State.playing)){
err("Can't ban people by name with no players.");
return;
handler.register("ban", "<type (id/name/ip)> <username/IP/ID...>", "Ban a person.", arg -> {
if(arg[0].equals("id")){
netServer.admins.banPlayerID(arg[0]);
}else if(arg[0].equals("name")){
Player target = playerGroup.find(p -> p.name.equalsIgnoreCase(arg[0]));
if(target != null){
netServer.admins.banPlayer(target.uuid);
}else{
err("No matches found.");
}
}else if(arg[0].equals("ip")){
netServer.admins.banPlayerIP(arg[0]);
}else{
err("Invalid type.");
}
Player target = null;
for(Player player : playerGroup.all()){
if(player.name.equalsIgnoreCase(arg[0])){
target = player;
if(state.is(State.playing)){
for(Player player : playerGroup.all()){
if(player.name.equalsIgnoreCase(arg[0])){
targets.add(netServer.admins.getInfo(player.uuid));
}
}
}
@ -422,7 +409,7 @@ public class ServerControl extends Module{
netServer.kick(target.con.id, KickReason.banned);
info("Banned player by IP and ID: {0} / {1}", ip, target.uuid);
}else{
info("Nobody with that name could be found.");
info("No matches were found.");
}
});
@ -455,35 +442,6 @@ public class ServerControl extends Module{
}
});
handler.register("banip", "<ip>", "Ban a person by IP.", arg -> {
if(netServer.admins.banPlayerIP(arg[0])){
info("Banned player by IP: {0}.", arg[0]);
for(Player player : playerGroup.all()){
if(player.con.address != null &&
player.con.address.equals(arg[0])){
netServer.kick(player.con.id, KickReason.banned);
}
}
}else{
err("That IP is already banned!");
}
});
handler.register("banid", "<id>", "Ban a person by their unique ID.", arg -> {
if(netServer.admins.banPlayerID(arg[0])){
info("Banned player by ID: {0}.", arg[0]);
for(Player player : playerGroup.all()){
if(player.uuid.equals(arg[0])){
netServer.kick(player.con.id, KickReason.banned);
}
}
}else{
err("That ID is already banned!");
}
});
handler.register("unbanip", "<ip>", "Completely unban a person by IP.", arg -> {
if(netServer.admins.unbanPlayerIP(arg[0])){
info("Unbanned player by IP: {0}.", arg[0]);
@ -500,49 +458,35 @@ public class ServerControl extends Module{
}
});
handler.register("admin", "<username...>", "Make a user admin", arg -> {
handler.register("admin", "<username...>", "Make an online user admin", arg -> {
if(!state.is(State.playing)){
err("Open the server first.");
return;
}
Player target = null;
for(Player player : playerGroup.all()){
if(player.name.equalsIgnoreCase(arg[0])){
target = player;
break;
}
}
Player target = playerGroup.find(p -> p.name.equals(arg[0]));
if(target != null){
netServer.admins.adminPlayer(target.uuid, target.usid);
target.isAdmin = true;
info("Admin-ed player by ID: {0} / {1}", target.uuid, arg[0]);
info("Admin-ed player: {0}", arg[0]);
}else{
info("Nobody with that name could be found.");
}
});
handler.register("unadmin", "<username...>", "Removes admin status from a player", arg -> {
handler.register("unadmin", "<username...>", "Removes admin status from an online player", arg -> {
if(!state.is(State.playing)){
err("Open the server first.");
return;
}
Player target = null;
for(Player player : playerGroup.all()){
if(player.name.equalsIgnoreCase(arg[0])){
target = player;
break;
}
}
Player target = playerGroup.find(p -> p.name.equals(arg[0]));
if(target != null){
netServer.admins.unAdminPlayer(target.uuid);
target.isAdmin = false;
info("Un-admin-ed player by ID: {0} / {1}", target.uuid, arg[0]);
info("Un-admin-ed player: {0}", arg[0]);
}else{
info("Nobody with that name could be found.");
}
@ -610,37 +554,6 @@ public class ServerControl extends Module{
});
});
handler.register("griefers", "[min-break:place-ratio] [min-breakage]", "Find possible griefers currently online.", arg -> {
if(!state.is(State.playing)){
err("Open the server first.");
return;
}
try{
float ratio = arg.length > 0 ? Float.parseFloat(arg[0]) : 0.5f;
int minbreak = arg.length > 1 ? Integer.parseInt(arg[1]) : 100;
boolean found = false;
for(Player player : playerGroup.all()){
TraceInfo info = netServer.admins.getTraceByID(player.uuid);
if(info.totalBlocksBroken >= minbreak && info.totalBlocksBroken / Math.max(info.totalBlocksPlaced, 1f) >= ratio){
info("&ly - Player '{0}' / UUID &lm{1}&ly found: &lc{2}&ly broken and &lc{3}&ly placed.",
player.name, info.uuid, info.totalBlocksBroken, info.totalBlocksPlaced);
found = true;
}
}
if(!found){
info("No griefers matching the criteria have been found.");
}
}catch(NumberFormatException e){
err("Invalid number format.");
}
});
handler.register("gameover", "Force a game over.", arg -> {
if(state.is(State.menu)){
info("Not playing a map.");
@ -679,108 +592,22 @@ public class ServerControl extends Module{
}
});
handler.register("find", "<name...>", "Find player info(s) by name. Can optionally check for all names a player has had.", arg -> {
boolean checkAll = true;
handler.register("info", "<IP/UUID/name...>", "Find player info(s). Can optionally check for all names or IPs a player has had.", arg -> {
Array<PlayerInfo> infos = netServer.admins.findByName(arg[0], checkAll);
ObjectSet<PlayerInfo> infos = netServer.admins.findByName(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 name:");
if(infos.size > 0){
Log.info("&lgPlayers found: {0}", infos.size);
int i = 0;
for(PlayerInfo info : infos){
Log.info(" &ly{0}", info.id);
Log.info("&lc[{0}] Trace info for player '{1}' / UUID {2}", i ++, 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("&lcUse the info command to examine each person individually.");
}else{
info("Nobody with that name could be found.");
}
});
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 IP could be found.");
}
});
handler.register("info", "<UUID>", "Get global info for a player's UUID.", arg -> {
PlayerInfo info = netServer.admins.getInfoOptional(arg[0]);
if(info != null){
Log.info("&lcTrace info for player '{0}':", info.lastName);
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{
info("Nobody with that UUID could be found.");
}
});
handler.register("trace", "<username...>", "Trace a player's actions", arg -> {
if(!state.is(State.playing)){
err("Open the server first.");
return;
}
Player target = null;
for(Player player : playerGroup.all()){
if(player.name.equalsIgnoreCase(arg[0])){
target = player;
break;
}
}
if(target != null){
TraceInfo info = netServer.admins.getTraceByID(target.uuid);
Log.info("&lcTrace info for player '{0}':", target.name);
Log.info(" &lyEntity ID: {0}", info.playerid);
Log.info(" &lyIP: {0}", info.ip);
Log.info(" &lyUUID: {0}", info.uuid);
Log.info(" &lycustom client: {0}", info.modclient);
Log.info(" &lyandroid: {0}", info.android);
Log.info("");
Log.info(" &lytotal blocks broken: {0}", info.totalBlocksBroken);
Log.info(" &lystructure blocks broken: {0}", info.structureBlocksBroken);
Log.info(" &lylast block broken: {0}", info.lastBlockBroken.formalName);
Log.info("");
Log.info(" &lytotal blocks placed: {0}", info.totalBlocksPlaced);
Log.info(" &lylast block placed: {0}", info.lastBlockPlaced.formalName);
}else{
info("Nobody with that name could be found.");
}
@ -789,7 +616,7 @@ public class ServerControl extends Module{
private void readCommands(){
Scanner scan = new Scanner(System.in);
while(true){
while(scan.hasNext()){
String line = scan.nextLine();
Gdx.app.postRunnable(() -> {
@ -880,11 +707,4 @@ public class ServerControl extends Module{
state.set(State.menu);
}
}
@Override
public void update(){
if(!inExtraRound && state.mode.isPvp){
// checkPvPGameOver();
}
}
}