Merge branch 'master' of github.com:mcMMO-Dev/mcMMO

Conflicts:
	src/main/java/com/gmail/nossr50/mcMMO.java
This commit is contained in:
nossr50 2012-05-05 10:20:26 -07:00
commit b529219a0e
4 changed files with 42 additions and 34 deletions

View File

@ -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();

View File

@ -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();

View File

@ -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();

View File

@ -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,7 +49,7 @@ 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
@ -58,6 +59,8 @@ public class mcMMO extends JavaPlugin {
public final String leaderboardDirectory = flatFileDirectory + "Leaderboards" + File.separator; public final String leaderboardDirectory = flatFileDirectory + "Leaderboards" + File.separator;
public final String modDirectory = mainDirectory + "ModConfigs" + File.separator; public final String modDirectory = mainDirectory + "ModConfigs" + File.separator;
private static Config configInstance = Config.getInstance();
/** /**
* Things to be run when the plugin is enabled. * Things to be run when the plugin is enabled.
*/ */
@ -65,7 +68,15 @@ public class mcMMO extends JavaPlugin {
p = this; p = this;
mcmmo = getFile(); mcmmo = getFile();
if (!Config.getInstance().getUseMySQL()) { if (!configInstance.getUseMySQL()) {
configInstance.load();
LoadTreasures.getInstance().load();
if (configInstance.getToolModsEnabled()) {
LoadCustomTools.getInstance().load();
}
Users.loadUsers(); Users.loadUsers();
} }
@ -76,14 +87,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();
} }
@ -102,7 +113,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)
@ -110,7 +121,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();
@ -214,88 +225,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());
} }