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:
@@ -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();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user