1
0
mirror of https://github.com/Anuken/Mindustry.git synced 2024-09-22 05:47:44 +03:00

Added utility griefer scan command

This commit is contained in:
Anuken 2018-04-11 13:05:08 -04:00
parent bed34c4cad
commit 221f7be21b
2 changed files with 33 additions and 2 deletions

View File

@ -1,7 +1,7 @@
#Autogenerated file. Do not modify.
#Sun Apr 08 12:37:55 EDT 2018
#Wed Apr 11 13:05:01 EDT 2018
version=release
androidBuildCode=505
androidBuildCode=506
name=Mindustry
code=3.5
build=custom build

View File

@ -502,6 +502,37 @@ public class ServerControl extends Module {
info("Saved to slot {0}.", slot);
});
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.9f;
int minbreak = arg.length > 1 ? Integer.parseInt(arg[1]) : 100;
boolean found = false;
for (Player player : playerGroup.all()) {
TraceInfo info = netServer.admins.getTrace(Net.getConnection(player.clientid).address);
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.");