Console commands are now handled on main thread

This commit is contained in:
kuroppoi 2021-04-23 18:05:39 +02:00
parent dd3a4ebcf1
commit d8099a9643

View file

@ -26,11 +26,19 @@ public class ConsoleThread extends Thread {
try {
while((line = reader.readLine()) != null) {
// TODO run these on main thread lol
CommandManager.executeCommand(server, line);
queueConsoleCommand(line);
}
} catch(IOException e) {
logger.info("Could not read console input", e);
}
}
private void queueConsoleCommand(String commandLine) {
server.queueSynchronousTask(new Runnable() {
@Override
public void run() {
CommandManager.executeCommand(server, commandLine);
}
});
}
}