diff --git a/core/src/mindustry/mod/Mod.java b/core/src/mindustry/mod/Mod.java index d56ea9d526..930f967a06 100644 --- a/core/src/mindustry/mod/Mod.java +++ b/core/src/mindustry/mod/Mod.java @@ -6,6 +6,11 @@ import mindustry.*; public abstract class Mod{ + /** @return the folder where configuration files for this mod should go.*/ + public Fi getConfigFolder(){ + return Vars.mods.getConfigFolder(this); + } + /** @return the config file for this plugin, as the file 'mods/[plugin-name]/config.json'.*/ public Fi getConfig(){ return Vars.mods.getConfig(this); @@ -26,7 +31,7 @@ public abstract class Mod{ } - /** Register any commands to be used on the client side, e.g. sent from an in-game player.. */ + /** Register any commands to be used on the client side, e.g. sent from an in-game player. */ public void registerClientCommands(CommandHandler handler){ } diff --git a/core/src/mindustry/mod/Mods.java b/core/src/mindustry/mod/Mods.java index 25a6e1cc4c..9e8e6b2b2b 100644 --- a/core/src/mindustry/mod/Mods.java +++ b/core/src/mindustry/mod/Mods.java @@ -62,12 +62,18 @@ public class Mods implements Loadable{ return mainLoader; } - /** Returns a file named 'config.json' in a special folder for the specified plugin. + /** @return the folder where configuration files for this mod should go. The folder may not exist yet; call mkdirs() before writing to it. * Call this in init(). */ - public Fi getConfig(Mod mod){ + public Fi getConfigFolder(Mod mod){ ModMeta load = metas.get(mod.getClass()); if(load == null) throw new IllegalArgumentException("Mod is not loaded yet (or missing)!"); - return modDirectory.child(load.name).child("config.json"); + return modDirectory.child(load.name); + } + + /** @return a file named 'config.json' in the config folder for the specified mod. + * Call this in init(). */ + public Fi getConfig(Mod mod){ + return getConfigFolder(mod).child("config.json"); } /** Returns a list of files per mod subdirectory. */