diff --git a/src/main/java/org/bitbiome/Boot.java b/src/main/java/org/bitbiome/Boot.java index b264413..9706de6 100644 --- a/src/main/java/org/bitbiome/Boot.java +++ b/src/main/java/org/bitbiome/Boot.java @@ -1,7 +1,9 @@ package org.bitbiome; import org.bitbiome.classes.InteractionLoop; +import org.bitbiome.classes.TravelEngine; import org.bitbiome.commands.CommandListener; +import org.bitbiome.entities.Player; public class Boot { @@ -11,7 +13,9 @@ public class Boot { instance = this; cmdListener = new CommandListener(); InteractionLoop game = new InteractionLoop(); - game.run(); + Player player = new Player("Dave"); + TravelEngine travelEngine = new TravelEngine(player); + game.run(travelEngine); } public CommandListener getCmdListener(){ diff --git a/src/main/java/org/bitbiome/classes/InteractionLoop.java b/src/main/java/org/bitbiome/classes/InteractionLoop.java index 6566b0a..879c345 100644 --- a/src/main/java/org/bitbiome/classes/InteractionLoop.java +++ b/src/main/java/org/bitbiome/classes/InteractionLoop.java @@ -8,11 +8,12 @@ public class InteractionLoop { Scanner input = new Scanner(System.in); - public void run() { + public void run(TravelEngine travelEngine) { boolean isRunning = true; + System.out.println("Willkommen zu BitBiome " + travelEngine.getPlayer().getName() + "!\n\n"); while (isRunning) { String line = input.nextLine().toLowerCase(); - if (!Boot.instance.getCmdListener().perform(line.toLowerCase().split(" ")[0], input, isRunning, line)) { + if (!Boot.instance.getCmdListener().perform(line.toLowerCase().split(" ")[0], input, isRunning, line, travelEngine)) { System.out.println("Unknown Command"); } } diff --git a/src/main/java/org/bitbiome/commands/CommandAPI.java b/src/main/java/org/bitbiome/commands/CommandAPI.java index d3a67c6..a5c48be 100644 --- a/src/main/java/org/bitbiome/commands/CommandAPI.java +++ b/src/main/java/org/bitbiome/commands/CommandAPI.java @@ -1,8 +1,10 @@ package org.bitbiome.commands; +import org.bitbiome.classes.TravelEngine; + import java.util.Scanner; public interface CommandAPI { - public void performCommand(Scanner scanner, boolean isRunning, String message); + public void performCommand(Scanner scanner, boolean isRunning, String message, TravelEngine travelEngine); } diff --git a/src/main/java/org/bitbiome/commands/CommandListener.java b/src/main/java/org/bitbiome/commands/CommandListener.java index 2e62105..d1dd278 100644 --- a/src/main/java/org/bitbiome/commands/CommandListener.java +++ b/src/main/java/org/bitbiome/commands/CommandListener.java @@ -1,5 +1,7 @@ package org.bitbiome.commands; +import org.bitbiome.classes.TravelEngine; + import java.util.HashMap; import java.util.Scanner; @@ -21,11 +23,11 @@ public class CommandListener { } - public boolean perform(String command, Scanner scanner, boolean isRunning, String message) { + public boolean perform(String command, Scanner scanner, boolean isRunning, String message, TravelEngine travelEngine) { CommandAPI cmd; if ((cmd = commands.get(command)) != null) { - cmd.performCommand(scanner, isRunning, message); + cmd.performCommand(scanner, isRunning, message, travelEngine); return true; } return false; diff --git a/src/main/java/org/bitbiome/commands/HelpCommand.java b/src/main/java/org/bitbiome/commands/HelpCommand.java index 4d88e3a..ce85922 100644 --- a/src/main/java/org/bitbiome/commands/HelpCommand.java +++ b/src/main/java/org/bitbiome/commands/HelpCommand.java @@ -1,6 +1,7 @@ package org.bitbiome.commands; import org.bitbiome.Boot; +import org.bitbiome.classes.TravelEngine; import java.util.HashMap; import java.util.Scanner; @@ -9,7 +10,7 @@ public class HelpCommand implements CommandAPI { @Override - public void performCommand(Scanner scanner, boolean isRunning, String message) { + public void performCommand(Scanner scanner, boolean isRunning, String message, TravelEngine travelEngine) { System.out.println(getHelpMessage()); } diff --git a/src/main/java/org/bitbiome/commands/QuitCommand.java b/src/main/java/org/bitbiome/commands/QuitCommand.java index d969852..25dbb00 100644 --- a/src/main/java/org/bitbiome/commands/QuitCommand.java +++ b/src/main/java/org/bitbiome/commands/QuitCommand.java @@ -1,11 +1,13 @@ package org.bitbiome.commands; +import org.bitbiome.classes.TravelEngine; + import java.util.Scanner; public class QuitCommand implements CommandAPI { @Override - public void performCommand(Scanner scanner, boolean isRunning, String message) { + public void performCommand(Scanner scanner, boolean isRunning, String message, TravelEngine travelEngine) { System.out.println(getQuitMessage()); System.exit(0); }