From cdb9e0d1d9dc46684dd6ecbb70b83e745d65cb09 Mon Sep 17 00:00:00 2001 From: Max Gerbeth Date: Fri, 20 Jan 2023 00:11:40 +0100 Subject: [PATCH] add Comments in ShopCommand.java --- src/main/java/org/bitbiome/commands/ShopCommand.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/bitbiome/commands/ShopCommand.java b/src/main/java/org/bitbiome/commands/ShopCommand.java index b718926..7b53bb3 100644 --- a/src/main/java/org/bitbiome/commands/ShopCommand.java +++ b/src/main/java/org/bitbiome/commands/ShopCommand.java @@ -3,7 +3,6 @@ package org.bitbiome.commands; import org.bitbiome.shop.Item; import org.bitbiome.shop.Shop; -import java.io.IOException; import java.util.ArrayList; import java.util.Scanner; @@ -19,7 +18,7 @@ public class ShopCommand implements CommandAPI{ System.out.println("Willkommen im Shop!"); ArrayList currentItems = shop.loadCurrentShopItems(); - + //whileloop for userinputs in the shop while (true){ System.out.println("Was willst Du hier im Shop?"); System.out.println("Etwas kaufen: 1"); @@ -43,8 +42,12 @@ public class ShopCommand implements CommandAPI{ if((Integer.parseInt(amount) <= currentItems.get(Integer.parseInt(itemNumber) - 1).amount) && ((Integer.parseInt(amount) - 1) > -1)){ boolean bool = shop.buy(currentItems.get(Integer.parseInt(itemNumber) - 1).name, Integer.parseInt(amount)); currentItems = shop.loadCurrentShopItems(); - System.out.println(""); - System.out.println("Vielen Dank für Ihren Einkauf!"); + if(bool){ + System.out.println(""); + System.out.println("Vielen Dank für Ihren Einkauf!"); + }else{ + System.out.println("Fehler"); + } }else{ System.out.println("Fehler"); }