Fixed the config-file reset bug.

This commit is contained in:
garbagemule
2012-08-22 06:05:45 +02:00
parent 6ade558eeb
commit a94370deec
7 changed files with 10 additions and 5 deletions
@@ -6,7 +6,6 @@ import java.util.Map;
import com.garbagemule.MobArena.framework.Arena;
import com.garbagemule.MobArena.util.MutableInt;
import com.garbagemule.MobArena.util.config.ConfigSection;
import com.garbagemule.MobArena.util.config.ConfigUtils;
public class ClassLimitManager
{
+4 -1
View File
@@ -113,7 +113,10 @@ public class MobArena extends JavaPlugin
File file = new File(this.getDataFolder(), "config.yml");
config = new Config(file);
config.load();
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!");
}
updateSettings(config);
config.setHeader(getHeader());
@@ -284,6 +284,7 @@ public class MAGlobalListener implements Listener
case REJECT:
allow = false;
break;
default: break;
}
}
@@ -13,6 +13,8 @@ import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.inventory.ItemStack;
import com.garbagemule.MobArena.Messenger;
/**
* Wrapper class for Bukkit's Configuration classes.
*
@@ -80,7 +82,7 @@ public class Config
return true;
}
catch (Exception e) {
e.printStackTrace();
Messenger.severe("The config-file failed to load. This is the error:\n" + e.getMessage());
return false;
}
}