From 7660ac57bcb5a110f12cab3c449e0f979d104d97 Mon Sep 17 00:00:00 2001 From: ChomeNS <95471003+ChomeNS@users.noreply.github.com> Date: Sat, 10 May 2025 13:21:53 +0700 Subject: [PATCH] feat: make console prompt `[server:1234] > ` so we can finally see the console server !!! --- build-number.txt | 2 +- .../chomens_bot/plugins/ConsolePlugin.java | 13 ++++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/build-number.txt b/build-number.txt index f879c0ad..7d54aa6f 100644 --- a/build-number.txt +++ b/build-number.txt @@ -1 +1 @@ -3176 \ No newline at end of file +3178 \ No newline at end of file diff --git a/src/main/java/me/chayapak1/chomens_bot/plugins/ConsolePlugin.java b/src/main/java/me/chayapak1/chomens_bot/plugins/ConsolePlugin.java index 782a7fd8..a801ab80 100644 --- a/src/main/java/me/chayapak1/chomens_bot/plugins/ConsolePlugin.java +++ b/src/main/java/me/chayapak1/chomens_bot/plugins/ConsolePlugin.java @@ -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 candidates) { if (!line.line().startsWith(prefix)) return;