Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
WalshyDev committed Dec 17, 2023
1 parent a15faf0 commit 5af81f1
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
2 changes: 1 addition & 1 deletion docs/adr/0001-storage-layer.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ The current plan looks like this:
* We want to load player data using the new storage layer with the current
data system.
* We'll want to monitor for any possible issues and generally refine
how this system should look
how this system and should look
* Phase 2 - Implement new experimental binary backend for [`PlayerProfile`]().
* Create a new backend for binary storage
* Implement in an experimental capacity and allow users to opt-in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,20 @@
import io.github.thebusybiscuit.slimefun4.storage.data.PlayerData;

import javax.annotation.concurrent.ThreadSafe;

import com.google.common.annotations.Beta;

import java.util.UUID;

/**
* The {@link Storage} interface is the abstract layer on top of our storage backends.
* Every backend has to implement this interface and has to implement it in a thread-safe way.
* There will be no expectation of running functions in here within the main thread.
*
* <p>
* <b>This API is still experimental, it may change without notice.</b>
*/
@Beta
@ThreadSafe
public interface Storage {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,27 @@
import io.github.thebusybiscuit.slimefun4.storage.data.PlayerData;
import org.bukkit.NamespacedKey;

import com.google.common.annotations.Beta;

import javax.annotation.Nonnull;
import java.util.HashSet;
import java.util.Optional;
import java.util.Set;
import java.util.UUID;

@Beta
public class LegacyStorage implements Storage {

@Override
public PlayerData loadPlayerData(@Nonnull UUID uuid) {
Config file = new Config("data-storage/Slimefun/Players/" + uuid + ".yml");
Config playerFile = new Config("data-storage/Slimefun/Players/" + uuid + ".yml");
// Not too sure why this is it's own file
Config waypointFile = new Config("data-storage/Slimefun/waypoints/" + uuid + ".yml");

Set<NamespacedKey> researches = new HashSet<>();

for (Research research : Slimefun.getRegistry().getResearches()) {
if (file.contains("researches." + research.getID())) {
if (playerFile.contains("researches." + research.getID())) {
researches.add(research.getKey());
}
}
Expand Down

0 comments on commit 5af81f1

Please sign in to comment.