Experimental multi-config implementation
TODO: Fix a couple of bugs...
This commit is contained in:
parent
f4a0e9d7ce
commit
b1fba623d2
|
@ -86,7 +86,7 @@ public final class Seppuku {
|
|||
public void init() {
|
||||
this.eventManager = new AnnotatedEventManager();
|
||||
this.apiManager = new APIManager();
|
||||
this.configManager = new ConfigManager();
|
||||
this.configManager = new ConfigManager("Default");
|
||||
this.ignoredManager = new IgnoredManager();
|
||||
this.friendManager = new FriendManager();
|
||||
this.rotationManager = new RotationManager();
|
||||
|
@ -199,7 +199,7 @@ public final class Seppuku {
|
|||
this.capeManager = new CapeManager();
|
||||
|
||||
this.configManager.getConfigurableList().clear();
|
||||
this.configManager = new ConfigManager();
|
||||
this.configManager = new ConfigManager(this.configManager.activeConfig);
|
||||
this.configManager.init();
|
||||
|
||||
this.getEventManager().dispatchEvent(new EventReload());
|
||||
|
@ -262,7 +262,7 @@ public final class Seppuku {
|
|||
|
||||
public ConfigManager getConfigManager() {
|
||||
if (this.configManager == null) {
|
||||
this.configManager = new ConfigManager();
|
||||
this.configManager = new ConfigManager("Default");
|
||||
}
|
||||
return this.configManager;
|
||||
}
|
||||
|
|
|
@ -75,6 +75,7 @@ public final class CommandManager {
|
|||
this.commandList.add(new PlayCommand());
|
||||
this.commandList.add(new LocateFeatureCommand());
|
||||
this.commandList.add(new MainMenuCommand());
|
||||
this.commandList.add(new ConfigCommand());
|
||||
|
||||
//create commands for every value within every module
|
||||
loadValueCommands();
|
||||
|
|
|
@ -15,7 +15,8 @@ import java.util.List;
|
|||
*/
|
||||
public final class ConfigManager {
|
||||
|
||||
public static final String CONFIG_PATH = "Seppuku/Config/";
|
||||
public static final String CONFIG_PATH = "Seppuku/Config/%s/";
|
||||
public String activeConfig;
|
||||
private File configDir;
|
||||
private File moduleConfigDir;
|
||||
private File hudComponentConfigDir;
|
||||
|
@ -23,23 +24,31 @@ public final class ConfigManager {
|
|||
private boolean customMainMenuHidden = false;
|
||||
private List<Configurable> configurableList = new ArrayList<>();
|
||||
|
||||
public ConfigManager() {
|
||||
public ConfigManager(final String config) {
|
||||
this.activeConfig = config;
|
||||
this.generateDirectories();
|
||||
}
|
||||
|
||||
public void switchToConfig(final String config) {
|
||||
this.saveAll();
|
||||
|
||||
this.activeConfig = config;
|
||||
Seppuku.INSTANCE.reload();
|
||||
}
|
||||
|
||||
private void generateDirectories() {
|
||||
this.configDir = new File(CONFIG_PATH);
|
||||
this.configDir = new File(String.format(CONFIG_PATH, activeConfig));
|
||||
if (!this.configDir.exists()) {
|
||||
this.setFirstLaunch(true);
|
||||
this.configDir.mkdirs();
|
||||
}
|
||||
|
||||
this.moduleConfigDir = new File(CONFIG_PATH + "Modules" + "/");
|
||||
this.moduleConfigDir = new File(String.format(CONFIG_PATH, activeConfig) + "Modules" + "/");
|
||||
if (!this.moduleConfigDir.exists()) {
|
||||
this.moduleConfigDir.mkdirs();
|
||||
}
|
||||
|
||||
this.hudComponentConfigDir = new File(CONFIG_PATH + "HudComponents" + "/");
|
||||
this.hudComponentConfigDir = new File(String.format(CONFIG_PATH, activeConfig) + "HudComponents" + "/");
|
||||
if (!this.hudComponentConfigDir.exists()) {
|
||||
this.hudComponentConfigDir.mkdirs();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue