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

@ -86,7 +86,7 @@ class CommandProtocol extends CommandBase {
*/
public void updateFinished() {
long currentTime = System.currentTimeMillis() / ProtocolLibrary.MILLI_PER_SECOND;
config.setAutoLastTime(currentTime);
config.saveAll();
}

Datei anzeigen

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

Datei anzeigen

@ -128,6 +128,7 @@ public class ProtocolLibrary extends JavaPlugin {
@Override
public void reloadConfig() {
super.reloadConfig();
// Reload configuration
if (config != null) {
config.reloadConfig();
@ -242,8 +243,10 @@ public class ProtocolLibrary extends JavaPlugin {
long currentTime = System.currentTimeMillis() / MILLI_PER_SECOND;
try {
long updateTime = config.getAutoLastTime() + config.getAutoDelay();
// Should we update?
if (currentTime > config.getAutoLastTime() + config.getAutoDelay()) {
if (currentTime > updateTime) {
// Initiate the update as if it came from the console
if (config.isAutoDownload())
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.injector.PlayerLoggedOutException;
import com.comphenix.protocol.injector.SortedPacketListenerList;
import com.comphenix.protocol.reflect.FieldAccessException;
/**