Skip to content

Commit b2a25df

Browse files
authored
Merge pull request #21 from LittleBeasts/development
Development
2 parents 0252f0b + e1bf09c commit b2a25df

3 files changed

Lines changed: 11 additions & 6 deletions

File tree

.github/workflows/maven.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
id: bump_version
2525
uses: christian-draeger/increment-semantic-version@1.0.2
2626
with:
27-
current-version: '2.0.0-alpha1'
27+
current-version: '2.0.1-alpha1'
2828
version-fragment: 'bug'
2929
- name: Upload Artifacts
3030
run: mkdir builds && cp target/*.jar builds/calculationEngine-${{ steps.bump_version.outputs.next-version }}.jar

src/main/java/config/LootConfig.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@ public class LootConfig {
99
public static final int dropCommon = 60;
1010
public static final int dropRare = 35;
1111
public static final int dropLegendary = 5;
12-
public static final JSONObject itemList = readJson(LootConfig.class.getResource("/items.JSON").getPath());
12+
public static final JSONObject itemList = readJson("/items.JSON");
1313
}

src/main/java/utilities/JsonReader.java

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,20 @@
33
import org.json.JSONObject;
44

55
import java.io.*;
6+
import java.nio.charset.StandardCharsets;
67

78
public class JsonReader {
89

910
public static JSONObject readJson(String fileName) {
11+
InputStream inputStream = JsonReader.class.getResourceAsStream(fileName);
1012
StringBuilder sJson = new StringBuilder();
11-
try (BufferedReader br = new BufferedReader(new FileReader(new File(fileName)))) {
12-
String str;
13-
while ((str = br.readLine()) != null) {
14-
sJson.append(str).append("\n");
13+
try {
14+
assert inputStream != null;
15+
try (BufferedReader br = new BufferedReader(new InputStreamReader(inputStream, StandardCharsets.UTF_8))) {
16+
String str;
17+
while ((str = br.readLine()) != null) {
18+
sJson.append(str).append("\n");
19+
}
1520
}
1621
} catch (IOException e) {
1722
e.printStackTrace();

0 commit comments

Comments
 (0)