mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-01 16:19:53 +01:00
Fix the update checker
Now it's able to parse x.x.x-type-bxxx and x.x.x-bxxx
This commit is contained in:
parent
91d8cd5da8
commit
80927417f2
@ -43,12 +43,18 @@ public class UpdateChecker {
|
|||||||
jo = (JSONObject) jo.get("versions");
|
jo = (JSONObject) jo.get("versions");
|
||||||
newVersion = (String) jo.get("version");
|
newVersion = (String) jo.get("version");
|
||||||
|
|
||||||
String[] oldTokens = version.replaceAll("(?i)(-)(.+?)(-)", "").split("[.]|[b]");
|
String[] oldTokens = version.replaceAll("(?i)(-)(.+?)(-)", "-").split("[.]|-b");
|
||||||
String[] newTokens = newVersion.replaceAll("(?i)(-)(.+?)(-)", "").split("[.]|[b]");
|
String[] newTokens = newVersion.replaceAll("(?i)(-)(.+?)(-)", "-").split("[.]|-b");
|
||||||
|
|
||||||
for (int i = 0; i < 4; i++) {
|
for (int i = 0; i < 4; i++) {
|
||||||
Integer newVer = Integer.parseInt(newTokens[i]);
|
Integer newVer = Integer.parseInt(newTokens[i]);
|
||||||
Integer oldVer = Integer.parseInt(oldTokens[i]);
|
Integer oldVer;
|
||||||
|
try {
|
||||||
|
oldVer = Integer.parseInt(oldTokens[i]);
|
||||||
|
}
|
||||||
|
catch (NumberFormatException e) {
|
||||||
|
oldVer = 0;
|
||||||
|
}
|
||||||
if (oldVer < newVer) {
|
if (oldVer < newVer) {
|
||||||
isr.close();
|
isr.close();
|
||||||
return true;
|
return true;
|
||||||
|
Loading…
Reference in New Issue
Block a user