forked from xjboss/KCauldronX
some tweaks for updater
This commit is contained in:
parent
3defbbe725
commit
0edf4ecfae
@ -52,6 +52,8 @@ public class DefaultUpdateCallback implements IVersionCheckCallback {
|
|||||||
mCurrentVersion = currentVersion;
|
mCurrentVersion = currentVersion;
|
||||||
mNewVersion = newVersion;
|
mNewVersion = newVersion;
|
||||||
if (!mHasUpdate) {
|
if (!mHasUpdate) {
|
||||||
|
Bukkit.getConsoleSender().sendMessage(
|
||||||
|
"New version of KCauldron avaiable: " + newVersion);
|
||||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||||
if (hasPermission(player)) {
|
if (hasPermission(player)) {
|
||||||
sendUpdate(player);
|
sendUpdate(player);
|
||||||
|
@ -31,12 +31,19 @@ public class KCauldronUpdater implements Runnable {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void upToDate(String version) {
|
public void upToDate(String version) {
|
||||||
|
KCauldron.sUpdateInProgress = false;
|
||||||
CommandSender sender = getSender();
|
CommandSender sender = getSender();
|
||||||
if (sender != null) {
|
if (sender != null) {
|
||||||
sender.sendMessage(ChatColor.DARK_PURPLE + "Current version ("
|
sender.sendMessage(ChatColor.DARK_PURPLE + "Current version ("
|
||||||
+ version + ") is up to date");
|
+ version + ") is up to date");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void error(Throwable t) {
|
||||||
|
super.error(t);
|
||||||
|
KCauldron.sUpdateInProgress = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void initUpdate(CommandSender sender, String version) {
|
public static void initUpdate(CommandSender sender, String version) {
|
||||||
|
@ -81,8 +81,10 @@ public class KVersionRetriever implements Runnable, UncaughtExceptionHandler {
|
|||||||
JSONObject json = (JSONObject) sParser.parse(new InputStreamReader(
|
JSONObject json = (JSONObject) sParser.parse(new InputStreamReader(
|
||||||
response.getEntity().getContent()));
|
response.getEntity().getContent()));
|
||||||
String version = (String) json.get("version");
|
String version = (String) json.get("version");
|
||||||
|
if (DEBUG) {
|
||||||
sLogger.info("Got the latest version: %s", version);
|
sLogger.info("Got the latest version: %s", version);
|
||||||
sLogger.info("Current version is %s", sCurrentVersion);
|
sLogger.info("Current version is %s", sCurrentVersion);
|
||||||
|
}
|
||||||
if (!sCurrentVersion.equals(version)) {
|
if (!sCurrentVersion.equals(version)) {
|
||||||
mCallback.newVersion(sCurrentVersion, version);
|
mCallback.newVersion(sCurrentVersion, version);
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user