Fix the updater

This commit is contained in:
TfT_02 2014-02-22 16:05:20 +01:00
parent 8deac175d1
commit 1d7e034d5e

View File

@ -23,6 +23,8 @@ import java.util.zip.ZipFile;
import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.plugin.Plugin; import org.bukkit.plugin.Plugin;
import com.gmail.nossr50.config.Config;
import org.json.simple.JSONArray; import org.json.simple.JSONArray;
import org.json.simple.JSONObject; import org.json.simple.JSONObject;
import org.json.simple.JSONValue; import org.json.simple.JSONValue;
@ -440,14 +442,14 @@ public class Updater {
return true; return true;
} }
// Check release vs. beta & dev // Check release vs. beta & SNAPSHOT
if (newTokens.length == 1 && oldTokens.length == 3 && oldVersion == newVersion) { if (newTokens.length == 1 && oldTokens.length == 3 && oldVersion == newVersion) {
return true; return true;
} }
// Check beta vs. dev // Check beta vs. SNAPSHOT
if (version.contains("dev") && title.contains("beta")) { if (version.contains("SNAPSHOT") && title.contains("beta")) {
if (Integer.parseInt(oldTokens[1].substring(3)) <= Integer.parseInt(newTokens[1].substring(4))) { if (Integer.parseInt(oldTokens[1].substring(8)) <= Integer.parseInt(newTokens[1].substring(4))) {
return true; return true;
} }
@ -465,7 +467,7 @@ public class Updater {
return false; return false;
} }
if (oldTokens.length == 3 && !version.contains("beta") && !version.contains("dev")) { if (oldTokens.length == 3 && !version.contains("beta") && !version.contains("SNAPSHOT")) {
plugin.getLogger().warning("Could not get information about this mcMMO version; perhaps you are running a custom one?"); plugin.getLogger().warning("Could not get information about this mcMMO version; perhaps you are running a custom one?");
result = UpdateResult.FAIL_NOVERSION; result = UpdateResult.FAIL_NOVERSION;
return false; return false;
@ -519,7 +521,11 @@ public class Updater {
this.plugin.getLogger().warning("If you have not recently modified your configuration and this is the first time you are seeing this message, the site may be experiencing temporary downtime."); this.plugin.getLogger().warning("If you have not recently modified your configuration and this is the first time you are seeing this message, the site may be experiencing temporary downtime.");
this.result = UpdateResult.FAIL_DBO; this.result = UpdateResult.FAIL_DBO;
} }
if (Config.getInstance().getVerboseLoggingEnabled()) {
e.printStackTrace(); e.printStackTrace();
}
return false; return false;
} }
} }