From 6a5a6454f55e6ef99044487ecbfe3eec2e12892d Mon Sep 17 00:00:00 2001 From: Max Gerbeth Date: Mon, 9 Jan 2023 17:32:54 +0100 Subject: [PATCH] refactoring: Shop.java and Item.java --- src/main/java/org/bitbiome/shop/Item.java | 37 +++++++++-------------- src/main/java/org/bitbiome/shop/Shop.java | 2 +- 2 files changed, 15 insertions(+), 24 deletions(-) diff --git a/src/main/java/org/bitbiome/shop/Item.java b/src/main/java/org/bitbiome/shop/Item.java index 96aa197..c6f9672 100644 --- a/src/main/java/org/bitbiome/shop/Item.java +++ b/src/main/java/org/bitbiome/shop/Item.java @@ -2,15 +2,14 @@ package org.bitbiome.shop; public class Item { public String name; - public String damage; - public boolean crafting; - public int durability; + public int amount; + public int gold; - public Item(String name, String damage, boolean crafting, int durability){ + + public Item(String name, int amount, int gold){ this.name = name; - this.damage = damage; - this.crafting = crafting; - this.durability = durability; + this.amount = amount; + this.gold = gold; } public String getName() { @@ -21,27 +20,19 @@ public class Item { this.name = name; } - public String getDamage() { - return damage; - } - - public void setDamage(String damage) { - this.damage = damage; - } - - public boolean isCrafting() { - return crafting; + public int getAmount() { + return amount; } - public void setCrafting(boolean crafting) { - this.crafting = crafting; + public void setAmount(int amount) { + this.amount = amount; } - public int getDurability() { - return durability; + public int getGold() { + return gold; } - public void setDurability(int durability) { - this.durability = durability; + public void setGold(int gold) { + this.gold = gold; } } \ No newline at end of file diff --git a/src/main/java/org/bitbiome/shop/Shop.java b/src/main/java/org/bitbiome/shop/Shop.java index aa4cf9a..f797073 100644 --- a/src/main/java/org/bitbiome/shop/Shop.java +++ b/src/main/java/org/bitbiome/shop/Shop.java @@ -39,7 +39,7 @@ public class Shop { private void printArrayList(ArrayList arrayList){ System.out.println(""); for(int i = 0; i < arrayList.size(); i++){ - System.out.println(arrayList.get(i).getName() + " | " + arrayList.get(i).getDamage() + " | " + arrayList.get(i).isCrafting() + " | " + arrayList.get(i).getDurability()); + System.out.println(arrayList.get(i).getName() + " | " + arrayList.get(i).getAmount() + " | " + arrayList.get(i).getGold()); } System.out.println(""); }