From 5a35f0ee84cf9dc1e089c7d67faf2062971cfc4e Mon Sep 17 00:00:00 2001 From: David Hermann Date: Thu, 5 Jan 2023 21:03:37 +0100 Subject: [PATCH] refactor: Edited help command Prepared for unit test, output message is now hardcoded --- .../java/org/bitbiome/commands/HelpCommand.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/main/java/org/bitbiome/commands/HelpCommand.java b/src/main/java/org/bitbiome/commands/HelpCommand.java index 45e8137..4d88e3a 100644 --- a/src/main/java/org/bitbiome/commands/HelpCommand.java +++ b/src/main/java/org/bitbiome/commands/HelpCommand.java @@ -10,13 +10,14 @@ public class HelpCommand implements CommandAPI { @Override public void performCommand(Scanner scanner, boolean isRunning, String message) { - HashMap commands = Boot.instance.getCmdListener().returnCommands(); + System.out.println(getHelpMessage()); + } + + public static String getHelpMessage() { StringBuilder outputMessage = new StringBuilder(); - outputMessage.append("Hier ist eine Liste der Commands:\n"); - commands.forEach((key, value) -> { - outputMessage.append("- ").append(key).append("\n"); - }); - System.out.println(outputMessage.toString()); + outputMessage.append("Hier ist eine Liste der Commands:\n").append("- help -> Gibt diese Nachricht aus\n").append("- exit/quit -> Beendet das Spiel\n"); + + return outputMessage.toString(); } }