Better server colors
This commit is contained in:
@@ -89,7 +89,7 @@ public class Vars implements Loadable{
|
|||||||
/** duration of time between turns in ticks */
|
/** duration of time between turns in ticks */
|
||||||
public static final float turnDuration = 2 * Time.toMinutes;
|
public static final float turnDuration = 2 * Time.toMinutes;
|
||||||
/** chance of an invasion per turn, 1 = 100% */
|
/** chance of an invasion per turn, 1 = 100% */
|
||||||
public static final float baseInvasionChance = 1f / 25f;
|
public static final float baseInvasionChance = 1f / 30f;
|
||||||
/** how many turns have to pass before invasions start */
|
/** how many turns have to pass before invasions start */
|
||||||
public static final int invasionGracePeriod = 20;
|
public static final int invasionGracePeriod = 20;
|
||||||
/** min armor fraction damage; e.g. 0.05 = at least 5% damage */
|
/** min armor fraction damage; e.g. 0.05 = at least 5% damage */
|
||||||
@@ -285,10 +285,10 @@ public class Vars implements Loadable{
|
|||||||
if(loadedLogger) return;
|
if(loadedLogger) return;
|
||||||
|
|
||||||
String[] tags = {"[green][D][]", "[royal][I][]", "[yellow][W][]", "[scarlet][E][]", ""};
|
String[] tags = {"[green][D][]", "[royal][I][]", "[yellow][W][]", "[scarlet][E][]", ""};
|
||||||
String[] stags = {"&lc&fb[D]", "&lg&fb[I]", "&ly&fb[W]", "&lr&fb[E]", ""};
|
String[] stags = {"&lc&fb[D]", "&lb&fb[I]", "&ly&fb[W]", "&lr&fb[E]", ""};
|
||||||
|
|
||||||
Seq<String> logBuffer = new Seq<>();
|
Seq<String> logBuffer = new Seq<>();
|
||||||
Log.setLogger((level, text) -> {
|
Log.logger = (level, text) -> {
|
||||||
String result = text;
|
String result = text;
|
||||||
String rawText = Log.format(stags[level.ordinal()] + "&fr " + text);
|
String rawText = Log.format(stags[level.ordinal()] + "&fr " + text);
|
||||||
System.out.println(rawText);
|
System.out.println(rawText);
|
||||||
@@ -304,9 +304,9 @@ public class Vars implements Loadable{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ui.scriptfrag.addMessage(Log.removeCodes(result));
|
ui.scriptfrag.addMessage(Log.removeColors(result));
|
||||||
}
|
}
|
||||||
});
|
};
|
||||||
|
|
||||||
Events.on(ClientLoadEvent.class, e -> logBuffer.each(ui.scriptfrag::addMessage));
|
Events.on(ClientLoadEvent.class, e -> logBuffer.each(ui.scriptfrag::addMessage));
|
||||||
|
|
||||||
@@ -319,18 +319,19 @@ public class Vars implements Loadable{
|
|||||||
settings.setAppName(appName);
|
settings.setAppName(appName);
|
||||||
|
|
||||||
Writer writer = settings.getDataDirectory().child("last_log.txt").writer(false);
|
Writer writer = settings.getDataDirectory().child("last_log.txt").writer(false);
|
||||||
LogHandler log = Log.getLogger();
|
LogHandler log = Log.logger;
|
||||||
Log.setLogger((level, text) -> {
|
//ignore it
|
||||||
|
Log.logger = (level, text) -> {
|
||||||
log.log(level, text);
|
log.log(level, text);
|
||||||
|
|
||||||
try{
|
try{
|
||||||
writer.write("[" + Character.toUpperCase(level.name().charAt(0)) +"] " + Log.removeCodes(text) + "\n");
|
writer.write("[" + Character.toUpperCase(level.name().charAt(0)) +"] " + Log.removeColors(text) + "\n");
|
||||||
writer.flush();
|
writer.flush();
|
||||||
}catch(IOException e){
|
}catch(IOException e){
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
//ignore it
|
//ignore it
|
||||||
}
|
}
|
||||||
});
|
};
|
||||||
|
|
||||||
loadedFileLogger = true;
|
loadedFileLogger = true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -194,14 +194,14 @@ public class NetClient implements ApplicationListener{
|
|||||||
}
|
}
|
||||||
|
|
||||||
//server console logging
|
//server console logging
|
||||||
Log.info("&y@: &lb@", player.name, message);
|
Log.info("&fi@: @", "&lc" + player.name, "&lw" + message);
|
||||||
|
|
||||||
//invoke event for all clients but also locally
|
//invoke event for all clients but also locally
|
||||||
//this is required so other clients get the correct name even if they don't know who's sending it yet
|
//this is required so other clients get the correct name even if they don't know who's sending it yet
|
||||||
Call.sendMessage(message, colorizeName(player.id(), player.name), player);
|
Call.sendMessage(message, colorizeName(player.id(), player.name), player);
|
||||||
}else{
|
}else{
|
||||||
//log command to console but with brackets
|
//log command to console but with brackets
|
||||||
Log.info("<&y@: &lm@&lg>", player.name, message);
|
Log.info("<&fi@: @&fr>", "&lk" + player.name, "&lw" + message);
|
||||||
|
|
||||||
//a command was sent, now get the output
|
//a command was sent, now get the output
|
||||||
if(response.type != ResponseType.valid){
|
if(response.type != ResponseType.valid){
|
||||||
|
|||||||
@@ -508,7 +508,8 @@ public class NetServer implements ApplicationListener{
|
|||||||
Call.playerDisconnect(player.id());
|
Call.playerDisconnect(player.id());
|
||||||
}
|
}
|
||||||
|
|
||||||
if(Config.showConnectMessages.bool()) Log.info("&lm[@] &lc@ has disconnected. &lg&fi(@)", player.uuid(), player.name, reason);
|
String message = Strings.format("&lb@&fi&lk has disconnected. &fi&lk[&lb@&fi&lk] (@)", player.name, player.uuid(), reason);
|
||||||
|
if(Config.showConnectMessages.bool()) Log.info(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
player.remove();
|
player.remove();
|
||||||
@@ -736,7 +737,8 @@ public class NetServer implements ApplicationListener{
|
|||||||
|
|
||||||
if(Config.showConnectMessages.bool()){
|
if(Config.showConnectMessages.bool()){
|
||||||
Call.sendMessage("[accent]" + player.name + "[accent] has connected.");
|
Call.sendMessage("[accent]" + player.name + "[accent] has connected.");
|
||||||
Log.info("&lm[@] &y@ has connected.", player.uuid(), player.name);
|
String message = Strings.format("&lb@&fi&lk has connected. &fi&lk[&lb@&fi&lk]", player.name, player.uuid());
|
||||||
|
Log.info(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!Config.motd.string().equalsIgnoreCase("off")){
|
if(!Config.motd.string().equalsIgnoreCase("off")){
|
||||||
@@ -785,7 +787,7 @@ public class NetServer implements ApplicationListener{
|
|||||||
public void openServer(){
|
public void openServer(){
|
||||||
try{
|
try{
|
||||||
net.host(Config.port.num());
|
net.host(Config.port.num());
|
||||||
info("&lcOpened a server on port @.", Config.port.num());
|
info("Opened a server on port @.", Config.port.num());
|
||||||
}catch(BindException e){
|
}catch(BindException e){
|
||||||
Log.err("Unable to host: Port already in use! Make sure no other servers are running on the same port in your network.");
|
Log.err("Unable to host: Port already in use! Make sure no other servers are running on the same port in your network.");
|
||||||
state.set(State.menu);
|
state.set(State.menu);
|
||||||
|
|||||||
@@ -112,6 +112,14 @@ public abstract class UnlockableContent extends MappableContent{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Unlocks this content, but does not fire any events. */
|
||||||
|
public void quiteUnlock(){
|
||||||
|
if(!unlocked()){
|
||||||
|
unlocked = true;
|
||||||
|
Core.settings.put(name + "-unlocked", true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public boolean unlocked(){
|
public boolean unlocked(){
|
||||||
if(net.client()) return state.rules.researched.contains(name);
|
if(net.client()) return state.rules.researched.contains(name);
|
||||||
return unlocked || alwaysUnlocked;
|
return unlocked || alwaysUnlocked;
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import arc.struct.*;
|
|||||||
import arc.util.*;
|
import arc.util.*;
|
||||||
import mindustry.content.*;
|
import mindustry.content.*;
|
||||||
import mindustry.game.EventType.*;
|
import mindustry.game.EventType.*;
|
||||||
|
import mindustry.io.legacy.*;
|
||||||
import mindustry.maps.*;
|
import mindustry.maps.*;
|
||||||
import mindustry.type.*;
|
import mindustry.type.*;
|
||||||
import mindustry.world.blocks.storage.*;
|
import mindustry.world.blocks.storage.*;
|
||||||
@@ -260,6 +261,11 @@ public class Universe{
|
|||||||
private void load(){
|
private void load(){
|
||||||
seconds = Core.settings.getInt("utimei");
|
seconds = Core.settings.getInt("utimei");
|
||||||
turn = Core.settings.getInt("turn");
|
turn = Core.settings.getInt("turn");
|
||||||
|
|
||||||
|
if(Core.settings.has("unlocks")){
|
||||||
|
LegacyIO.readResearch();
|
||||||
|
Core.settings.remove("unlocks");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,8 @@ package mindustry.io.legacy;
|
|||||||
|
|
||||||
import arc.*;
|
import arc.*;
|
||||||
import arc.struct.*;
|
import arc.struct.*;
|
||||||
|
import mindustry.*;
|
||||||
|
import mindustry.ctype.*;
|
||||||
import mindustry.ui.dialogs.JoinDialog.*;
|
import mindustry.ui.dialogs.JoinDialog.*;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
@@ -48,4 +50,35 @@ public class LegacyIO{
|
|||||||
return arr;
|
return arr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void readResearch(){
|
||||||
|
try{
|
||||||
|
byte[] bytes = Core.settings.getBytes("unlocks");
|
||||||
|
DataInputStream stream = new DataInputStream(new ByteArrayInputStream(bytes));
|
||||||
|
|
||||||
|
int length = stream.readInt();
|
||||||
|
if(length > 0){
|
||||||
|
stream.readUTF(); //name of key type
|
||||||
|
stream.readUTF(); //name of value type
|
||||||
|
|
||||||
|
//each element is an array list
|
||||||
|
for(int i = 0; i < length; i++){
|
||||||
|
ContentType type = ContentType.all[stream.readInt()];
|
||||||
|
int arrLength = stream.readInt();
|
||||||
|
if(arrLength > 0){
|
||||||
|
stream.readUTF(); //type of contents (String)
|
||||||
|
for(int j = 0; j < arrLength; j++){
|
||||||
|
String name = stream.readUTF();
|
||||||
|
Content out = Vars.content.getByName(type, name);
|
||||||
|
if(out instanceof UnlockableContent u){
|
||||||
|
u.unlock();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}catch(Exception e){
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -59,12 +59,12 @@ public class Scripts implements Disposable{
|
|||||||
if(o instanceof Undefined) o = "undefined";
|
if(o instanceof Undefined) o = "undefined";
|
||||||
return String.valueOf(o);
|
return String.valueOf(o);
|
||||||
}catch(Throwable t){
|
}catch(Throwable t){
|
||||||
return getError(t);
|
return getError(t, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getError(Throwable t){
|
private String getError(Throwable t, boolean log){
|
||||||
t.printStackTrace();
|
if(log) Log.err(t);
|
||||||
return t.getClass().getSimpleName() + (t.getMessage() == null ? "" : ": " + t.getMessage());
|
return t.getClass().getSimpleName() + (t.getMessage() == null ? "" : ": " + t.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -138,7 +138,7 @@ public class Scripts implements Disposable{
|
|||||||
if(currentMod != null){
|
if(currentMod != null){
|
||||||
file = currentMod.name + "/" + file;
|
file = currentMod.name + "/" + file;
|
||||||
}
|
}
|
||||||
log(LogLevel.err, file, "" + getError(t));
|
log(LogLevel.err, file, "" + getError(t, true));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -577,7 +577,10 @@ public class Administration{
|
|||||||
autosave("Whether the periodically save the map when playing.", false),
|
autosave("Whether the periodically save the map when playing.", false),
|
||||||
autosaveAmount("The maximum amount of autosaves. Older ones get replaced.", 10),
|
autosaveAmount("The maximum amount of autosaves. Older ones get replaced.", 10),
|
||||||
autosaveSpacing("Spacing between autosaves in seconds.", 60 * 5),
|
autosaveSpacing("Spacing between autosaves in seconds.", 60 * 5),
|
||||||
debug("Enable debug logging", false, () -> Log.setLogLevel(debug() ? LogLevel.debug : LogLevel.info));
|
debug("Enable debug logging", false, () -> {
|
||||||
|
LogLevel level = debug() ? LogLevel.debug : LogLevel.info;
|
||||||
|
Log.level = level;
|
||||||
|
});
|
||||||
|
|
||||||
public static final Config[] all = values();
|
public static final Config[] all = values();
|
||||||
|
|
||||||
|
|||||||
@@ -58,8 +58,6 @@ public class NetworkIO{
|
|||||||
state.rules = JsonIO.read(Rules.class, stream.readUTF());
|
state.rules = JsonIO.read(Rules.class, stream.readUTF());
|
||||||
state.map = new Map(SaveIO.getSaveWriter().readStringMap(stream));
|
state.map = new Map(SaveIO.getSaveWriter().readStringMap(stream));
|
||||||
|
|
||||||
Log.info("READ RULES: @", state.rules.researched);
|
|
||||||
|
|
||||||
state.wave = stream.readInt();
|
state.wave = stream.readInt();
|
||||||
state.wavetime = stream.readFloat();
|
state.wavetime = stream.readFloat();
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
org.gradle.daemon=true
|
org.gradle.daemon=true
|
||||||
org.gradle.jvmargs=-Xms256m -Xmx1024m
|
org.gradle.jvmargs=-Xms256m -Xmx1024m
|
||||||
archash=46ebdb4aeb1e03ca6b3b4c27a93533dc92278a33
|
archash=723aa43b053b753631ed54906e7669132cddfdc6
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ import java.time.*;
|
|||||||
import java.time.format.*;
|
import java.time.format.*;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
|
import static arc.util.ColorCodes.*;
|
||||||
import static arc.util.Log.*;
|
import static arc.util.Log.*;
|
||||||
import static mindustry.Vars.*;
|
import static mindustry.Vars.*;
|
||||||
|
|
||||||
@@ -37,7 +38,7 @@ public class ServerControl implements ApplicationListener{
|
|||||||
private static final int roundExtraTime = 12;
|
private static final int roundExtraTime = 12;
|
||||||
private static final int maxLogLength = 1024 * 512;
|
private static final int maxLogLength = 1024 * 512;
|
||||||
|
|
||||||
protected static String[] tags = {"&lc&fb[D]", "&lg&fb[I]", "&ly&fb[W]", "&lr&fb[E]", ""};
|
protected static String[] tags = {"&lc&fb[D]&fr", "&lb&fb[I]&fr", "&ly&fb[W]&fr", "&lr&fb[E]", ""};
|
||||||
protected static DateTimeFormatter dateTime = DateTimeFormatter.ofPattern("MM-dd-yyyy HH:mm:ss"),
|
protected static DateTimeFormatter dateTime = DateTimeFormatter.ofPattern("MM-dd-yyyy HH:mm:ss"),
|
||||||
autosaveDate = DateTimeFormatter.ofPattern("MM-dd-yyyy_HH-mm-ss");
|
autosaveDate = DateTimeFormatter.ofPattern("MM-dd-yyyy_HH-mm-ss");
|
||||||
|
|
||||||
@@ -74,22 +75,27 @@ public class ServerControl implements ApplicationListener{
|
|||||||
lastMode = Gamemode.survival;
|
lastMode = Gamemode.survival;
|
||||||
}
|
}
|
||||||
|
|
||||||
Log.setLogger((level, text) -> {
|
logger = (level1, text) -> {
|
||||||
String result = "[" + dateTime.format(LocalDateTime.now()) + "] " + format(tags[level.ordinal()] + " " + text + "&fr");
|
String result = bold + lightBlack + "[" + dateTime.format(LocalDateTime.now()) + "] " + reset + format(tags[level1.ordinal()] + " " + text + "&fr");
|
||||||
System.out.println(result);
|
System.out.println(result);
|
||||||
|
|
||||||
if(Config.logging.bool()){
|
if(Config.logging.bool()){
|
||||||
logToFile("[" + dateTime.format(LocalDateTime.now()) + "] " + formatColors(tags[level.ordinal()] + " " + text + "&fr", false));
|
logToFile("[" + dateTime.format(LocalDateTime.now()) + "] " + formatColors(tags[level1.ordinal()] + " " + text + "&fr", false));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(socketOutput != null){
|
if(socketOutput != null){
|
||||||
try{
|
try{
|
||||||
socketOutput.println(formatColors(text + "&fr", false));
|
socketOutput.println(formatColors(text + "&fr", false));
|
||||||
}catch(Throwable e){
|
}catch(Throwable e1){
|
||||||
err("Error occurred logging to socket: @", e.getClass().getSimpleName());
|
err("Error occurred logging to socket: @", e1.getClass().getSimpleName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
};
|
||||||
|
|
||||||
|
formatter = (text, useColors, arg) -> {
|
||||||
|
text = Strings.format(text.replace("@", "&fb&lb@&fr"), arg);
|
||||||
|
return useColors ? addColors(text) : removeColors(text);
|
||||||
|
};
|
||||||
|
|
||||||
Time.setDeltaProvider(() -> Core.graphics.getDeltaTime() * 60f);
|
Time.setDeltaProvider(() -> Core.graphics.getDeltaTime() * 60f);
|
||||||
|
|
||||||
@@ -115,12 +121,12 @@ public class ServerControl implements ApplicationListener{
|
|||||||
|
|
||||||
if(args.length > 0){
|
if(args.length > 0){
|
||||||
commands.addAll(Strings.join(" ", args).split(","));
|
commands.addAll(Strings.join(" ", args).split(","));
|
||||||
info("&lmFound @ command-line arguments to parse.", commands.size);
|
info("Found @ command-line arguments to parse.", commands.size);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!Config.startCommands.string().isEmpty()){
|
if(!Config.startCommands.string().isEmpty()){
|
||||||
String[] startup = Strings.join(" ", Config.startCommands.string()).split(",");
|
String[] startup = Strings.join(" ", Config.startCommands.string()).split(",");
|
||||||
info("&lmFound @ startup commands.", startup.length);
|
info("Found @ startup commands.", startup.length);
|
||||||
commands.addAll(startup);
|
commands.addAll(startup);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -128,7 +134,7 @@ public class ServerControl implements ApplicationListener{
|
|||||||
CommandResponse response = handler.handleMessage(s);
|
CommandResponse response = handler.handleMessage(s);
|
||||||
if(response.type != ResponseType.valid){
|
if(response.type != ResponseType.valid){
|
||||||
err("Invalid command argument sent: '@': @", s, response.type.name());
|
err("Invalid command argument sent: '@': @", s, response.type.name());
|
||||||
err("Argument usage: &lc<command-1> <command1-args...>,<command-2> <command-2-args2...>");
|
err("Argument usage: &lb<command-1> <command1-args...>,<command-2> <command-2-args2...>");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -141,7 +147,7 @@ public class ServerControl implements ApplicationListener{
|
|||||||
|
|
||||||
if(Version.build == -1){
|
if(Version.build == -1){
|
||||||
warn("&lyYour server is running a custom build, which means that client checking is disabled.");
|
warn("&lyYour server is running a custom build, which means that client checking is disabled.");
|
||||||
warn("&lyIt is highly advised to specify which version you're using by building with gradle args &lc-Pbuildversion=&lm<build>&ly.");
|
warn("&lyIt is highly advised to specify which version you're using by building with gradle args &lb&fb-Pbuildversion=&lr<build>");
|
||||||
}
|
}
|
||||||
|
|
||||||
//set up default shuffle mode
|
//set up default shuffle mode
|
||||||
@@ -154,9 +160,9 @@ public class ServerControl implements ApplicationListener{
|
|||||||
Events.on(GameOverEvent.class, event -> {
|
Events.on(GameOverEvent.class, event -> {
|
||||||
if(inExtraRound) return;
|
if(inExtraRound) return;
|
||||||
if(state.rules.waves){
|
if(state.rules.waves){
|
||||||
info("&lcGame over! Reached wave &ly@&lc with &ly@&lc players online on map &ly@&lc.", state.wave, Groups.player.size(), Strings.capitalize(state.map.name()));
|
info("Game over! Reached wave @ with @ players online on map @.", state.wave, Groups.player.size(), Strings.capitalize(state.map.name()));
|
||||||
}else{
|
}else{
|
||||||
info("&lcGame over! Team &ly@&lc is victorious with &ly@&lc players online on map &ly@&lc.", event.winner.name, Groups.player.size(), Strings.capitalize(state.map.name()));
|
info("Game over! Team @ is victorious with @ players online on map @.", event.winner.name, Groups.player.size(), Strings.capitalize(state.map.name()));
|
||||||
}
|
}
|
||||||
|
|
||||||
//set next map to be played
|
//set next map to be played
|
||||||
@@ -209,11 +215,11 @@ public class ServerControl implements ApplicationListener{
|
|||||||
|
|
||||||
String fileName = "auto_" + mapName + "_" + date + "." + saveExtension;
|
String fileName = "auto_" + mapName + "_" + date + "." + saveExtension;
|
||||||
Fi file = saveDirectory.child(fileName);
|
Fi file = saveDirectory.child(fileName);
|
||||||
info("&lbAutosaving...");
|
info("Autosaving...");
|
||||||
|
|
||||||
try{
|
try{
|
||||||
SaveIO.save(file);
|
SaveIO.save(file);
|
||||||
info("&lbAutosave completed.");
|
info("Autosave completed.");
|
||||||
}catch(Throwable e){
|
}catch(Throwable e){
|
||||||
err("Autosave failed.", e);
|
err("Autosave failed.", e);
|
||||||
}
|
}
|
||||||
@@ -241,25 +247,25 @@ public class ServerControl implements ApplicationListener{
|
|||||||
Timer.schedule(() -> Core.settings.forceSave(), saveInterval, saveInterval);
|
Timer.schedule(() -> Core.settings.forceSave(), saveInterval, saveInterval);
|
||||||
|
|
||||||
if(!mods.list().isEmpty()){
|
if(!mods.list().isEmpty()){
|
||||||
info("&lc@ mods loaded.", mods.list().size);
|
info("@ mods loaded.", mods.list().size);
|
||||||
}
|
}
|
||||||
|
|
||||||
toggleSocket(Config.socketInput.bool());
|
toggleSocket(Config.socketInput.bool());
|
||||||
|
|
||||||
info("&lcServer loaded. Type &ly'help'&lc for help.");
|
info("Server loaded. Type @ for help.", "'help'");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void registerCommands(){
|
private void registerCommands(){
|
||||||
handler.register("help", "Displays this command list.", arg -> {
|
handler.register("help", "Displays this command list.", arg -> {
|
||||||
info("Commands:");
|
info("Commands:");
|
||||||
for(Command command : handler.getCommandList()){
|
for(Command command : handler.getCommandList()){
|
||||||
info(" &y" + command.text + (command.paramText.isEmpty() ? "" : " ") + command.paramText + " - &lm" + command.description);
|
info(" &b&lb " + command.text + (command.paramText.isEmpty() ? "" : " &lc&fi") + command.paramText + "&fr - &lw" + command.description);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
handler.register("version", "Displays server version info.", arg -> {
|
handler.register("version", "Displays server version info.", arg -> {
|
||||||
info("&lmVersion: &lyMindustry @-@ @ / build @", Version.number, Version.modifier, Version.type, Version.build + (Version.revision == 0 ? "" : "." + Version.revision));
|
info("Version: Mindustry @-@ @ / build @", Version.number, Version.modifier, Version.type, Version.build + (Version.revision == 0 ? "" : "." + Version.revision));
|
||||||
info("&lmJava Version: &ly@", System.getProperty("java.version"));
|
info("Java Version: @", System.getProperty("java.version"));
|
||||||
});
|
});
|
||||||
|
|
||||||
handler.register("exit", "Exit the server application.", arg -> {
|
handler.register("exit", "Exit the server application.", arg -> {
|
||||||
@@ -299,7 +305,7 @@ public class ServerControl implements ApplicationListener{
|
|||||||
result = maps.all().find(map -> map.name().equalsIgnoreCase(arg[0].replace('_', ' ')) || map.name().equalsIgnoreCase(arg[0]));
|
result = maps.all().find(map -> map.name().equalsIgnoreCase(arg[0].replace('_', ' ')) || map.name().equalsIgnoreCase(arg[0]));
|
||||||
|
|
||||||
if(result == null){
|
if(result == null){
|
||||||
err("No map with name &y'@'&lr found.", arg[0]);
|
err("No map with name '@' found.", arg[0]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
@@ -329,21 +335,21 @@ public class ServerControl implements ApplicationListener{
|
|||||||
if(!maps.all().isEmpty()){
|
if(!maps.all().isEmpty()){
|
||||||
info("Maps:");
|
info("Maps:");
|
||||||
for(Map map : maps.all()){
|
for(Map map : maps.all()){
|
||||||
info(" &ly@: &lb&fi@ / @x@", map.name(), map.custom ? "Custom" : "Default", map.width, map.height);
|
info(" @: &fi@ / @x@", map.name(), map.custom ? "Custom" : "Default", map.width, map.height);
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
info("No maps found.");
|
info("No maps found.");
|
||||||
}
|
}
|
||||||
info("&lyMap directory: &lb&fi@", customMapDirectory.file().getAbsoluteFile().toString());
|
info("Map directory: &fi@", customMapDirectory.file().getAbsoluteFile().toString());
|
||||||
});
|
});
|
||||||
|
|
||||||
handler.register("reloadmaps", "Reload all maps from disk.", arg -> {
|
handler.register("reloadmaps", "Reload all maps from disk.", arg -> {
|
||||||
int beforeMaps = maps.all().size;
|
int beforeMaps = maps.all().size;
|
||||||
maps.reload();
|
maps.reload();
|
||||||
if(maps.all().size > beforeMaps){
|
if(maps.all().size > beforeMaps){
|
||||||
info("&lc@&ly new map(s) found and reloaded.", maps.all().size - beforeMaps);
|
info("@ new map(s) found and reloaded.", maps.all().size - beforeMaps);
|
||||||
}else{
|
}else{
|
||||||
info("&lyMaps reloaded.");
|
info("Maps reloaded.");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -352,23 +358,23 @@ public class ServerControl implements ApplicationListener{
|
|||||||
info("Status: &rserver closed");
|
info("Status: &rserver closed");
|
||||||
}else{
|
}else{
|
||||||
info("Status:");
|
info("Status:");
|
||||||
info(" &lyPlaying on map &fi@&fb &lb/&ly Wave @", Strings.capitalize(state.map.name()), state.wave);
|
info(" Playing on map &fi@ / Wave @", Strings.capitalize(state.map.name()), state.wave);
|
||||||
|
|
||||||
if(state.rules.waves){
|
if(state.rules.waves){
|
||||||
info("&ly @ enemies.", state.enemies);
|
info(" @ enemies.", state.enemies);
|
||||||
}else{
|
}else{
|
||||||
info("&ly @ seconds until next wave.", (int)(state.wavetime / 60));
|
info(" @ seconds until next wave.", (int)(state.wavetime / 60));
|
||||||
}
|
}
|
||||||
|
|
||||||
info(" &ly@ FPS, @ MB used.", Core.graphics.getFramesPerSecond(), Core.app.getJavaHeap() / 1024 / 1024);
|
info(" @ FPS, @ MB used.", Core.graphics.getFramesPerSecond(), Core.app.getJavaHeap() / 1024 / 1024);
|
||||||
|
|
||||||
if(Groups.player.size() > 0){
|
if(Groups.player.size() > 0){
|
||||||
info(" &lyPlayers: @", Groups.player.size());
|
info(" Players: @", Groups.player.size());
|
||||||
for(Player p : Groups.player){
|
for(Player p : Groups.player){
|
||||||
info(" &y@ / @", p.name(), p.uuid());
|
info(" @ / @", p.name, p.uuid());
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
info(" &lyNo players connected.");
|
info(" No players connected.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -377,30 +383,30 @@ public class ServerControl implements ApplicationListener{
|
|||||||
if(!mods.list().isEmpty()){
|
if(!mods.list().isEmpty()){
|
||||||
info("Mods:");
|
info("Mods:");
|
||||||
for(LoadedMod mod : mods.list()){
|
for(LoadedMod mod : mods.list()){
|
||||||
info(" &ly@ &lcv@", mod.meta.displayName(), mod.meta.version);
|
info(" @ &fi@", mod.meta.displayName(), mod.meta.version);
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
info("No mods found.");
|
info("No mods found.");
|
||||||
}
|
}
|
||||||
info("&lyMod directory: &lb&fi@", modDirectory.file().getAbsoluteFile().toString());
|
info("Mod directory: &fi@", modDirectory.file().getAbsoluteFile().toString());
|
||||||
});
|
});
|
||||||
|
|
||||||
handler.register("mod", "<name...>", "Display information about a loaded plugin.", arg -> {
|
handler.register("mod", "<name...>", "Display information about a loaded plugin.", arg -> {
|
||||||
LoadedMod mod = mods.list().find(p -> p.meta.name.equalsIgnoreCase(arg[0]));
|
LoadedMod mod = mods.list().find(p -> p.meta.name.equalsIgnoreCase(arg[0]));
|
||||||
if(mod != null){
|
if(mod != null){
|
||||||
info("Name: &ly@", mod.meta.displayName());
|
info("Name: @", mod.meta.displayName());
|
||||||
info("Internal Name: &ly@", mod.name);
|
info("Internal Name: @", mod.name);
|
||||||
info("Version: &ly@", mod.meta.version);
|
info("Version: @", mod.meta.version);
|
||||||
info("Author: &ly@", mod.meta.author);
|
info("Author: @", mod.meta.author);
|
||||||
info("Path: &ly@", mod.file.path());
|
info("Path: @", mod.file.path());
|
||||||
info("Description: &ly@", mod.meta.description);
|
info("Description: @", mod.meta.description);
|
||||||
}else{
|
}else{
|
||||||
info("No mod with name &ly'@'&lg found.");
|
info("No mod with name '@' found.");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
handler.register("js", "<script...>", "Run arbitrary Javascript.", arg -> {
|
handler.register("js", "<script...>", "Run arbitrary Javascript.", arg -> {
|
||||||
info("&lc" + mods.getScripts().runConsole(arg[0]));
|
info("&fi&lw&fb" + mods.getScripts().runConsole(arg[0]));
|
||||||
});
|
});
|
||||||
|
|
||||||
handler.register("say", "<message...>", "Send a message to all players.", arg -> {
|
handler.register("say", "<message...>", "Send a message to all players.", arg -> {
|
||||||
@@ -411,7 +417,7 @@ public class ServerControl implements ApplicationListener{
|
|||||||
|
|
||||||
Call.sendMessage("[scarlet][[Server]:[] " + arg[0]);
|
Call.sendMessage("[scarlet][[Server]:[] " + arg[0]);
|
||||||
|
|
||||||
info("&lyServer: &lb@", arg[0]);
|
info("&fi&lcServer: &fr@", "&lw" + arg[0]);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
@@ -426,7 +432,7 @@ public class ServerControl implements ApplicationListener{
|
|||||||
JsonValue base = JsonIO.json().fromJson(null, rules);
|
JsonValue base = JsonIO.json().fromJson(null, rules);
|
||||||
|
|
||||||
if(arg.length == 0){
|
if(arg.length == 0){
|
||||||
Log.info("&lyRules:\n@", JsonIO.print(rules));
|
Log.info("Rules:\n@", JsonIO.print(rules));
|
||||||
}else if(arg.length == 1){
|
}else if(arg.length == 1){
|
||||||
Log.err("Invalid usage. Specify which rule to remove or add.");
|
Log.err("Invalid usage. Specify which rule to remove or add.");
|
||||||
}else{
|
}else{
|
||||||
@@ -438,7 +444,7 @@ public class ServerControl implements ApplicationListener{
|
|||||||
boolean remove = arg[0].equals("remove");
|
boolean remove = arg[0].equals("remove");
|
||||||
if(remove){
|
if(remove){
|
||||||
if(base.has(arg[1])){
|
if(base.has(arg[1])){
|
||||||
Log.info("Rule &lc'@'&lg removed.", arg[1]);
|
Log.info("Rule '@' removed.", arg[1]);
|
||||||
base.remove(arg[1]);
|
base.remove(arg[1]);
|
||||||
}else{
|
}else{
|
||||||
Log.err("Rule not defined, so not removed.");
|
Log.err("Rule not defined, so not removed.");
|
||||||
@@ -462,7 +468,7 @@ public class ServerControl implements ApplicationListener{
|
|||||||
base.remove(value.name);
|
base.remove(value.name);
|
||||||
}
|
}
|
||||||
base.addChild(arg[1], value);
|
base.addChild(arg[1], value);
|
||||||
Log.info("Changed rule: &ly@", value.toString().replace("\n", " "));
|
Log.info("Changed rule: @", value.toString().replace("\n", " "));
|
||||||
}catch(Throwable e){
|
}catch(Throwable e){
|
||||||
Log.err("Error parsing rule JSON: @", e.getMessage());
|
Log.err("Error parsing rule JSON: @", e.getMessage());
|
||||||
}
|
}
|
||||||
@@ -501,7 +507,7 @@ public class ServerControl implements ApplicationListener{
|
|||||||
|
|
||||||
handler.register("playerlimit", "[off/somenumber]", "Set the server player limit.", arg -> {
|
handler.register("playerlimit", "[off/somenumber]", "Set the server player limit.", arg -> {
|
||||||
if(arg.length == 0){
|
if(arg.length == 0){
|
||||||
info("Player limit is currently &lc@.", netServer.admins.getPlayerLimit() == 0 ? "off" : netServer.admins.getPlayerLimit());
|
info("Player limit is currently @.", netServer.admins.getPlayerLimit() == 0 ? "off" : netServer.admins.getPlayerLimit());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(arg[0].equals("off")){
|
if(arg[0].equals("off")){
|
||||||
@@ -521,11 +527,11 @@ public class ServerControl implements ApplicationListener{
|
|||||||
|
|
||||||
handler.register("config", "[name] [value...]", "Configure server settings.", arg -> {
|
handler.register("config", "[name] [value...]", "Configure server settings.", arg -> {
|
||||||
if(arg.length == 0){
|
if(arg.length == 0){
|
||||||
info("&lyAll config values:");
|
info("All config values:");
|
||||||
for(Config c : Config.all){
|
for(Config c : Config.all){
|
||||||
Log.info("&ly| &lc@:&lm @", c.name(), c.get());
|
Log.info("&lk| @: @", c.name(), "&lc&fi" + c.get());
|
||||||
Log.info("&ly| | @", c.description);
|
Log.info("&lk| | &lw" + c.description);
|
||||||
Log.info("&ly|");
|
Log.info("&lk|");
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -533,7 +539,7 @@ public class ServerControl implements ApplicationListener{
|
|||||||
try{
|
try{
|
||||||
Config c = Config.valueOf(arg[0]);
|
Config c = Config.valueOf(arg[0]);
|
||||||
if(arg.length == 1){
|
if(arg.length == 1){
|
||||||
Log.info("&lc'@'&lg is currently &lc@.", c.name(), c.get());
|
Log.info("'@' is currently @.", c.name(), c.get());
|
||||||
}else{
|
}else{
|
||||||
if(c.isBool()){
|
if(c.isBool()){
|
||||||
c.set(arg[1].equals("on") || arg[1].equals("true"));
|
c.set(arg[1].equals("on") || arg[1].equals("true"));
|
||||||
@@ -548,7 +554,7 @@ public class ServerControl implements ApplicationListener{
|
|||||||
c.set(arg[1]);
|
c.set(arg[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
Log.info("&lc@&lg set to &lc@.", c.name(), c.get());
|
Log.info("@ set to @.", c.name(), c.get());
|
||||||
Core.settings.forceSave();
|
Core.settings.forceSave();
|
||||||
}
|
}
|
||||||
}catch(IllegalArgumentException e){
|
}catch(IllegalArgumentException e){
|
||||||
@@ -558,9 +564,9 @@ public class ServerControl implements ApplicationListener{
|
|||||||
|
|
||||||
handler.register("subnet-ban", "[add/remove] [address]", "Ban a subnet. This simply rejects all connections with IPs starting with some string.", arg -> {
|
handler.register("subnet-ban", "[add/remove] [address]", "Ban a subnet. This simply rejects all connections with IPs starting with some string.", arg -> {
|
||||||
if(arg.length == 0){
|
if(arg.length == 0){
|
||||||
Log.info("Subnets banned: &lc@", netServer.admins.getSubnetBans().isEmpty() ? "<none>" : "");
|
Log.info("Subnets banned: @", netServer.admins.getSubnetBans().isEmpty() ? "<none>" : "");
|
||||||
for(String subnet : netServer.admins.getSubnetBans()){
|
for(String subnet : netServer.admins.getSubnetBans()){
|
||||||
Log.info("&ly " + subnet + "");
|
Log.info("&lw " + subnet + "");
|
||||||
}
|
}
|
||||||
}else if(arg.length == 1){
|
}else if(arg.length == 1){
|
||||||
err("You must provide a subnet to add or remove.");
|
err("You must provide a subnet to add or remove.");
|
||||||
@@ -572,7 +578,7 @@ public class ServerControl implements ApplicationListener{
|
|||||||
}
|
}
|
||||||
|
|
||||||
netServer.admins.addSubnetBan(arg[1]);
|
netServer.admins.addSubnetBan(arg[1]);
|
||||||
Log.info("Banned &ly@&lc**", arg[1]);
|
Log.info("Banned @**", arg[1]);
|
||||||
}else if(arg[0].equals("remove")){
|
}else if(arg[0].equals("remove")){
|
||||||
if(!netServer.admins.getSubnetBans().contains(arg[1])){
|
if(!netServer.admins.getSubnetBans().contains(arg[1])){
|
||||||
err("That subnet isn't banned.");
|
err("That subnet isn't banned.");
|
||||||
@@ -580,7 +586,7 @@ public class ServerControl implements ApplicationListener{
|
|||||||
}
|
}
|
||||||
|
|
||||||
netServer.admins.removeSubnetBan(arg[1]);
|
netServer.admins.removeSubnetBan(arg[1]);
|
||||||
Log.info("Unbanned &ly@&lc**", arg[1]);
|
Log.info("Unbanned @**", arg[1]);
|
||||||
}else{
|
}else{
|
||||||
err("Incorrect usage. You must provide add/remove as the second argument.");
|
err("Incorrect usage. You must provide add/remove as the second argument.");
|
||||||
}
|
}
|
||||||
@@ -589,12 +595,12 @@ public class ServerControl implements ApplicationListener{
|
|||||||
|
|
||||||
handler.register("whitelisted", "List the entire whitelist.", arg -> {
|
handler.register("whitelisted", "List the entire whitelist.", arg -> {
|
||||||
if(netServer.admins.getWhitelisted().isEmpty()){
|
if(netServer.admins.getWhitelisted().isEmpty()){
|
||||||
info("&lyNo whitelisted players found.");
|
info("No whitelisted players found.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
info("&lyWhitelist:");
|
info("Whitelist:");
|
||||||
netServer.admins.getWhitelisted().each(p -> Log.info("- &ly@", p.lastName));
|
netServer.admins.getWhitelisted().each(p -> info("- @", p.lastName));
|
||||||
});
|
});
|
||||||
|
|
||||||
handler.register("whitelist-add", "<ID>", "Add a player to the whitelist by ID.", arg -> {
|
handler.register("whitelist-add", "<ID>", "Add a player to the whitelist by ID.", arg -> {
|
||||||
@@ -605,7 +611,7 @@ public class ServerControl implements ApplicationListener{
|
|||||||
}
|
}
|
||||||
|
|
||||||
netServer.admins.whitelist(arg[0]);
|
netServer.admins.whitelist(arg[0]);
|
||||||
info("Player &ly'@'&lg has been whitelisted.", info.lastName);
|
info("Player '@' has been whitelisted.", info.lastName);
|
||||||
});
|
});
|
||||||
|
|
||||||
handler.register("whitelist-remove", "<ID>", "Remove a player to the whitelist by ID.", arg -> {
|
handler.register("whitelist-remove", "<ID>", "Remove a player to the whitelist by ID.", arg -> {
|
||||||
@@ -616,18 +622,18 @@ public class ServerControl implements ApplicationListener{
|
|||||||
}
|
}
|
||||||
|
|
||||||
netServer.admins.unwhitelist(arg[0]);
|
netServer.admins.unwhitelist(arg[0]);
|
||||||
info("Player &ly'@'&lg has been un-whitelisted.", info.lastName);
|
info("Player '@' has been un-whitelisted.", info.lastName);
|
||||||
});
|
});
|
||||||
|
|
||||||
handler.register("shuffle", "[none/all/custom/builtin]", "Set map shuffling mode.", arg -> {
|
handler.register("shuffle", "[none/all/custom/builtin]", "Set map shuffling mode.", arg -> {
|
||||||
if(arg.length == 0){
|
if(arg.length == 0){
|
||||||
info("Shuffle mode current set to &ly'@'&lg.", maps.getShuffleMode());
|
info("Shuffle mode current set to '@'.", maps.getShuffleMode());
|
||||||
}else{
|
}else{
|
||||||
try{
|
try{
|
||||||
ShuffleMode mode = ShuffleMode.valueOf(arg[0]);
|
ShuffleMode mode = ShuffleMode.valueOf(arg[0]);
|
||||||
Core.settings.put("shufflemode", mode.name());
|
Core.settings.put("shufflemode", mode.name());
|
||||||
maps.setShuffleMode(mode);
|
maps.setShuffleMode(mode);
|
||||||
info("Shuffle mode set to &ly'@'&lg.", arg[0]);
|
info("Shuffle mode set to '@'.", arg[0]);
|
||||||
}catch(Exception e){
|
}catch(Exception e){
|
||||||
err("Invalid shuffle mode.");
|
err("Invalid shuffle mode.");
|
||||||
}
|
}
|
||||||
@@ -638,7 +644,7 @@ public class ServerControl implements ApplicationListener{
|
|||||||
Map res = maps.all().find(map -> map.name().equalsIgnoreCase(arg[0].replace('_', ' ')) || map.name().equalsIgnoreCase(arg[0]));
|
Map res = maps.all().find(map -> map.name().equalsIgnoreCase(arg[0].replace('_', ' ')) || map.name().equalsIgnoreCase(arg[0]));
|
||||||
if(res != null){
|
if(res != null){
|
||||||
nextMapOverride = res;
|
nextMapOverride = res;
|
||||||
Log.info("Next map set to &ly'@'.", res.name());
|
Log.info("Next map set to '@'.", res.name());
|
||||||
}else{
|
}else{
|
||||||
Log.err("No map '@' found.", arg[0]);
|
Log.err("No map '@' found.", arg[0]);
|
||||||
}
|
}
|
||||||
@@ -694,9 +700,9 @@ public class ServerControl implements ApplicationListener{
|
|||||||
if(bans.size == 0){
|
if(bans.size == 0){
|
||||||
info("No ID-banned players have been found.");
|
info("No ID-banned players have been found.");
|
||||||
}else{
|
}else{
|
||||||
info("&lyBanned players [ID]:");
|
info("Banned players [ID]:");
|
||||||
for(PlayerInfo info : bans){
|
for(PlayerInfo info : bans){
|
||||||
info(" &ly @ / Last known name: '@'", info.id, info.lastName);
|
info(" @ / Last known name: '@'", info.id, info.lastName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -705,13 +711,13 @@ public class ServerControl implements ApplicationListener{
|
|||||||
if(ipbans.size == 0){
|
if(ipbans.size == 0){
|
||||||
info("No IP-banned players have been found.");
|
info("No IP-banned players have been found.");
|
||||||
}else{
|
}else{
|
||||||
info("&lmBanned players [IP]:");
|
info("Banned players [IP]:");
|
||||||
for(String string : ipbans){
|
for(String string : ipbans){
|
||||||
PlayerInfo info = netServer.admins.findByIP(string);
|
PlayerInfo info = netServer.admins.findByIP(string);
|
||||||
if(info != null){
|
if(info != null){
|
||||||
info(" &lm '@' / Last known name: '@' / ID: '@'", string, info.lastName, info.id);
|
info(" '@' / Last known name: '@' / ID: '@'", string, info.lastName, info.id);
|
||||||
}else{
|
}else{
|
||||||
info(" &lm '@' (No known name or info)", string);
|
info(" '@' (No known name or info)", string);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -765,7 +771,7 @@ public class ServerControl implements ApplicationListener{
|
|||||||
netServer.admins.unAdminPlayer(target.id);
|
netServer.admins.unAdminPlayer(target.id);
|
||||||
}
|
}
|
||||||
if(playert != null) playert.admin = add;
|
if(playert != null) playert.admin = add;
|
||||||
info("Changed admin status of player: &ly@", target.lastName);
|
info("Changed admin status of player: @", target.lastName);
|
||||||
}else{
|
}else{
|
||||||
err("Nobody with that name or ID could be found. If adding an admin by name, make sure they're online; otherwise, use their UUID.");
|
err("Nobody with that name or ID could be found. If adding an admin by name, make sure they're online; otherwise, use their UUID.");
|
||||||
}
|
}
|
||||||
@@ -777,7 +783,7 @@ public class ServerControl implements ApplicationListener{
|
|||||||
if(admins.size == 0){
|
if(admins.size == 0){
|
||||||
info("No admins have been found.");
|
info("No admins have been found.");
|
||||||
}else{
|
}else{
|
||||||
info("&lyAdmins:");
|
info("Admins:");
|
||||||
for(PlayerInfo info : admins){
|
for(PlayerInfo info : admins){
|
||||||
info(" &lm @ / ID: '@' / IP: '@'", info.lastName, info.id, info.lastIP);
|
info(" &lm @ / ID: '@' / IP: '@'", info.lastName, info.id, info.lastIP);
|
||||||
}
|
}
|
||||||
@@ -788,10 +794,10 @@ public class ServerControl implements ApplicationListener{
|
|||||||
if(Groups.player.size() == 0){
|
if(Groups.player.size() == 0){
|
||||||
info("No players are currently in the server.");
|
info("No players are currently in the server.");
|
||||||
}else{
|
}else{
|
||||||
info("&lyPlayers: @", Groups.player.size());
|
info("Players: @", Groups.player.size());
|
||||||
for(Player user : Groups.player){
|
for(Player user : Groups.player){
|
||||||
PlayerInfo userInfo = user.getInfo();
|
PlayerInfo userInfo = user.getInfo();
|
||||||
info(" &lm @ / ID: '@' / IP: '@' / Admin: '@'", userInfo.lastName, userInfo.id, userInfo.lastIP, userInfo.admin);
|
info(" &lm @ / ID: @ / IP: @ / Admin: @", userInfo.lastName, userInfo.id, userInfo.lastIP, userInfo.admin);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -849,7 +855,7 @@ public class ServerControl implements ApplicationListener{
|
|||||||
info("Save files: ");
|
info("Save files: ");
|
||||||
for(Fi file : saveDirectory.list()){
|
for(Fi file : saveDirectory.list()){
|
||||||
if(file.extension().equals(saveExtension)){
|
if(file.extension().equals(saveExtension)){
|
||||||
info("| &ly@", file.nameWithoutExtension());
|
info("| @", file.nameWithoutExtension());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -860,7 +866,7 @@ public class ServerControl implements ApplicationListener{
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
info("&lyCore destroyed.");
|
info("Core destroyed.");
|
||||||
inExtraRound = false;
|
inExtraRound = false;
|
||||||
Events.fire(new GameOverEvent(Team.crux));
|
Events.fire(new GameOverEvent(Team.crux));
|
||||||
});
|
});
|
||||||
@@ -870,16 +876,16 @@ public class ServerControl implements ApplicationListener{
|
|||||||
ObjectSet<PlayerInfo> infos = netServer.admins.findByName(arg[0]);
|
ObjectSet<PlayerInfo> infos = netServer.admins.findByName(arg[0]);
|
||||||
|
|
||||||
if(infos.size > 0){
|
if(infos.size > 0){
|
||||||
info("&lgPlayers found: @", infos.size);
|
info("Players found: @", infos.size);
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for(PlayerInfo info : infos){
|
for(PlayerInfo info : infos){
|
||||||
info("&lc[@] Trace info for player '@' / UUID @", i++, info.lastName, info.id);
|
info("[@] Trace info for player '@' / UUID @", i++, info.lastName, info.id);
|
||||||
info(" &lyall names used: @", info.names);
|
info(" all names used: @", info.names);
|
||||||
info(" &lyIP: @", info.lastIP);
|
info(" IP: @", info.lastIP);
|
||||||
info(" &lyall IPs used: @", info.ips);
|
info(" all IPs used: @", info.ips);
|
||||||
info(" &lytimes joined: @", info.timesJoined);
|
info(" times joined: @", info.timesJoined);
|
||||||
info(" &lytimes kicked: @", info.timesKicked);
|
info(" times kicked: @", info.timesKicked);
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
info("Nobody with that name could be found.");
|
info("Nobody with that name could be found.");
|
||||||
@@ -891,11 +897,11 @@ public class ServerControl implements ApplicationListener{
|
|||||||
ObjectSet<PlayerInfo> infos = netServer.admins.searchNames(arg[0]);
|
ObjectSet<PlayerInfo> infos = netServer.admins.searchNames(arg[0]);
|
||||||
|
|
||||||
if(infos.size > 0){
|
if(infos.size > 0){
|
||||||
info("&lgPlayers found: @", infos.size);
|
info("Players found: @", infos.size);
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for(PlayerInfo info : infos){
|
for(PlayerInfo info : infos){
|
||||||
info("- &lc[@] &ly'@'&lc / &lm@", i++, info.lastName, info.id);
|
info("- [@] '@' / @", i++, info.lastName, info.id);
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
info("Nobody with that name could be found.");
|
info("Nobody with that name could be found.");
|
||||||
@@ -906,10 +912,10 @@ public class ServerControl implements ApplicationListener{
|
|||||||
int pre = (int)(Core.app.getJavaHeap() / 1024 / 1024);
|
int pre = (int)(Core.app.getJavaHeap() / 1024 / 1024);
|
||||||
System.gc();
|
System.gc();
|
||||||
int post = (int)(Core.app.getJavaHeap() / 1024 / 1024);
|
int post = (int)(Core.app.getJavaHeap() / 1024 / 1024);
|
||||||
info("&ly@&lg MB collected. Memory usage now at &ly@&lg MB.", pre - post, post);
|
info("@ MB collected. Memory usage now at @ MB.", pre - post, post);
|
||||||
});
|
});
|
||||||
|
|
||||||
handler.register("yes", "Run the above \"did you mean\" suggestion.", arg -> {
|
handler.register("yes", "Run the last suggested incorrect command.", arg -> {
|
||||||
if(yes == null){
|
if(yes == null){
|
||||||
err("There is nothing to say yes to.");
|
err("There is nothing to say yes to.");
|
||||||
}else{
|
}else{
|
||||||
@@ -1036,7 +1042,7 @@ public class ServerControl implements ApplicationListener{
|
|||||||
serverSocket.bind(new InetSocketAddress(Config.socketInputAddress.string(), Config.socketInputPort.num()));
|
serverSocket.bind(new InetSocketAddress(Config.socketInputAddress.string(), Config.socketInputPort.num()));
|
||||||
while(true){
|
while(true){
|
||||||
Socket client = serverSocket.accept();
|
Socket client = serverSocket.accept();
|
||||||
info("&lmReceived command socket connection: &lb@", serverSocket.getLocalSocketAddress());
|
info("&lkReceived command socket connection: &fi@", serverSocket.getLocalSocketAddress());
|
||||||
BufferedReader in = new BufferedReader(new InputStreamReader(client.getInputStream()));
|
BufferedReader in = new BufferedReader(new InputStreamReader(client.getInputStream()));
|
||||||
socketOutput = new PrintWriter(client.getOutputStream(), true);
|
socketOutput = new PrintWriter(client.getOutputStream(), true);
|
||||||
String line;
|
String line;
|
||||||
@@ -1044,7 +1050,7 @@ public class ServerControl implements ApplicationListener{
|
|||||||
String result = line;
|
String result = line;
|
||||||
Core.app.post(() -> handleCommandString(result));
|
Core.app.post(() -> handleCommandString(result));
|
||||||
}
|
}
|
||||||
info("&lmLost command socket connection: &lb@", serverSocket.getLocalSocketAddress());
|
info("&lkLost command socket connection: &fi@", serverSocket.getLocalSocketAddress());
|
||||||
socketOutput = null;
|
socketOutput = null;
|
||||||
}
|
}
|
||||||
}catch(BindException b){
|
}catch(BindException b){
|
||||||
|
|||||||
@@ -29,10 +29,10 @@ public class ServerLauncher implements ApplicationListener{
|
|||||||
Vars.platform = new Platform(){};
|
Vars.platform = new Platform(){};
|
||||||
Vars.net = new Net(platform.getNet());
|
Vars.net = new Net(platform.getNet());
|
||||||
|
|
||||||
Log.setLogger((level, text) -> {
|
logger = (level1, text) -> {
|
||||||
String result = "[" + dateTime.format(LocalDateTime.now()) + "] " + format(tags[level.ordinal()] + " " + text + "&fr");
|
String result = "[" + dateTime.format(LocalDateTime.now()) + "] " + format(tags[level1.ordinal()] + " " + text + "&fr");
|
||||||
System.out.println(result);
|
System.out.println(result);
|
||||||
});
|
};
|
||||||
new HeadlessApplication(new ServerLauncher(), null, throwable -> CrashSender.send(throwable, f -> {}));
|
new HeadlessApplication(new ServerLauncher(), null, throwable -> CrashSender.send(throwable, f -> {}));
|
||||||
}catch(Throwable t){
|
}catch(Throwable t){
|
||||||
CrashSender.send(t, f -> {});
|
CrashSender.send(t, f -> {});
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ public class ApplicationTests{
|
|||||||
try{
|
try{
|
||||||
boolean[] begins = {false};
|
boolean[] begins = {false};
|
||||||
Throwable[] exceptionThrown = {null};
|
Throwable[] exceptionThrown = {null};
|
||||||
Log.setUseColors(false);
|
Log.useColors = false;
|
||||||
|
|
||||||
ApplicationCore core = new ApplicationCore(){
|
ApplicationCore core = new ApplicationCore(){
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ public class PowerTestFixture{
|
|||||||
Vars.state = new GameState();
|
Vars.state = new GameState();
|
||||||
Vars.tree = new FileTree();
|
Vars.tree = new FileTree();
|
||||||
content.createBaseContent();
|
content.createBaseContent();
|
||||||
Log.setUseColors(false);
|
Log.useColors = false;
|
||||||
Time.setDeltaProvider(() -> 0.5f);
|
Time.setDeltaProvider(() -> 0.5f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -28,10 +28,10 @@ public class ImagePacker{
|
|||||||
Vars.headless = true;
|
Vars.headless = true;
|
||||||
ArcNativesLoader.load();
|
ArcNativesLoader.load();
|
||||||
|
|
||||||
Log.setLogger(new NoopLogHandler());
|
Log.logger = new NoopLogHandler();
|
||||||
Vars.content = new ContentLoader();
|
Vars.content = new ContentLoader();
|
||||||
Vars.content.createBaseContent();
|
Vars.content.createBaseContent();
|
||||||
Log.setLogger(new DefaultLogHandler());
|
Log.logger = new DefaultLogHandler();
|
||||||
|
|
||||||
Fi.get("../../../assets-raw/sprites_out").walk(path -> {
|
Fi.get("../../../assets-raw/sprites_out").walk(path -> {
|
||||||
if(!path.extEquals("png")) return;
|
if(!path.extEquals("png")) return;
|
||||||
|
|||||||
Reference in New Issue
Block a user