Archiviert
13
0

Set default update rate to 43200 seconds instead.

Dieser Commit ist enthalten in:
Kristian S. Stangeland 2012-11-06 18:07:06 +01:00
Ursprung 5e6a6f6a95
Commit 003bc927a4
4 geänderte Dateien mit 8 neuen und 11 gelöschten Zeilen

Datei anzeigen

@ -24,7 +24,7 @@ class ProtocolConfig {
private static final String UPDATER_LAST_TIME = "last"; private static final String UPDATER_LAST_TIME = "last";
// Defaults // Defaults
private static final long DEFAULT_UPDATER_DELAY = 60; private static final long DEFAULT_UPDATER_DELAY = 43200;
private Plugin plugin; private Plugin plugin;
private Configuration config; private Configuration config;
@ -47,7 +47,7 @@ class ProtocolConfig {
*/ */
public void reloadConfig() { public void reloadConfig() {
this.config = plugin.getConfig(); this.config = plugin.getConfig();
loadSections(true); loadSections(!loadingSections);
} }
/** /**
@ -55,9 +55,6 @@ class ProtocolConfig {
* @param copyDefaults - whether or not to copy configuration defaults. * @param copyDefaults - whether or not to copy configuration defaults.
*/ */
private void loadSections(boolean copyDefaults) { private void loadSections(boolean copyDefaults) {
if (loadingSections)
return;
if (config != null) { if (config != null) {
global = config.getConfigurationSection(SECTION_GLOBAL); global = config.getConfigurationSection(SECTION_GLOBAL);
} }
@ -72,10 +69,8 @@ class ProtocolConfig {
if (config != null) if (config != null)
config.options().copyDefaults(true); config.options().copyDefaults(true);
plugin.saveDefaultConfig(); plugin.saveDefaultConfig();
config = plugin.getConfig(); plugin.reloadConfig();
loadingSections = false; loadingSections = false;
loadSections(false);
// Inform the user // Inform the user
System.out.println("[ProtocolLib] Created default configuration."); System.out.println("[ProtocolLib] Created default configuration.");

Datei anzeigen

@ -128,6 +128,7 @@ public class ProtocolLibrary extends JavaPlugin {
@Override @Override
public void reloadConfig() { public void reloadConfig() {
super.reloadConfig(); super.reloadConfig();
// Reload configuration // Reload configuration
if (config != null) { if (config != null) {
config.reloadConfig(); config.reloadConfig();
@ -242,8 +243,10 @@ public class ProtocolLibrary extends JavaPlugin {
long currentTime = System.currentTimeMillis() / MILLI_PER_SECOND; long currentTime = System.currentTimeMillis() / MILLI_PER_SECOND;
try { try {
long updateTime = config.getAutoLastTime() + config.getAutoDelay();
// Should we update? // Should we update?
if (currentTime > config.getAutoLastTime() + config.getAutoDelay()) { if (currentTime > updateTime) {
// Initiate the update as if it came from the console // Initiate the update as if it came from the console
if (config.isAutoDownload()) if (config.isAutoDownload())
commandProtocol.updateVersion(getServer().getConsoleSender()); commandProtocol.updateVersion(getServer().getConsoleSender());

Datei anzeigen

@ -27,7 +27,6 @@ import org.bukkit.entity.Player;
import com.comphenix.protocol.events.PacketEvent; import com.comphenix.protocol.events.PacketEvent;
import com.comphenix.protocol.injector.PlayerLoggedOutException; import com.comphenix.protocol.injector.PlayerLoggedOutException;
import com.comphenix.protocol.injector.SortedPacketListenerList;
import com.comphenix.protocol.reflect.FieldAccessException; import com.comphenix.protocol.reflect.FieldAccessException;
/** /**