Browse Source

refactoring: Shop.java and Item.java

remotes/origin/shop
Max Gerbeth 2 years ago
parent
commit
6a5a6454f5
  1. 37
      src/main/java/org/bitbiome/shop/Item.java
  2. 2
      src/main/java/org/bitbiome/shop/Shop.java

37
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;
}
}

2
src/main/java/org/bitbiome/shop/Shop.java

@ -39,7 +39,7 @@ public class Shop {
private void printArrayList(ArrayList<Item> 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("");
}

Loading…
Cancel
Save