From e43bf553e4980e901a6ff4aaa7384eb16c915c6b Mon Sep 17 00:00:00 2001 From: RaphiMC <50594595+RaphiMC@users.noreply.github.com> Date: Thu, 26 Sep 2024 19:27:36 +0200 Subject: [PATCH] Added method to get the recommended plugin data folder --- .../net/raphimc/viaproxy/plugins/ViaProxyPlugin.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/main/java/net/raphimc/viaproxy/plugins/ViaProxyPlugin.java b/src/main/java/net/raphimc/viaproxy/plugins/ViaProxyPlugin.java index e658490..4c6e363 100644 --- a/src/main/java/net/raphimc/viaproxy/plugins/ViaProxyPlugin.java +++ b/src/main/java/net/raphimc/viaproxy/plugins/ViaProxyPlugin.java @@ -17,6 +17,7 @@ */ package net.raphimc.viaproxy.plugins; +import java.io.File; import java.net.URLClassLoader; import java.util.Collections; import java.util.List; @@ -51,6 +52,14 @@ public abstract class ViaProxyPlugin { public void onDisable() { } + public final File getDataFolder() { + final File dataFolder = new File(PluginManager.PLUGINS_DIR, (String) this.viaProxyYaml.get("name")); + if (!dataFolder.exists()) { + dataFolder.mkdirs(); + } + return dataFolder; + } + public final String getName() { return (String) this.viaProxyYaml.get("name"); }