Delete src/main/java/net/viper/status/stats/StatsStorage.java via Git Manager GUI
This commit is contained in:
@@ -1,37 +0,0 @@
|
|||||||
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();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user