diff --git a/platforms/spigot/src/main/java/net/codersky/mcutils/spigot/SpigotUtils.java b/platforms/spigot/src/main/java/net/codersky/mcutils/spigot/SpigotUtils.java
index 2e7daed..adb43aa 100644
--- a/platforms/spigot/src/main/java/net/codersky/mcutils/spigot/SpigotUtils.java
+++ b/platforms/spigot/src/main/java/net/codersky/mcutils/spigot/SpigotUtils.java
@@ -27,6 +27,7 @@
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
+import java.io.File;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
@@ -44,6 +45,12 @@ public SpigotUtils(@NotNull P plugin) {
this.console = new SpigotConsole(Bukkit.getConsoleSender());
}
+ @NotNull
+ @Override
+ public File getDataFolder() {
+ return getPlugin().getDataFolder();
+ }
+
@NotNull
public SpigotUtils
setPlayerProvider(@NotNull PlayerProvider playerProvider) {
this.playerProvider = Objects.requireNonNull(playerProvider, "Player provider cannot be null");
diff --git a/platforms/velocity/src/main/java/net/codersky/mcutils/velocity/VelocityUtils.java b/platforms/velocity/src/main/java/net/codersky/mcutils/velocity/VelocityUtils.java
index 5932a83..e37f2b8 100644
--- a/platforms/velocity/src/main/java/net/codersky/mcutils/velocity/VelocityUtils.java
+++ b/platforms/velocity/src/main/java/net/codersky/mcutils/velocity/VelocityUtils.java
@@ -15,6 +15,8 @@
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
+import java.io.File;
+import java.nio.file.Path;
import java.util.Objects;
import java.util.UUID;
@@ -23,11 +25,13 @@ public class VelocityUtils extends ProxyUtils
{
private final ProxyServer proxy;
private final VelocityConsole console;
private PlayerProvider playerProvider;
+ private final Path dataDirectory;
- public VelocityUtils(@NotNull P plugin, @NotNull ProxyServer proxy) {
+ public VelocityUtils(@NotNull P plugin, @NotNull ProxyServer proxy, @NotNull Path dataDirectory) {
super(plugin);
this.proxy = Objects.requireNonNull(proxy);
this.console = new VelocityConsole(proxy.getConsoleCommandSource());
+ this.dataDirectory = dataDirectory;
}
@NotNull
@@ -46,6 +50,12 @@ public PlayerProvider getPlayerProvider() {
return playerProvider;
}
+ @NotNull
+ @Override
+ public File getDataFolder() {
+ return this.dataDirectory.toFile();
+ }
+
@Nullable
public MCPlayer getPlayer(@NotNull UUID uuid) {
return playerProvider.getPlayer(uuid);
diff --git a/shared/src/main/java/net/codersky/mcutils/MCUtils.java b/shared/src/main/java/net/codersky/mcutils/MCUtils.java
index 9dd0360..039e1e3 100644
--- a/shared/src/main/java/net/codersky/mcutils/MCUtils.java
+++ b/shared/src/main/java/net/codersky/mcutils/MCUtils.java
@@ -7,6 +7,7 @@
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
+import java.io.File;
import java.util.HashSet;
import java.util.Objects;
import java.util.Set;
@@ -43,6 +44,9 @@ public final P getPlugin() {
return plugin;
}
+ @NotNull
+ public abstract File getDataFolder();
+
@Nullable
public abstract MCPlayer getPlayer(@NotNull UUID uuid);