From 986151d614b2cba894406747dda747f16c79fff6 Mon Sep 17 00:00:00 2001 From: Juliakn66 <117075450+Juliakn66@users.noreply.github.com> Date: Sat, 4 Feb 2023 10:48:52 +0100 Subject: [PATCH] implementing method collectItem() in collectCommand.java --- .../java/org/bitbiome/commands/CollectCommand.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/bitbiome/commands/CollectCommand.java b/src/main/java/org/bitbiome/commands/CollectCommand.java index 49ef575..19e76bc 100644 --- a/src/main/java/org/bitbiome/commands/CollectCommand.java +++ b/src/main/java/org/bitbiome/commands/CollectCommand.java @@ -12,12 +12,18 @@ import java.util.Scanner; public class CollectCommand implements CommandAPI { @Override public void performCommand(Scanner scanner, boolean isRunning, String message, TravelEngine travelEngine) { - + StringBuilder s = new StringBuilder(); + JsonParser jp = new JsonParser(); + JSONObject o = jp.getJSONObject("playerconfig.json"); + JSONArray inventory = o.getJSONArray("inventory"); + + ArrayList location = travelEngine.getPlayer().getLocation().getItemList(); + System.out.println("Was willst du einsammeln?"); String item = new String(); item = scanner.nextLine(); - + collectItem(location, item, jp, o, inventory,travelEngine); } public void collectItem(ArrayList location, String item, JsonParser jp, JSONObject o, JSONArray inventory, TravelEngine travelEngine) {