Added method to get the recommended plugin data folder
Some checks failed
build-docker / build (push) Has been cancelled
build / build (push) Has been cancelled

This commit is contained in:
RaphiMC 2024-09-26 19:27:36 +02:00
parent 8f780e03b3
commit e43bf553e4
No known key found for this signature in database
GPG key ID: 0F6BB0657A03AC94

View file

@ -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");
}