Zond: коррекция цветных надписей
This commit is contained in:
@@ -34,8 +34,12 @@ public class ZondCommandHandler implements CommandHandler {
|
||||
}
|
||||
|
||||
private static String zondColored(String string) {
|
||||
return zondColored(string, Ansi.Color.CYAN);
|
||||
}
|
||||
|
||||
private static String zondColored(String string, Ansi.Color color) {
|
||||
return Ansi.ansi().bg(Ansi.Color.WHITE).fg(Ansi.Color.RED).a("[Zond]")
|
||||
.reset().fg(Ansi.Color.RED).a(' ').a(string)
|
||||
.reset().fgBright(color).a(' ').a(string)
|
||||
.reset().toString();
|
||||
}
|
||||
|
||||
@@ -43,9 +47,7 @@ public class ZondCommandHandler implements CommandHandler {
|
||||
threadTicker = new Thread(() -> {
|
||||
int sec = 0;
|
||||
while (!Thread.currentThread().isInterrupted() && flagTicker) {
|
||||
Shell.getInstance().getOutput().println(zondColored(
|
||||
Ansi.ansi().fg(Ansi.Color.CYAN).a("Tick "+(sec++)+" sec").toString()
|
||||
));
|
||||
Shell.getInstance().getOutput().println(zondColored("Tick "+(sec++)+" sec"));
|
||||
try {
|
||||
Thread.sleep(1000);
|
||||
} catch (InterruptedException e) {
|
||||
@@ -133,15 +135,15 @@ public class ZondCommandHandler implements CommandHandler {
|
||||
Runnable callback;
|
||||
if (flagTicker) {
|
||||
callback = () -> {
|
||||
Shell.getInstance().getOutput().println(zondColored("[!] Process - zobie?"));
|
||||
Shell.getInstance().getOutput().println(zondColored("[!] Process - zobie?", Ansi.Color.RED));
|
||||
};
|
||||
|
||||
buildThreadTicker();
|
||||
threadTicker.start();
|
||||
} else {
|
||||
callback = () -> {
|
||||
Shell.getInstance().getOutput().println(zondColored("[!] Process - zobie?"));
|
||||
Shell.getInstance().getOutput().println(zondColored("[!] Force shutdown process."));
|
||||
Shell.getInstance().getOutput().println(zondColored("[!] Process - zobie?", Ansi.Color.RED));
|
||||
Shell.getInstance().getOutput().println(zondColored("[!] Force shutdown process.", Ansi.Color.RED));
|
||||
flagForceRestartProcess = true;
|
||||
killProcess();
|
||||
};
|
||||
@@ -151,7 +153,7 @@ public class ZondCommandHandler implements CommandHandler {
|
||||
} catch (ExecuteException e) {
|
||||
code = e.getExitValue();
|
||||
} catch (IOException e) {
|
||||
Shell.getInstance().getOutput().println(zondColored("[!] Exception message: " + e.getMessage()));
|
||||
Shell.getInstance().getOutput().println(zondColored("[!] Exception message: " + e.getMessage(), Ansi.Color.RED));
|
||||
code = -99;
|
||||
}
|
||||
long currTime = System.currentTimeMillis()/1000;
|
||||
@@ -159,7 +161,7 @@ public class ZondCommandHandler implements CommandHandler {
|
||||
server.shutdown();
|
||||
pingMonitor.stop();
|
||||
server = null;
|
||||
Shell.getInstance().getOutput().println(zondColored("[i] Process finished. Code: " + code));
|
||||
Shell.getInstance().getOutput().println(zondColored("[i] Process finished. Code: " + code, Ansi.Color.RED));
|
||||
|
||||
if (pingMonitor.isCorrectShutdown()) {
|
||||
flagForceRestartProcess = false;
|
||||
@@ -169,16 +171,16 @@ public class ZondCommandHandler implements CommandHandler {
|
||||
break;
|
||||
} else {
|
||||
if (currTime <= deadTime && !flagManualKill) {
|
||||
Shell.getInstance().getOutput().println(zondColored("[!] Premature end process."));
|
||||
Shell.getInstance().getOutput().println(zondColored("[!] Premature end process.", Ansi.Color.RED));
|
||||
_try++;
|
||||
if (_try < 2) {
|
||||
Shell.getInstance().getOutput().println(zondColored("[!] Try start process again..."));
|
||||
Shell.getInstance().getOutput().println(zondColored("[!] Try start process again...", Ansi.Color.RED));
|
||||
}
|
||||
} else if (flagForceRestartProcess) {
|
||||
_try = 0;
|
||||
flagForceRestartProcess = false;
|
||||
} else if (code != 0 && code != -99 && !flagManualKill) {
|
||||
Shell.getInstance().getOutput().println(zondColored("[!] Try start process again..."));
|
||||
Shell.getInstance().getOutput().println(zondColored("[!] Try start process again...", Ansi.Color.RED));
|
||||
_try = 0;
|
||||
} else {
|
||||
break;
|
||||
@@ -187,7 +189,7 @@ public class ZondCommandHandler implements CommandHandler {
|
||||
} while (_try < 2);
|
||||
|
||||
if (_try == 2) {
|
||||
Shell.getInstance().getOutput().println(zondColored("[!] Discovered the problem when starting the process"));
|
||||
Shell.getInstance().getOutput().println(zondColored("[!] Discovered the problem when starting the process", Ansi.Color.RED));
|
||||
}
|
||||
};
|
||||
threadExec = new Thread(task, "Zond Exec");
|
||||
|
||||
Reference in New Issue
Block a user