split server #2

This commit is contained in:
Sen 2025-05-03 22:42:03 +02:00
parent 3ab017888b
commit 8f8abfa0d3
11 changed files with 419 additions and 44 deletions

View file

@ -27,6 +27,7 @@ import game.future.ThreadFactoryBuilder;
import game.color.TextColor;
import game.command.CommandEnvironment;
import game.command.FixedExecutor;
import game.dimension.Dimension;
import game.dimension.Space;
import game.entity.Entity;
@ -307,9 +308,9 @@ public final class Server implements IThreadListener {
}
WorldServer.loadWarps(dim, this.warps);
}
if(port >= 0)
this.bind(port);
}
if(port >= 0)
this.bind(port);
Thread con = new Thread(new Runnable() {
private final BufferedReader reader = new BufferedReader(new InputStreamReader(new BufferedInputStream(System.in)));
@ -331,6 +332,12 @@ public final class Server implements IThreadListener {
Server.this.shutdown();
continue;
}
final String cmd = line;
Server.this.schedule(new Runnable() {
public void run() {
Server.this.scriptEnv.execute(cmd, new FixedExecutor(Server.this, "#con", "KONSOLE", null));
}
});
}
}
}, "Server console handler");
@ -1193,4 +1200,11 @@ public final class Server implements IThreadListener {
System.out.flush();
}
}
public void logConsole(String message) {
if(this.ipcpipe)
this.sendPipeIPC("console", message);
else
Log.CONSOLE.info(message);
}
}