Fix handling of configuration.
Dieser Commit ist enthalten in:
Ursprung
7952da99c9
Commit
413eb283a4
@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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,8 +81,17 @@ 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");
|
||||||
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 {
|
try {
|
||||||
unhookTask = new DelayedSingleTask(this);
|
unhookTask = new DelayedSingleTask(this);
|
||||||
protocolManager = new PacketFilterManager(getClassLoader(), getServer(), unhookTask, reporter);
|
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
|
@Override
|
||||||
public void reloadConfig() {
|
public void reloadConfig() {
|
||||||
super.reloadConfig();
|
super.reloadConfig();
|
||||||
|
@ -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
|
@ -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>
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren