From 7f20018078b47e6a78f2013ffed9297ff708a41e Mon Sep 17 00:00:00 2001 From: Max Gerbeth Date: Sun, 15 Jan 2023 17:59:10 +0100 Subject: [PATCH] Test if the player has enough gold --- src/main/java/org/bitbiome/shop/Shop.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/main/java/org/bitbiome/shop/Shop.java b/src/main/java/org/bitbiome/shop/Shop.java index 8753169..eb30b21 100644 --- a/src/main/java/org/bitbiome/shop/Shop.java +++ b/src/main/java/org/bitbiome/shop/Shop.java @@ -53,6 +53,13 @@ public class Shop { return false; } + //Test if the player has enough gold + int costs = currentShopItems.get(itemIndex).gold * amount; + int gold = (int) playerConfig.get("gold"); + if(!(gold >= costs)){ + System.out.println("Du hast zu wenig Gold!"); + return false; + } }catch (Exception e){ e.printStackTrace();