[Bungee] Fixed a small performance bug: If the update check interval was set to 0, it could crash the server and cause spam in the console both to the update check server of T2Code.
This commit is contained in:
parent
66dc27483b
commit
709bd16317
@ -49,6 +49,10 @@ public class T2CBupdateAPI {
|
||||
private static String pluginVersion;
|
||||
|
||||
public static void onUpdateCheckTimer(Plugin plugin, String prefix, String discord, Integer spigotID, String url) {
|
||||
Integer finalInterval;
|
||||
if (T2CBlibConfig.getUpdateTimer() < 1){
|
||||
finalInterval = 1;
|
||||
} else finalInterval = T2CBlibConfig.getUpdateTimer();
|
||||
ProxyServer.getInstance().getScheduler().schedule(plugin, new Runnable() {
|
||||
public void run() {
|
||||
if (T2CBlibConfig.getUpdateCheckFullDisable()) return;
|
||||
@ -74,6 +78,6 @@ public class T2CBupdateAPI {
|
||||
}
|
||||
}, pluginVersion, spigotID, url);
|
||||
}
|
||||
}, 0, T2CBlibConfig.getUpdateTimer() * 60 * 20L, TimeUnit.SECONDS);
|
||||
}, 0, finalInterval * 60 * 20L, TimeUnit.SECONDS);
|
||||
}
|
||||
}
|
||||
|
@ -3,7 +3,6 @@ package net.t2code.t2codelib.BUNGEE.api.update;
|
||||
import net.md_5.bungee.api.ProxyServer;
|
||||
import net.md_5.bungee.api.plugin.Plugin;
|
||||
import net.t2code.t2codelib.BUNGEE.system.config.T2CBlibConfig;
|
||||
import net.t2code.t2codelib.SPIGOT.system.config.config.SelectLibConfig;
|
||||
import net.t2code.t2codelib.T2CupdateObject;
|
||||
import net.t2code.t2codelib.T2CupdateWebData;
|
||||
import org.json.JSONArray;
|
||||
|
Loading…
Reference in New Issue
Block a user