Skip to content

Commit bf36838

Browse files
committed
Update LegacyStorage.java
1 parent 814ef8f commit bf36838

File tree

1 file changed

+1
-29
lines changed

1 file changed

+1
-29
lines changed

src/main/java/io/github/thebusybiscuit/slimefun4/storage/backend/legacy/LegacyStorage.java

+1-29
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
public class LegacyStorage implements Storage {
2424
@Override
2525
public PlayerData loadPlayerData(UUID uuid) {
26-
long start = System.nanoTime();
2726
Config playerFile = new Config("data-storage/Slimefun/Players/" + uuid + ".yml");
2827
// Not too sure why this is its own file
2928
Config waypointsFile = new Config("data-storage/Slimefun/waypoints/" + uuid + ".yml");
@@ -38,26 +37,6 @@ public PlayerData loadPlayerData(UUID uuid) {
3837

3938
// Load backpacks
4039
HashMap<Integer, PlayerBackpack> backpacks = new HashMap<>();
41-
/*
42-
for (String key : playerFile.getKeys("backpacks")) {
43-
try {
44-
int id = Integer.parseInt(key);
45-
int size = playerFile.getInt("backpacks." + key + ".size");
46-
47-
HashMap<Integer, ItemStack> items = new HashMap<>();
48-
for (int i = 0; i < size; i++) {
49-
items.put(i, playerFile.getItem("backpacks." + key + ".contents." + i));
50-
}
51-
} catch (Exception x) {
52-
Slimefun.logger()
53-
.log(
54-
Level.WARNING,
55-
x,
56-
() -> "Could not load Backpack \"" + key + "\" for Player \"" + uuid + '"');
57-
}
58-
59-
}
60-
*/
6140

6241
// Load waypoints
6342
Set<Waypoint> waypoints = new HashSet<>();
@@ -78,16 +57,12 @@ public PlayerData loadPlayerData(UUID uuid) {
7857
}
7958
}
8059

81-
long end = System.nanoTime();
82-
Slimefun.getAnalyticsService().recordPlayerProfileDataTime("legacy", true, end - start);
83-
8460
return new PlayerData(researches, backpacks, waypoints);
8561
}
8662

8763
// The current design of saving all at once isn't great, this will be refined.
8864
@Override
8965
public void savePlayerData(UUID uuid, PlayerData data) {
90-
long start = System.nanoTime();
9166
Config playerFile = new Config("data-storage/Slimefun/Players/" + uuid + ".yml");
9267
// Not too sure why this is its own file
9368
Config waypointsFile = new Config("data-storage/Slimefun/waypoints/" + uuid + ".yml");
@@ -108,7 +83,7 @@ public void savePlayerData(UUID uuid, PlayerData data) {
10883
// Sooooo we're gonna hack this for now while we move away from the Legacy Storage
10984
// Let's make sure the user doesn't have _any_ research with this ID and _then_ remove it
11085
} else if (playerFile.contains("researches." + research.getID())
111-
&& !data.getResearches().stream().anyMatch((r) -> r.getID() == research.getID())) {
86+
&& data.getResearches().stream().noneMatch((r) -> r.getID() == research.getID())) {
11287
playerFile.setValue("researches." + research.getID(), null);
11388
}
11489
}
@@ -140,8 +115,5 @@ public void savePlayerData(UUID uuid, PlayerData data) {
140115
// Save files
141116
playerFile.save();
142117
waypointsFile.save();
143-
144-
long end = System.nanoTime();
145-
Slimefun.getAnalyticsService().recordPlayerProfileDataTime("legacy", false, end - start);
146118
}
147119
}

0 commit comments

Comments
 (0)