Archiviert
13
0

Added the ability to enable or disable the background compiler.

Dieser Commit ist enthalten in:
Kristian S. Stangeland 2012-11-19 23:44:13 +01:00
Ursprung cdc5740f85
Commit d5aa1cde51
3 geänderte Dateien mit 26 neuen und 2 gelöschten Zeilen

Datei anzeigen

@ -18,6 +18,8 @@ class ProtocolConfig {
private static final String METRICS_ENABLED = "metrics";
private static final String BACKGROUND_COMPILER_ENABLED = "background compiler";
private static final String UPDATER_NOTIFY = "notify";
private static final String UPDATER_DOWNLAD = "download";
private static final String UPDATER_DELAY = "delay";
@ -166,6 +168,25 @@ class ProtocolConfig {
global.set(METRICS_ENABLED, enabled);
}
/**
* Retrieve whether or not the background compiler for structure modifiers is enabled or not.
* @return TRUE if it is enabled, FALSE otherwise.
*/
public boolean isBackgroundCompilerEnabled() {
return global.getBoolean(BACKGROUND_COMPILER_ENABLED, true);
}
/**
* Set whether or not the background compiler for structure modifiers is enabled or not.
* <p>
* This setting will take effect next time ProtocolLib is started.
*
* @param enabled - TRUE if is enabled/running, FALSE otherwise.
*/
public void setBackgroundCompilerEnabled(boolean enabled) {
global.set(BACKGROUND_COMPILER_ENABLED, enabled);
}
/**
* Set the last time we updated, in seconds since 1970.01.01 00:00.
* @param lastTimeSeconds - new last update time.

Datei anzeigen

@ -166,7 +166,7 @@ public class ProtocolLibrary extends JavaPlugin {
return;
// Initialize background compiler
if (backgroundCompiler == null) {
if (backgroundCompiler == null && config.isBackgroundCompilerEnabled()) {
backgroundCompiler = new BackgroundCompiler(getClassLoader());
BackgroundCompiler.setInstance(backgroundCompiler);
}

Datei anzeigen

@ -10,3 +10,6 @@ global:
last: 0
metrics: true
# Automatically compile structure modifiers
background compiler: true