From ccf383cdb5c9ae410db2fcb86f2593e4e85d2564 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elias=20M=C3=BCller?= Date: Sun, 15 Jun 2025 18:55:17 +0200 Subject: [PATCH] fixed configuration file not saving correctly --- .../varo/appliances/metaGameplay/playTimer/PlayTimer.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/varo/src/main/java/eu/mhsl/craftattack/spawn/varo/appliances/metaGameplay/playTimer/PlayTimer.java b/varo/src/main/java/eu/mhsl/craftattack/spawn/varo/appliances/metaGameplay/playTimer/PlayTimer.java index bf0c2ea..3c8b461 100644 --- a/varo/src/main/java/eu/mhsl/craftattack/spawn/varo/appliances/metaGameplay/playTimer/PlayTimer.java +++ b/varo/src/main/java/eu/mhsl/craftattack/spawn/varo/appliances/metaGameplay/playTimer/PlayTimer.java @@ -24,7 +24,7 @@ public class PlayTimer extends Appliance { public static final int PLAYTIME_MINUTES = 30; private final Map joinTickets = new HashMap<>(); - private final Path saveFile = Paths.get(Main.instance().getDataFolder() + "playtime.json"); + private final Path saveFile = Paths.get(Main.instance().getDataFolder().getAbsolutePath() + "/playtime.json"); public PlayTimer() { this.load(); @@ -51,9 +51,7 @@ public class PlayTimer extends Appliance { try { Files.createDirectories(this.saveFile.getParent()); try (Writer writer = Files.newBufferedWriter(this.saveFile)) { - new Gson().toJson(Map.of( - "tickets", this.joinTickets - ), writer); + new Gson().toJson(Map.of("tickets", this.joinTickets), writer); } } catch (IOException e) { Main.logger().warning("Failed to save playtime for teams: " + e.getMessage()); @@ -66,6 +64,7 @@ public class PlayTimer extends Appliance { } public void setTickets(VaroTeam team, int amount) { this.joinTickets.put(team.name, amount); + this.save(); } public int getTickets(VaroTeam team) {