JavaPlugin now loads the configuration file on load. getConfiguration() now is much cheaper to call.

By: sk89q <the.sk89q@gmail.com>
This commit is contained in:
Bukkit/Spigot 2011-01-15 01:45:36 -08:00
parent ab5b99600c
commit df7a15f4f9

View file

@ -19,6 +19,7 @@ public abstract class JavaPlugin implements Plugin {
private final PluginDescriptionFile description; private final PluginDescriptionFile description;
private final File dataFolder; private final File dataFolder;
private final ClassLoader classLoader; private final ClassLoader classLoader;
private final Configuration config;
/** /**
* Constructs a new Java plugin instance * Constructs a new Java plugin instance
@ -39,6 +40,8 @@ public abstract class JavaPlugin implements Plugin {
description = desc; description = desc;
dataFolder = folder; dataFolder = folder;
classLoader = cLoader; classLoader = cLoader;
config = new Configuration(new File(dataFolder, "config.yml"));
config.load();
} }
/** /**
@ -105,9 +108,6 @@ public abstract class JavaPlugin implements Plugin {
* @return * @return
*/ */
public Configuration getConfiguration() { public Configuration getConfiguration() {
Configuration config =
new Configuration(new File(dataFolder, "config.yml"));
config.load();
return config; return config;
} }