diff options
author | Zach Jordan <zxjordan5@gmail.com> | 2023-05-30 20:35:30 -0400 |
---|---|---|
committer | Zach Jordan <zxjordan5@gmail.com> | 2023-05-30 20:35:30 -0400 |
commit | 667a1e7e1f6bf030ac9ad0b80c43c2b560446e6b (patch) | |
tree | 88e83a180d4908c8521fc4da658d585e6b25362d | |
parent | 010eebb242d9e229e7c3c30ea6396b650c7ace9c (diff) | |
download | NPEhero-667a1e7e1f6bf030ac9ad0b80c43c2b560446e6b.tar.gz NPEhero-667a1e7e1f6bf030ac9ad0b80c43c2b560446e6b.tar.bz2 NPEhero-667a1e7e1f6bf030ac9ad0b80c43c2b560446e6b.zip |
testing stuff
-rw-r--r-- | levels/testLevel/easy/leaderboard.json | 15 | ||||
-rw-r--r-- | src/main/Difficulty.java | 7 |
2 files changed, 20 insertions, 2 deletions
diff --git a/levels/testLevel/easy/leaderboard.json b/levels/testLevel/easy/leaderboard.json index e69de29..ad9fa86 100644 --- a/levels/testLevel/easy/leaderboard.json +++ b/levels/testLevel/easy/leaderboard.json @@ -0,0 +1,15 @@ +{ + "leaderboard": + [ + { + "name": "tbone", + "date": "today", + "score": "100" + }, + { + "name": "zbone", + "date": "today", + "score": "0" + } + ] +}
\ No newline at end of file diff --git a/src/main/Difficulty.java b/src/main/Difficulty.java index 9812c04..e1d8d7e 100644 --- a/src/main/Difficulty.java +++ b/src/main/Difficulty.java @@ -65,8 +65,10 @@ public class Difficulty JSONParser jsonParser = new JSONParser(); //parser to read the file - filepath = file.getPath(); - + filepath = file.getName(); + + System.out.println(file); + try(FileReader reader = new FileReader(file)) { Object obj = jsonParser.parse(reader); @@ -93,6 +95,7 @@ public class Difficulty public void addToLeaderboard(String name, int score) { leaderboard.add(new LeaderboardEntry(name, score, ""+LocalDate.now())); //do not delete this tho its not a placeholder + try (FileWriter fileWriter = new FileWriter(filepath)) { //write the settings JSONObject instance to the file |