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

25 lines
730 B
Java
Raw Normal View History

2019-03-08 15:43:26 +03:00
package ru.gravit.launchserver.console;
import ru.gravit.launcher.request.admin.ExecCommandRequest;
import ru.gravit.utils.command.Command;
import ru.gravit.utils.command.JLineCommandHandler;
import ru.gravit.utils.helper.LogHelper;
import java.io.IOException;
public class RemoteJLineCommandHandler extends JLineCommandHandler {
public RemoteJLineCommandHandler() throws IOException {
}
@Override
public void eval(String line, boolean bell)
{
if(line.equals("exit")) System.exit(0);
ExecCommandRequest request = new ExecCommandRequest(System.out::println, line);
try {
request.request();
} catch (Exception e) {
LogHelper.error(e);
}
}
}