Only poll for updates every 30 mins.

- Don't do GET requests on player join (bad idea, it was sync...)
 - If there's an update it will notify the player still, it just caches the update status
This commit is contained in:
dordsor21
2020-04-22 12:09:00 +01:00
parent 92a18d810c
commit 73dae7842d
2 changed files with 16 additions and 35 deletions

View File

@ -43,7 +43,9 @@ public class UpdateUtility implements Listener {
public static String internalVersion;
public static String spigotVersion;
public static boolean hasUpdate;
public final JavaPlugin javaPlugin;
private boolean notify = true;
public UpdateUtility(final JavaPlugin javaPlugin) {
this.javaPlugin = javaPlugin;
@ -73,10 +75,12 @@ public class UpdateUtility implements Listener {
+ ", &6latest version is " + spigotVersion);
PlotSquared
.log(Captions.PREFIX + "&6https://www.spigotmc.org/resources/77506/updates");
} else {
hasUpdate = true;
} else if (notify) {
notify = false;
PlotSquared.log(Captions.PREFIX
+ "Congratulations! You are running the latest PlotSquared version.");
}
}, 0L, 12000L);
}, 0L, 36000L);
}
}