mirror of
https://github.com/dmulloy2/ProtocolLib.git
synced 2024-11-24 03:25:29 +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() {
|
public void updateFinished() {
|
||||||
long currentTime = System.currentTimeMillis() / ProtocolLibrary.MILLI_PER_SECOND;
|
long currentTime = System.currentTimeMillis() / ProtocolLibrary.MILLI_PER_SECOND;
|
||||||
|
|
||||||
config.setAutoLastTime(currentTime);
|
config.setAutoLastTime(currentTime);
|
||||||
config.saveAll();
|
config.saveAll();
|
||||||
}
|
}
|
||||||
|
@ -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.");
|
||||||
|
@ -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());
|
||||||
|
@ -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;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user