Fixed various NPE errors when loading up mcMMO

This commit is contained in:
nossr50 2012-05-06 14:51:25 -07:00
parent 063d982750
commit 37d146e8fa
3 changed files with 18 additions and 11 deletions

View File

@ -440,7 +440,7 @@ public class Config extends ConfigLoader {
public HUDType defaulthud;
private Config(mcMMO plugin) {
public Config(mcMMO plugin) {
super(plugin, "config.yml");
config = plugin.getConfig();
xpGainMultiplier = getExperienceGainsGlobalMultiplier();

View File

@ -316,8 +316,7 @@ public class PlayerListener implements Listener {
event.setFormat(bracketColor + "(" + ChatColor.WHITE + "%1$s" + bracketColor + ") %2$s");
event.getRecipients().retainAll(intendedRecipients);
}
else if (PP.getAdminChatMode()) {
} else if (PP.getAdminChatMode()) {
McMMOAdminChatEvent chatEvent = new McMMOAdminChatEvent(player.getName(), event.getMessage());
plugin.getServer().getPluginManager().callEvent(chatEvent);

View File

@ -51,24 +51,23 @@ public class mcMMO extends JavaPlugin {
public static mcMMO p;
/* Jar Stuff */
public final File mcmmo = getFile();
public File mcmmo;
//File Paths
public final String mainDirectory = getDataFolder().getPath() + File.separator;
public final String flatFileDirectory = mainDirectory + "FlatFileStuff" + File.separator;
public final String usersFile = flatFileDirectory + "mcmmo.users";
public final String leaderboardDirectory = flatFileDirectory + "Leaderboards" + File.separator;
public final String modDirectory = mainDirectory + "ModConfigs" + File.separator;
public String mainDirectory, flatFileDirectory, usersFile, leaderboardDirectory, modDirectory;
private static Config configInstance = Config.getInstance();
private static Config configInstance = null;
/**
* Things to be run when the plugin is enabled.
*/
public void onEnable() {
p = this;
setupFilePaths();
configInstance = new Config(this);
configInstance.load();
LoadTreasures.getInstance().load();
if (configInstance.getToolModsEnabled()) {
@ -131,6 +130,15 @@ public class mcMMO extends JavaPlugin {
}
}
public void setupFilePaths() {
mcmmo = getFile();
mainDirectory = getDataFolder().getPath() + File.separator;
flatFileDirectory = mainDirectory + "FlatFileStuff" + File.separator;
usersFile = flatFileDirectory + "mcmmo.users";
leaderboardDirectory = flatFileDirectory + "Leaderboards" + File.separator;
modDirectory = mainDirectory + "ModConfigs" + File.separator;
}
/**
* Get profile of the player.
* </br>