Don't notify them of a update everytime it does a update check
This commit is contained in:
parent
04c35b67f1
commit
3b57326d3b
@ -39,16 +39,19 @@ public class DisguiseListener implements Listener {
|
|||||||
try {
|
try {
|
||||||
UpdateChecker updateChecker = new UpdateChecker();
|
UpdateChecker updateChecker = new UpdateChecker();
|
||||||
updateChecker.checkUpdate("v" + currentVersion);
|
updateChecker.checkUpdate("v" + currentVersion);
|
||||||
|
String lastVersion = latestVersion;
|
||||||
latestVersion = updateChecker.getLatestVersion();
|
latestVersion = updateChecker.getLatestVersion();
|
||||||
if (latestVersion != null) {
|
if (latestVersion != null) {
|
||||||
latestVersion = "v" + latestVersion;
|
latestVersion = "v" + latestVersion;
|
||||||
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() {
|
if (lastVersion == null || !lastVersion.equals(latestVersion)) {
|
||||||
public void run() {
|
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() {
|
||||||
for (Player p : Bukkit.getOnlinePlayers())
|
public void run() {
|
||||||
if (p.hasPermission(permission))
|
for (Player p : Bukkit.getOnlinePlayers())
|
||||||
p.sendMessage(String.format(updateMessage, currentVersion, latestVersion));
|
if (p.hasPermission(permission))
|
||||||
}
|
p.sendMessage(String.format(updateMessage, currentVersion, latestVersion));
|
||||||
});
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
System.out.print(String.format("[LibsDisguises] Failed to check for update: %s", ex.getMessage()));
|
System.out.print(String.format("[LibsDisguises] Failed to check for update: %s", ex.getMessage()));
|
||||||
|
Loading…
Reference in New Issue
Block a user