Browse Source

Added the quit command

This command quits the game with exit code 0.
remotes/origin/locations
David Hermann 2 years ago
parent
commit
d46176e8a2
  1. 3
      src/main/java/org/bitbiome/commands/CommandListener.java
  2. 12
      src/main/java/org/bitbiome/commands/QuitCommand.java

3
src/main/java/org/bitbiome/commands/CommandListener.java

@ -11,6 +11,9 @@ public class CommandListener {
commands = new HashMap<>();
commands.put("help", new HelpCommand());
commands.put("exit", new QuitCommand());
commands.put("quit", new QuitCommand());
}
public HashMap<String, CommandAPI> returnCommands() {

12
src/main/java/org/bitbiome/commands/QuitCommand.java

@ -0,0 +1,12 @@
package org.bitbiome.commands;
import java.util.Scanner;
public class QuitCommand implements CommandAPI {
@Override
public void performCommand(Scanner scanner, boolean isRunning, String message) {
System.out.println("You quitted!");
System.exit(0);
}
}
Loading…
Cancel
Save