From 06d01e97b44c433bb9c787002b7347bdb220a181 Mon Sep 17 00:00:00 2001 From: David Hermann Date: Wed, 18 Jan 2023 19:44:37 +0100 Subject: [PATCH] Added location command to get the current location of the player --- .../java/org/bitbiome/commands/CommandListener.java | 1 + .../java/org/bitbiome/commands/LocationCommand.java | 13 +++++++++++++ 2 files changed, 14 insertions(+) create mode 100644 src/main/java/org/bitbiome/commands/LocationCommand.java diff --git a/src/main/java/org/bitbiome/commands/CommandListener.java b/src/main/java/org/bitbiome/commands/CommandListener.java index d1dd278..b1a5378 100644 --- a/src/main/java/org/bitbiome/commands/CommandListener.java +++ b/src/main/java/org/bitbiome/commands/CommandListener.java @@ -16,6 +16,7 @@ public class CommandListener { commands.put("exit", new QuitCommand()); commands.put("quit", new QuitCommand()); + commands.put("location", new LocationCommand()); } public HashMap returnCommands() { diff --git a/src/main/java/org/bitbiome/commands/LocationCommand.java b/src/main/java/org/bitbiome/commands/LocationCommand.java new file mode 100644 index 0000000..5b690d0 --- /dev/null +++ b/src/main/java/org/bitbiome/commands/LocationCommand.java @@ -0,0 +1,13 @@ +package org.bitbiome.commands; + +import org.bitbiome.classes.TravelEngine; + +import java.util.Scanner; + +public class LocationCommand implements CommandAPI{ + + @Override + public void performCommand(Scanner scanner, boolean isRunning, String message, TravelEngine travelEngine) { + System.out.println("Du befindest dich gerade hier: " + travelEngine.getPlayer().getLocation().getName()); + } +}