From 873480557f912e681e12007d005ce16708b8a81e Mon Sep 17 00:00:00 2001 From: M_Viper Date: Wed, 1 Apr 2026 10:14:30 +0000 Subject: [PATCH] Upload via Git Manager GUI - StatsStorage.java --- .../net/viper/status/stats/StatsStorage.java | 72 +++++++++---------- 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/src/main/java/net/viper/status/stats/StatsStorage.java b/src/main/java/net/viper/status/stats/StatsStorage.java index e08ea2a..86e649d 100644 --- a/src/main/java/net/viper/status/stats/StatsStorage.java +++ b/src/main/java/net/viper/status/stats/StatsStorage.java @@ -1,37 +1,37 @@ -package net.viper.status.stats; - -import java.io.*; - -public class StatsStorage { - private final File file; - - public StatsStorage(File pluginFolder) { - if (!pluginFolder.exists()) pluginFolder.mkdirs(); - this.file = new File(pluginFolder, "stats.dat"); - } - - public void save(StatsManager manager) { - try (BufferedWriter bw = new BufferedWriter(new FileWriter(file))) { - for (PlayerStats ps : manager.all()) { - bw.write(ps.toLine()); - bw.newLine(); - } - bw.flush(); - } catch (IOException e) { - e.printStackTrace(); - } - } - - public void load(StatsManager manager) { - if (!file.exists()) return; - try (BufferedReader br = new BufferedReader(new FileReader(file))) { - String line; - while ((line = br.readLine()) != null) { - PlayerStats ps = PlayerStats.fromLine(line); - if (ps != null) manager.put(ps); - } - } catch (IOException e) { - e.printStackTrace(); - } - } +package net.viper.status.stats; + +import java.io.*; + +public class StatsStorage { + private final File file; + + public StatsStorage(File pluginFolder) { + if (!pluginFolder.exists()) pluginFolder.mkdirs(); + this.file = new File(pluginFolder, "stats.dat"); + } + + public void save(StatsManager manager) { + try (BufferedWriter bw = new BufferedWriter(new FileWriter(file))) { + for (PlayerStats ps : manager.all()) { + bw.write(ps.toLine()); + bw.newLine(); + } + bw.flush(); + } catch (IOException e) { + e.printStackTrace(); + } + } + + public void load(StatsManager manager) { + if (!file.exists()) return; + try (BufferedReader br = new BufferedReader(new FileReader(file))) { + String line; + while ((line = br.readLine()) != null) { + PlayerStats ps = PlayerStats.fromLine(line); + if (ps != null) manager.put(ps); + } + } catch (IOException e) { + e.printStackTrace(); + } + } } \ No newline at end of file