Features
- bStats Metrics - Update checking with GitHub - Dynamic config.yml
This commit is contained in:
parent
d71087c3d8
commit
5efa4cd5be
9 changed files with 410 additions and 53 deletions
|
|
@ -0,0 +1,21 @@
|
|||
package net.frankheijden.serverutils.utils;
|
||||
|
||||
public class VersionUtils {
|
||||
|
||||
public static boolean isNewVersion(String oldVersion, String newVersion) {
|
||||
String[] oldVersionSplit = oldVersion.split("\\.");
|
||||
String[] newVersionSplit = newVersion.split("\\.");
|
||||
|
||||
int i = 0;
|
||||
while (i < oldVersionSplit.length && i < newVersionSplit.length) {
|
||||
int o = Integer.parseInt(oldVersionSplit[i]);
|
||||
int n = Integer.parseInt(newVersionSplit[i]);
|
||||
if (i != oldVersionSplit.length - 1 && i != newVersionSplit.length - 1) {
|
||||
if (n < o) return false;
|
||||
}
|
||||
if (n > o) return true;
|
||||
i++;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue