mirror of
https://github.com/DieReicheErethons/Brewery.git
synced 2024-10-02 04:37:33 +02:00
Check if update is actually newer
This commit is contained in:
parent
82837e1977
commit
08a025fff6
@ -110,9 +110,20 @@ public class UpdateChecker implements Runnable {
|
|||||||
if (split.length < 2) {
|
if (split.length < 2) {
|
||||||
P.p.log("Malformed Remote File Name, could not check for updates");
|
P.p.log("Malformed Remote File Name, could not check for updates");
|
||||||
} else {
|
} else {
|
||||||
|
String version = split[1];
|
||||||
if (!P.p.getDescription().getVersion().equals(split[1].split(" ")[0])) {
|
if (!P.p.getDescription().getVersion().equals(split[1].split(" ")[0])) {
|
||||||
|
String[] verNew = version.split("\\.");
|
||||||
|
String[] verOld = P.p.getDescription().getVersion().split("\\.");
|
||||||
|
|
||||||
|
for (int i = 0; i < verNew.length; i++) {
|
||||||
|
if (i < verOld.length && P.p.parseInt(verOld[i]) > P.p.parseInt(verNew[i])) {
|
||||||
|
break;
|
||||||
|
} else if (i >= verOld.length || P.p.parseInt(verOld[i]) < P.p.parseInt(verNew[i])) {
|
||||||
P.p.log("Update available for Brewery-" + P.p.getDescription().getVersion() + ": " + versionName);
|
P.p.log("Update available for Brewery-" + P.p.getDescription().getVersion() + ": " + versionName);
|
||||||
update = "Update available: v" + split[1];
|
update = "Update available: v" + version;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user