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