mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-22 21:26:46 +01:00
Fixed double Config instantiation causing NPE on PlayerProfile.save()
This commit is contained in:
parent
68b9857409
commit
06791beabd
@ -15,6 +15,7 @@ public class Config extends ConfigLoader {
|
||||
public static Config getInstance() {
|
||||
if (instance == null) {
|
||||
instance = new Config(mcMMO.p);
|
||||
instance.load();
|
||||
}
|
||||
|
||||
return instance;
|
||||
@ -440,14 +441,14 @@ public class Config extends ConfigLoader {
|
||||
|
||||
public HUDType defaulthud;
|
||||
|
||||
public Config(mcMMO plugin) {
|
||||
private Config(mcMMO plugin) {
|
||||
super(plugin, "config.yml");
|
||||
config = plugin.getConfig();
|
||||
xpGainMultiplier = getExperienceGainsGlobalMultiplier();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load() {
|
||||
protected void load() {
|
||||
if (!configFile.exists()) {
|
||||
dataFolder.mkdir();
|
||||
plugin.saveDefaultConfig();
|
||||
|
@ -22,6 +22,7 @@ public class LoadTreasures extends ConfigLoader{
|
||||
public static LoadTreasures getInstance() {
|
||||
if (instance == null) {
|
||||
instance = new LoadTreasures(mcMMO.p);
|
||||
instance.load();
|
||||
}
|
||||
|
||||
return instance;
|
||||
@ -46,7 +47,7 @@ public class LoadTreasures extends ConfigLoader{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load() {
|
||||
protected void load() {
|
||||
if (!configFile.exists()) {
|
||||
dataFolder.mkdir();
|
||||
plugin.saveTreasuresConfig();
|
||||
|
@ -60,9 +60,7 @@ public class mcMMO extends JavaPlugin {
|
||||
public File mcmmo;
|
||||
|
||||
//File Paths
|
||||
public String mainDirectory, flatFileDirectory, usersFile, leaderboardDirectory, modDirectory;
|
||||
|
||||
private static Config configInstance = null;
|
||||
public String mainDirectory, flatFileDirectory, usersFile, leaderboardDirectory, modDirectory;
|
||||
|
||||
/**
|
||||
* Things to be run when the plugin is enabled.
|
||||
@ -70,11 +68,10 @@ public class mcMMO extends JavaPlugin {
|
||||
public void onEnable() {
|
||||
p = this;
|
||||
setupFilePaths();
|
||||
|
||||
configInstance = new Config(this);
|
||||
configInstance.load();
|
||||
|
||||
LoadTreasures.getInstance().load();
|
||||
|
||||
//Force the loading of config files
|
||||
Config configInstance = Config.getInstance();
|
||||
LoadTreasures.getInstance();
|
||||
|
||||
if (configInstance.getToolModsEnabled()) {
|
||||
LoadCustomTools.getInstance().load();
|
||||
@ -244,6 +241,8 @@ public class mcMMO extends JavaPlugin {
|
||||
getCommand("unarmed").setExecutor(new UnarmedCommand());
|
||||
getCommand("woodcutting").setExecutor(new WoodcuttingCommand());
|
||||
|
||||
Config configInstance = Config.getInstance();
|
||||
|
||||
//mc* commands
|
||||
if (configInstance.getCommandMCRemoveEnabled()) {
|
||||
getCommand("mcremove").setExecutor(new McremoveCommand(this));
|
||||
|
Loading…
Reference in New Issue
Block a user