Fix "no class items on class selected".

The fix is simply a reload of the config-file after initially loading
the config-file. For some reason it works. No clue why >_>
This commit is contained in:
garbagemule
2013-08-15 03:44:47 +02:00
parent b6f81e0823
commit d73a0ed707
4 changed files with 124 additions and 13 deletions
@@ -85,6 +85,7 @@ public class ArenaMasterImpl implements ArenaMaster
public Arena getSelectedArena() {
if (selectedArena == null && !arenas.isEmpty()) {
System.out.println("SELECTED ARENA IS NULL! ARENAS: " + arenas.size());
selectedArena = arenas.get(0);
}
return selectedArena;
@@ -244,6 +245,8 @@ public class ArenaMasterImpl implements ArenaMaster
loadClasses();
loadArenas();
config.save();
// Apparently necessary...
reloadConfig();
}
/**
+3 -12
View File
@@ -64,8 +64,7 @@ public class MobArena extends JavaPlugin
public static Random random = new Random();
public void onEnable() {
// Create default files and initialize config-file
FileUtils.extractResource(this.getDataFolder(), "config.yml", getClass());
// Initialize config-file
loadConfigFile();
// Load boss abilities
@@ -118,16 +117,8 @@ public class MobArena extends JavaPlugin
}
private void loadConfigFile() {
File dir = this.getDataFolder();
if (!dir.exists()) dir.mkdir();
File file = new File(this.getDataFolder(), "config.yml");
config = new Config(file);
if (!config.load()) {
this.getServer().getPluginManager().disablePlugin(this);
throw new IllegalStateException("The config-file could not be loaded! Read further up to find the actual bug!");
}
saveDefaultConfig();
config = new Config(new File(getDataFolder(), "config.yml"));
updateSettings(config);
config.setHeader(getHeader());
config.save();