From 474864316360f614700d1710adfcd9ebfc33f428 Mon Sep 17 00:00:00 2001 From: Leonardo Brandenberger Date: Thu, 2 Dec 2021 18:07:02 +0100 Subject: [PATCH] added method trade to Parser --- src/ch/zhaw/catan/Parser.java | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/src/ch/zhaw/catan/Parser.java b/src/ch/zhaw/catan/Parser.java index 5507656..eb15669 100644 --- a/src/ch/zhaw/catan/Parser.java +++ b/src/ch/zhaw/catan/Parser.java @@ -54,22 +54,15 @@ public class Parser { } public Command getAction() { - switch (textIO.newEnumInputReader(Command.class).read("What would you like to do?")) { - case NEXTPLAYER: - return NEXTPLAYER; - case BUILDSETTLEMENT: - return BUILDSETTLEMENT; - case BUILDCITY: - return BUILDCITY; - case BUILDROAD: - return BUILDROAD; - case TRADEWITHBANK: - return TRADEWITHBANK; - case QUIT: - return QUIT; - default: - return null; + return textIO.newEnumInputReader(Command.class).read("What would you like to do?"); + } + + public Config.Resource trade(boolean give) { + String output = "give"; + if (!give){ + output = "receive"; } + return textIO.newEnumInputReader(Config.Resource.class).read("Which Resource would you like to " + give ); } }