Launcher/LaunchServerConsole/src/main/java/ru/gravit/launchserver/console/ConsoleMain.java

33 lines
1.1 KiB
Java
Raw Normal View History

2019-03-08 15:43:26 +03:00
package ru.gravit.launchserver.console;
import ru.gravit.launcher.server.ServerWrapper;
import ru.gravit.utils.command.CommandHandler;
import ru.gravit.utils.helper.LogHelper;
import java.io.IOException;
public class ConsoleMain {
public static CommandHandler commandHandler;
2019-04-03 16:27:40 +03:00
2019-03-08 15:43:26 +03:00
public static void main(String[] args) throws IOException {
2019-04-03 16:41:56 +03:00
if (ServerWrapper.wrapper.config == null) {
2019-03-08 15:43:26 +03:00
LogHelper.warning("ServerWrapper not found");
}
2019-04-03 16:41:56 +03:00
if (!ServerWrapper.wrapper.permissions.canAdmin) {
2019-03-08 15:43:26 +03:00
LogHelper.warning("Permission canAdmin not found");
}
try {
Class.forName("jline.Terminal");
// JLine2 available
commandHandler = new RemoteJLineCommandHandler();
LogHelper.info("JLine2 terminal enabled");
} catch (ClassNotFoundException ignored) {
commandHandler = new RemoteStdCommandHandler(true);
LogHelper.warning("JLine2 isn't in classpath, using std");
}
LogHelper.info("CommandHandler started. Use 'exit' to exit this console");
commandHandler.run();
}
}