feat: make console prompt [server:1234] > so we can finally see the console server !!!

This commit is contained in:
ChomeNS
2025-05-10 13:21:53 +07:00
parent 56c7aa5493
commit 7660ac57bc
2 changed files with 11 additions and 4 deletions

View File

@@ -44,14 +44,12 @@ public class ConsolePlugin implements Completer {
reader.option(LineReader.Option.DISABLE_EVENT_EXPANSION, true);
final String prompt = "> ";
final Thread thread = new Thread(
() -> {
while (true) {
String line = null;
try {
line = reader.readLine(prompt);
line = reader.readLine(getPrompt());
} catch (final Exception e) {
System.exit(1);
}
@@ -65,6 +63,15 @@ public class ConsolePlugin implements Completer {
thread.start();
}
private String getPrompt () {
// [all] > input
// [localhost:25565] > input
return String.format(
"[%s] > ",
consoleServer
);
}
@Override
public void complete (final LineReader reader, final ParsedLine line, final List<Candidate> candidates) {
if (!line.line().startsWith(prefix)) return;