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:
JaTiTV 2023-05-04 16:26:04 +02:00
parent b3adbe61e8
commit 623d6f8c12
2 changed files with 7 additions and 2 deletions

View File

@ -6,7 +6,7 @@
<groupId>net.t2code</groupId>
<artifactId>T2CodeLib</artifactId>
<version>14.4</version>
<version>14.5</version>
<packaging>jar</packaging>
<name>T2CodeLib</name>

View File

@ -30,6 +30,11 @@ public class T2CupdateCheckerGit {
}
String finalRepoURL = RepoURL;
Integer finalInterval;
if (timeInterval < 1){
finalInterval = 1;
} else finalInterval = timeInterval;
Bukkit.getScheduler().runTaskTimerAsynchronously(plugin, new Runnable() {
@Override
public void run() {
@ -65,7 +70,7 @@ public class T2CupdateCheckerGit {
}, plugin.getDescription().getVersion(), spigotID, finalRepoURL, updateCheckOnJoin, seePreReleaseUpdates, timeInterval);
}
}, 0L, timeInterval * 60 * 20L);
}, 0L, finalInterval * 60 * 20L);
}
public void getVersion(Consumer<T2CupdateWebData> consumer, String pluginVersion, Integer spigotID, String URL, Boolean updateCheckOnJoin, Boolean seePreReleaseUpdates, Integer timeInterval) {