From 172c8e699716856452b54e9bd424525ec6cbb715 Mon Sep 17 00:00:00 2001 From: Max Gerbeth Date: Thu, 19 Jan 2023 23:52:16 +0100 Subject: [PATCH] Shop.java add subtractGold() --- src/main/java/org/bitbiome/shop/Shop.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/bitbiome/shop/Shop.java b/src/main/java/org/bitbiome/shop/Shop.java index dc00dca..5c4216c 100644 --- a/src/main/java/org/bitbiome/shop/Shop.java +++ b/src/main/java/org/bitbiome/shop/Shop.java @@ -66,8 +66,7 @@ public class Shop { } //Player gold subtract - gold -= costs; - playerConfig.put("gold", gold); + playerConfig.put("gold", subtractGold(gold, costs)); //Gameconfig amount reduese JSONArray jsonArray2 = gameConfig.getJSONArray("shopitems"); @@ -233,4 +232,8 @@ public class Shop { } System.out.println(""); } + + private int subtractGold(int gold, int cost){ + return gold - cost; + } }