Archiviert
13
0

Fix handling of configuration.

Dieser Commit ist enthalten in:
Kristian S. Stangeland 2012-11-03 00:54:03 +01:00
Ursprung 7952da99c9
Commit 413eb283a4
4 geänderte Dateien mit 24 neuen und 6 gelöschten Zeilen

Datei anzeigen

@ -51,7 +51,8 @@ class ProtocolConfig {
// Automatically copy defaults // Automatically copy defaults
if (copyDefaults && (global == null || updater == null)) { if (copyDefaults && (global == null || updater == null)) {
config.options().copyDefaults(true); plugin.saveDefaultConfig();
config = plugin.getConfig();
loadSections(false); loadSections(false);
} }
} }

Datei anzeigen

@ -17,6 +17,7 @@
package com.comphenix.protocol; package com.comphenix.protocol;
import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.util.logging.Logger; import java.util.logging.Logger;
@ -80,7 +81,16 @@ public class ProtocolLibrary extends JavaPlugin {
// Load configuration // Load configuration
updater = new Updater(this, "protocollib", getFile(), "protocol.info"); updater = new Updater(this, "protocollib", getFile(), "protocol.info");
try {
config = new ProtocolConfig(this); config = new ProtocolConfig(this);
} catch (Exception e) {
reporter.reportWarning(this, "Cannot load configuration", e);
// Load it again
deleteConfig();
config = new ProtocolConfig(this);
}
try { try {
unhookTask = new DelayedSingleTask(this); unhookTask = new DelayedSingleTask(this);
@ -97,6 +107,13 @@ public class ProtocolLibrary extends JavaPlugin {
} }
} }
private void deleteConfig() {
File configFile = new File(getDataFolder(), "config.yml");
// Delete the file
configFile.delete();
}
@Override @Override
public void reloadConfig() { public void reloadConfig() {
super.reloadConfig(); super.reloadConfig();

Datei anzeigen

@ -5,6 +5,6 @@ global:
download: true download: true
# Number of seconds to wait until a new update is downloaded # Number of seconds to wait until a new update is downloaded
delay = 43200 # 12 hours delay: 43200 # 12 hours
# Last update time # Last update time
last = 0 last: 0

Datei anzeigen

@ -14,7 +14,7 @@ commands:
permission: experiencemod.admin permission: experiencemod.admin
permission-message: You don't have <permission> permission-message: You don't have <permission>
packet: packet:
description: Adds or removes a simple packet listener. description: Add or remove a simple packet listener.
usage: /<command> add|remove client|server|both [ID start] [ID stop] [detailed] usage: /<command> add|remove client|server|both [ID start] [ID stop] [detailed]
permission: experiencemod.admin permission: experiencemod.admin
permission-message: You don't have <permission> permission-message: You don't have <permission>