Expose configuration to plugins.

This commit is contained in:
Kristian S. Stangeland 2014-02-02 19:45:30 +01:00
parent b59f55e2e5
commit 12286ebaa7
2 changed files with 12 additions and 2 deletions

View File

@ -36,7 +36,7 @@ import com.google.common.io.Files;
*
* @author Kristian
*/
class ProtocolConfig {
public class ProtocolConfig {
private static final String LAST_UPDATE_FILE = "lastupdate";
private static final String SECTION_GLOBAL = "global";

View File

@ -114,6 +114,9 @@ public class ProtocolLibrary extends JavaPlugin {
// Error reporter
private static ErrorReporter reporter = new BasicErrorReporter();
// Strongly typed configuration
private static ProtocolConfig config;
// Metrics and statistisc
private Statistics statistisc;
@ -135,7 +138,6 @@ public class ProtocolLibrary extends JavaPlugin {
// Settings/options
private int configExpectedMod = -1;
private ProtocolConfig config;
// Updater
private Updater updater;
@ -617,6 +619,14 @@ public class ProtocolLibrary extends JavaPlugin {
return reporter;
}
/**
* Retrieve the current strongly typed configuration.
* @return The configuration, or NULL if ProtocolLib hasn't loaded yet.
*/
public static ProtocolConfig getConfiguration() {
return config;
}
/**
* Retrieves the packet protocol manager.
* @return Packet protocol manager, or NULL if it has been disabled.