mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-22 21:26:46 +01:00
Fix for config files not being created at startup.
This commit is contained in:
parent
baf7ffd441
commit
cb5ada6ec9
@ -444,11 +444,10 @@ public class Config extends ConfigLoader {
|
|||||||
super(plugin, "config.yml");
|
super(plugin, "config.yml");
|
||||||
config = plugin.getConfig();
|
config = plugin.getConfig();
|
||||||
xpGainMultiplier = getExperienceGainsGlobalMultiplier();
|
xpGainMultiplier = getExperienceGainsGlobalMultiplier();
|
||||||
load();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void load() {
|
public void load() {
|
||||||
if (!configFile.exists()) {
|
if (!configFile.exists()) {
|
||||||
dataFolder.mkdir();
|
dataFolder.mkdir();
|
||||||
plugin.saveDefaultConfig();
|
plugin.saveDefaultConfig();
|
||||||
|
@ -43,11 +43,10 @@ public class LoadTreasures extends ConfigLoader{
|
|||||||
private LoadTreasures(mcMMO plugin) {
|
private LoadTreasures(mcMMO plugin) {
|
||||||
super(plugin, "treasures.yml");
|
super(plugin, "treasures.yml");
|
||||||
config = plugin.getTreasuresConfig();
|
config = plugin.getTreasuresConfig();
|
||||||
load();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void load() {
|
public void load() {
|
||||||
if (!configFile.exists()) {
|
if (!configFile.exists()) {
|
||||||
dataFolder.mkdir();
|
dataFolder.mkdir();
|
||||||
plugin.saveTreasuresConfig();
|
plugin.saveTreasuresConfig();
|
||||||
|
@ -41,11 +41,10 @@ public class LoadCustomTools extends ConfigLoader {
|
|||||||
private LoadCustomTools(mcMMO plugin) {
|
private LoadCustomTools(mcMMO plugin) {
|
||||||
super(plugin, "ModConfigs" + File.separator + "tools.yml");
|
super(plugin, "ModConfigs" + File.separator + "tools.yml");
|
||||||
config = plugin.getToolsConfig();
|
config = plugin.getToolsConfig();
|
||||||
load();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void load() {
|
public void load() {
|
||||||
if (!configFile.exists()) {
|
if (!configFile.exists()) {
|
||||||
dataFolder.mkdir();
|
dataFolder.mkdir();
|
||||||
plugin.saveToolsConfig();
|
plugin.saveToolsConfig();
|
||||||
|
@ -7,6 +7,7 @@ import com.gmail.nossr50.commands.mc.*;
|
|||||||
import com.gmail.nossr50.commands.party.*;
|
import com.gmail.nossr50.commands.party.*;
|
||||||
import com.gmail.nossr50.commands.general.*;
|
import com.gmail.nossr50.commands.general.*;
|
||||||
import com.gmail.nossr50.config.*;
|
import com.gmail.nossr50.config.*;
|
||||||
|
import com.gmail.nossr50.config.mods.LoadCustomTools;
|
||||||
import com.gmail.nossr50.runnables.*;
|
import com.gmail.nossr50.runnables.*;
|
||||||
import com.gmail.nossr50.util.Database;
|
import com.gmail.nossr50.util.Database;
|
||||||
import com.gmail.nossr50.util.Leaderboard;
|
import com.gmail.nossr50.util.Leaderboard;
|
||||||
@ -48,16 +49,18 @@ public class mcMMO extends JavaPlugin {
|
|||||||
public static Database database;
|
public static Database database;
|
||||||
public static mcMMO p;
|
public static mcMMO p;
|
||||||
|
|
||||||
//Jar stuff
|
/* Jar Stuff */
|
||||||
public static File mcmmo;
|
public static File mcmmo;
|
||||||
|
|
||||||
//File Paths
|
/* File Paths */
|
||||||
public static String mainDirectory;
|
public static String mainDirectory;
|
||||||
public static String flatFileDirectory;
|
public static String flatFileDirectory;
|
||||||
public static String usersFile;
|
public static String usersFile;
|
||||||
public static String leaderboardDirectory;
|
public static String leaderboardDirectory;
|
||||||
public static String modDirectory;
|
public static String modDirectory;
|
||||||
|
|
||||||
|
private static Config configInstance = Config.getInstance();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Things to be run when the plugin is enabled.
|
* Things to be run when the plugin is enabled.
|
||||||
*/
|
*/
|
||||||
@ -71,7 +74,14 @@ public class mcMMO extends JavaPlugin {
|
|||||||
modDirectory = mainDirectory + "ModConfigs" + File.separator;
|
modDirectory = mainDirectory + "ModConfigs" + File.separator;
|
||||||
usersFile = flatFileDirectory + "mcmmo.users";
|
usersFile = flatFileDirectory + "mcmmo.users";
|
||||||
|
|
||||||
if (!Config.getInstance().getUseMySQL()) {
|
configInstance.load();
|
||||||
|
LoadTreasures.getInstance().load();
|
||||||
|
|
||||||
|
if (configInstance.getToolModsEnabled()) {
|
||||||
|
LoadCustomTools.getInstance().load();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!configInstance.getUseMySQL()) {
|
||||||
Users.loadUsers();
|
Users.loadUsers();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -82,14 +92,14 @@ public class mcMMO extends JavaPlugin {
|
|||||||
pm.registerEvents(blockListener, this);
|
pm.registerEvents(blockListener, this);
|
||||||
pm.registerEvents(entityListener, this);
|
pm.registerEvents(entityListener, this);
|
||||||
|
|
||||||
if (Config.getInstance().getHardcoreEnabled()) {
|
if (configInstance.getHardcoreEnabled()) {
|
||||||
pm.registerEvents(hardcoreListener, this);
|
pm.registerEvents(hardcoreListener, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
PluginDescriptionFile pdfFile = getDescription();
|
PluginDescriptionFile pdfFile = getDescription();
|
||||||
|
|
||||||
//Setup the leaderboards
|
//Setup the leaderboards
|
||||||
if (Config.getInstance().getUseMySQL()) {
|
if (configInstance.getUseMySQL()) {
|
||||||
database = new Database(this);
|
database = new Database(this);
|
||||||
database.createStructure();
|
database.createStructure();
|
||||||
}
|
}
|
||||||
@ -108,7 +118,7 @@ public class mcMMO extends JavaPlugin {
|
|||||||
//Schedule Spout Activation 1 second after start-up
|
//Schedule Spout Activation 1 second after start-up
|
||||||
scheduler.scheduleSyncDelayedTask(this, new SpoutStart(this), 20);
|
scheduler.scheduleSyncDelayedTask(this, new SpoutStart(this), 20);
|
||||||
//Periodic save timer (Saves every 10 minutes)
|
//Periodic save timer (Saves every 10 minutes)
|
||||||
scheduler.scheduleSyncRepeatingTask(this, new SaveTimer(this), 0, Config.getInstance().getSaveInterval() * 1200);
|
scheduler.scheduleSyncRepeatingTask(this, new SaveTimer(this), 0, configInstance.getSaveInterval() * 1200);
|
||||||
//Regen & Cooldown timer (Runs every second)
|
//Regen & Cooldown timer (Runs every second)
|
||||||
scheduler.scheduleSyncRepeatingTask(this, new SkillMonitor(this), 0, 20);
|
scheduler.scheduleSyncRepeatingTask(this, new SkillMonitor(this), 0, 20);
|
||||||
//Bleed timer (Runs every two seconds)
|
//Bleed timer (Runs every two seconds)
|
||||||
@ -116,7 +126,7 @@ public class mcMMO extends JavaPlugin {
|
|||||||
|
|
||||||
registerCommands();
|
registerCommands();
|
||||||
|
|
||||||
if (Config.getInstance().getStatsTrackingEnabled()) {
|
if (configInstance.getStatsTrackingEnabled()) {
|
||||||
try {
|
try {
|
||||||
Metrics metrics = new Metrics(this);
|
Metrics metrics = new Metrics(this);
|
||||||
metrics.start();
|
metrics.start();
|
||||||
@ -220,88 +230,88 @@ public class mcMMO extends JavaPlugin {
|
|||||||
getCommand("woodcutting").setExecutor(new WoodcuttingCommand());
|
getCommand("woodcutting").setExecutor(new WoodcuttingCommand());
|
||||||
|
|
||||||
//mc* commands
|
//mc* commands
|
||||||
if (Config.getInstance().getCommandMCRemoveEnabled()) {
|
if (configInstance.getCommandMCRemoveEnabled()) {
|
||||||
getCommand("mcremove").setExecutor(new McremoveCommand(this));
|
getCommand("mcremove").setExecutor(new McremoveCommand(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Config.getInstance().getCommandMCAbilityEnabled()) {
|
if (configInstance.getCommandMCAbilityEnabled()) {
|
||||||
getCommand("mcability").setExecutor(new McabilityCommand());
|
getCommand("mcability").setExecutor(new McabilityCommand());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Config.getInstance().getCommandMCCEnabled()) {
|
if (configInstance.getCommandMCCEnabled()) {
|
||||||
getCommand("mcc").setExecutor(new MccCommand());
|
getCommand("mcc").setExecutor(new MccCommand());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Config.getInstance().getCommandMCGodEnabled()) {
|
if (configInstance.getCommandMCGodEnabled()) {
|
||||||
getCommand("mcgod").setExecutor(new McgodCommand());
|
getCommand("mcgod").setExecutor(new McgodCommand());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Config.getInstance().getCommandmcMMOEnabled()) {
|
if (configInstance.getCommandmcMMOEnabled()) {
|
||||||
getCommand("mcmmo").setExecutor(new McmmoCommand());
|
getCommand("mcmmo").setExecutor(new McmmoCommand());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Config.getInstance().getCommandMCRefreshEnabled()) {
|
if (configInstance.getCommandMCRefreshEnabled()) {
|
||||||
getCommand("mcrefresh").setExecutor(new McrefreshCommand(this));
|
getCommand("mcrefresh").setExecutor(new McrefreshCommand(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Config.getInstance().getCommandMCTopEnabled()) {
|
if (configInstance.getCommandMCTopEnabled()) {
|
||||||
getCommand("mctop").setExecutor(new MctopCommand());
|
getCommand("mctop").setExecutor(new MctopCommand());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Config.getInstance().getCommandMCStatsEnabled()) {
|
if (configInstance.getCommandMCStatsEnabled()) {
|
||||||
getCommand("mcstats").setExecutor(new McstatsCommand());
|
getCommand("mcstats").setExecutor(new McstatsCommand());
|
||||||
}
|
}
|
||||||
|
|
||||||
//Party commands
|
//Party commands
|
||||||
if (Config.getInstance().getCommandAcceptEnabled()) {
|
if (configInstance.getCommandAcceptEnabled()) {
|
||||||
getCommand("accept").setExecutor(new AcceptCommand(this));
|
getCommand("accept").setExecutor(new AcceptCommand(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Config.getInstance().getCommandAdminChatAEnabled()) {
|
if (configInstance.getCommandAdminChatAEnabled()) {
|
||||||
getCommand("a").setExecutor(new ACommand(this));
|
getCommand("a").setExecutor(new ACommand(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Config.getInstance().getCommandInviteEnabled()) {
|
if (configInstance.getCommandInviteEnabled()) {
|
||||||
getCommand("invite").setExecutor(new InviteCommand(this));
|
getCommand("invite").setExecutor(new InviteCommand(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Config.getInstance().getCommandPartyEnabled()) {
|
if (configInstance.getCommandPartyEnabled()) {
|
||||||
getCommand("party").setExecutor(new PartyCommand(this));
|
getCommand("party").setExecutor(new PartyCommand(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Config.getInstance().getCommandPartyChatPEnabled()) {
|
if (configInstance.getCommandPartyChatPEnabled()) {
|
||||||
getCommand("p").setExecutor(new PCommand(this));
|
getCommand("p").setExecutor(new PCommand(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Config.getInstance().getCommandPTPEnabled()) {
|
if (configInstance.getCommandPTPEnabled()) {
|
||||||
getCommand("ptp").setExecutor(new PtpCommand(this));
|
getCommand("ptp").setExecutor(new PtpCommand(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
//Other commands
|
//Other commands
|
||||||
if (Config.getInstance().getCommandAddXPEnabled()) {
|
if (configInstance.getCommandAddXPEnabled()) {
|
||||||
getCommand("addxp").setExecutor(new AddxpCommand(this));
|
getCommand("addxp").setExecutor(new AddxpCommand(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Config.getInstance().getCommandAddLevelsEnabled()) {
|
if (configInstance.getCommandAddLevelsEnabled()) {
|
||||||
getCommand("addlevels").setExecutor(new AddlevelsCommand(this));
|
getCommand("addlevels").setExecutor(new AddlevelsCommand(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Config.getInstance().getCommandMmoeditEnabled()) {
|
if (configInstance.getCommandMmoeditEnabled()) {
|
||||||
getCommand("mmoedit").setExecutor(new MmoeditCommand(this));
|
getCommand("mmoedit").setExecutor(new MmoeditCommand(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Config.getInstance().getCommandInspectEnabled()) {
|
if (configInstance.getCommandInspectEnabled()) {
|
||||||
getCommand("inspect").setExecutor(new InspectCommand(this));
|
getCommand("inspect").setExecutor(new InspectCommand(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Config.getInstance().getCommandXPRateEnabled()) {
|
if (configInstance.getCommandXPRateEnabled()) {
|
||||||
getCommand("xprate").setExecutor(new XprateCommand(this));
|
getCommand("xprate").setExecutor(new XprateCommand(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
getCommand("mmoupdate").setExecutor(new MmoupdateCommand(this));
|
getCommand("mmoupdate").setExecutor(new MmoupdateCommand(this));
|
||||||
|
|
||||||
//Spout commands
|
//Spout commands
|
||||||
if (Config.getInstance().getCommandXPLockEnabled()) {
|
if (configInstance.getCommandXPLockEnabled()) {
|
||||||
getCommand("xplock").setExecutor(new XplockCommand());
|
getCommand("xplock").setExecutor(new XplockCommand());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user