diff --git a/src/main/java/org/bitbiome/commands/CommandListener.java b/src/main/java/org/bitbiome/commands/CommandListener.java index 9ed47ee..f10bdfe 100644 --- a/src/main/java/org/bitbiome/commands/CommandListener.java +++ b/src/main/java/org/bitbiome/commands/CommandListener.java @@ -10,13 +10,7 @@ public class CommandListener { public CommandListener() { commands = new HashMap<>(); - /* - * Commandfield - * - * commands.put("CommandName", new CommandClass()); - * - * - */ + commands.put("help", new HelpCommand()); } public HashMap returnCommands() { diff --git a/src/main/java/org/bitbiome/commands/HelpCommand.java b/src/main/java/org/bitbiome/commands/HelpCommand.java new file mode 100644 index 0000000..45e8137 --- /dev/null +++ b/src/main/java/org/bitbiome/commands/HelpCommand.java @@ -0,0 +1,22 @@ +package org.bitbiome.commands; + +import org.bitbiome.Boot; + +import java.util.HashMap; +import java.util.Scanner; + +public class HelpCommand implements CommandAPI { + + + @Override + public void performCommand(Scanner scanner, boolean isRunning, String message) { + HashMap commands = Boot.instance.getCmdListener().returnCommands(); + 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()); + } + +}