mirror of
https://github.com/dmulloy2/ProtocolLib.git
synced 2024-11-27 21:26:17 +01:00
Set default update rate to 43200 seconds instead.
This commit is contained in:
parent
5e6a6f6a95
commit
003bc927a4
@ -86,7 +86,7 @@ class CommandProtocol extends CommandBase {
|
||||
*/
|
||||
public void updateFinished() {
|
||||
long currentTime = System.currentTimeMillis() / ProtocolLibrary.MILLI_PER_SECOND;
|
||||
|
||||
|
||||
config.setAutoLastTime(currentTime);
|
||||
config.saveAll();
|
||||
}
|
||||
|
@ -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.");
|
||||
|
@ -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());
|
||||
|
@ -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;
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user