Browse Source

refactoring: Shop.java

remotes/origin/develop
Max Gerbeth 2 years ago
parent
commit
87803bc281
  1. 2
      pom.xml
  2. 5
      src/main/java/org/bitbiome/classes/Shop.java

2
pom.xml

@ -28,7 +28,7 @@
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20180130</version>
<version>20220320</version>
</dependency>
</dependencies>

5
src/main/java/org/bitbiome/classes/Shop.java

@ -7,6 +7,7 @@ import org.json.JSONArray;
import org.json.JSONObject;
import java.io.File;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.ArrayList;
@ -155,7 +156,7 @@ public class Shop {
File file = new File("src/main/resources/items.json");
JSONArray itemJSON = null;
try {
String content3 = new String(Files.readAllBytes(Paths.get(file.toURI())), "UTF-8");
String content3 = new String(Files.readAllBytes(Paths.get(file.toURI())), StandardCharsets.UTF_8);
itemJSON = new JSONArray(content3);
} catch (Exception e) {
e.printStackTrace();
@ -192,7 +193,7 @@ public class Shop {
} else {
damage = tempJSON.getString("damage");
}
doesDmg = !damage.equals("0") ? false : true;
doesDmg = damage.equals("0");
arrayList.add(new Item(tempJSON.getString("name"), doesDmg, damage, tempJSON.getInt(key),
tempJSON.getInt("gold")));
}

Loading…
Cancel
Save