Fix handling of configuration.
Dieser Commit ist enthalten in:
Ursprung
7952da99c9
Commit
413eb283a4
@ -51,7 +51,8 @@ class ProtocolConfig {
|
||||
|
||||
// Automatically copy defaults
|
||||
if (copyDefaults && (global == null || updater == null)) {
|
||||
config.options().copyDefaults(true);
|
||||
plugin.saveDefaultConfig();
|
||||
config = plugin.getConfig();
|
||||
loadSections(false);
|
||||
}
|
||||
}
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
package com.comphenix.protocol;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
@ -80,8 +81,17 @@ public class ProtocolLibrary extends JavaPlugin {
|
||||
|
||||
// Load configuration
|
||||
updater = new Updater(this, "protocollib", getFile(), "protocol.info");
|
||||
config = new ProtocolConfig(this);
|
||||
|
||||
|
||||
try {
|
||||
config = new ProtocolConfig(this);
|
||||
} catch (Exception e) {
|
||||
reporter.reportWarning(this, "Cannot load configuration", e);
|
||||
|
||||
// Load it again
|
||||
deleteConfig();
|
||||
config = new ProtocolConfig(this);
|
||||
}
|
||||
|
||||
try {
|
||||
unhookTask = new DelayedSingleTask(this);
|
||||
protocolManager = new PacketFilterManager(getClassLoader(), getServer(), unhookTask, reporter);
|
||||
@ -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
|
||||
public void reloadConfig() {
|
||||
super.reloadConfig();
|
||||
|
@ -5,6 +5,6 @@ global:
|
||||
download: true
|
||||
|
||||
# Number of seconds to wait until a new update is downloaded
|
||||
delay = 43200 # 12 hours
|
||||
delay: 43200 # 12 hours
|
||||
# Last update time
|
||||
last = 0
|
||||
last: 0
|
@ -14,7 +14,7 @@ commands:
|
||||
permission: experiencemod.admin
|
||||
permission-message: You don't have <permission>
|
||||
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]
|
||||
permission: experiencemod.admin
|
||||
permission-message: You don't have <permission>
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren