Start using the new config

This commit is contained in:
fernferret 2011-10-10 20:40:31 -04:00
parent cfdd1ac38c
commit 4366b16a74
2 changed files with 20 additions and 2 deletions

View File

@ -28,7 +28,9 @@ import org.bukkit.Location;
import org.bukkit.World.Environment;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.configuration.InvalidConfigurationException;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.Player;
import org.bukkit.event.Event;
import org.bukkit.event.Event.Priority;
@ -51,6 +53,7 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin, Core {
public static boolean EnforceAccess;
public static boolean EnforceGameModes;
@Override
public String dumpVersionInfo(String buffer) {
// I'm kinda cheating on this one, since we call the init event.
@ -87,6 +90,7 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin, Core {
// Configurations
private Configuration configMV = null;
private FileConfiguration multiverseConfig = null;
private WorldManager worldManager = new WorldManager(this);
@ -125,6 +129,10 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin, Core {
return this.configMV;
}
public FileConfiguration getMVConfiguration() {
return this.multiverseConfig;
}
public GenericBank getBank() {
return this.bank;
}
@ -164,7 +172,7 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin, Core {
// this function will be called every time a plugin registers a new envtype with MV
// Setup & Load our Configuration files.
loadConfigs();
if (this.configMV != null) {
if (this.multiverseConfig != null) {
this.worldManager.loadWorlds(true);
} else {
this.log(Level.SEVERE, "Your configs were not loaded. Very little will function in Multiverse.");
@ -256,7 +264,7 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin, Core {
new DefaultConfig(getDataFolder(), "config.yml", this.migrator);
new DefaultConfig(getDataFolder(), "worlds.yml", this.migrator);
// Now grab the Configuration Files.
this.configMV = new Configuration(new File(getDataFolder(), "config.yml"));
this.multiverseConfig = YamlConfiguration.loadConfiguration(new File(getDataFolder(), "config.yml"));
this.worldManager.loadWorldConfig(new File(getDataFolder(), "worlds.yml"));

View File

@ -11,6 +11,7 @@ import com.fernferret.allpay.GenericBank;
import com.onarandombox.MultiverseCore.destination.DestinationFactory;
import com.onarandombox.MultiverseCore.utils.*;
import com.pneumaticraft.commandhandler.CommandHandler;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.entity.Player;
import org.bukkit.util.config.Configuration;
@ -22,11 +23,20 @@ import org.bukkit.util.config.Configuration;
public interface Core {
/**
* Gets the Multiverse config file.
* Now Deprecated, use {@link #getMVConfiguration()}
*
* @return The Multiverse config file.
*/
@Deprecated
public Configuration getMVConfig();
/**
* Gets the Multiverse config file.
*
* @return The Multiverse config file.
*/
public FileConfiguration getMVConfiguration();
/**
* Gets the Banking system that Multiverse-Core has hooked into.
*