Mod version parse fix
This commit is contained in:
@@ -720,11 +720,7 @@ public class Mods implements Loadable{
|
|||||||
public boolean isSupported(){
|
public boolean isSupported(){
|
||||||
if(isOutdated()) return false;
|
if(isOutdated()) return false;
|
||||||
|
|
||||||
int major = getMinMajor(), minor = getMinMinor();
|
return Version.isAtLeast(meta.minGameVersion);
|
||||||
|
|
||||||
if(Version.build <= 0) return true;
|
|
||||||
|
|
||||||
return Version.build >= major && Version.revision >= minor;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @return whether this mod is outdated, e.g. not compatible with v6. */
|
/** @return whether this mod is outdated, e.g. not compatible with v6. */
|
||||||
@@ -734,33 +730,9 @@ public class Mods implements Loadable{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int getMinMajor(){
|
public int getMinMajor(){
|
||||||
int major = 0;
|
|
||||||
|
|
||||||
String ver = meta.minGameVersion == null ? "0" : meta.minGameVersion;
|
String ver = meta.minGameVersion == null ? "0" : meta.minGameVersion;
|
||||||
|
int dot = ver.indexOf(".");
|
||||||
if(ver.contains(".")){
|
return dot != -1 ? Strings.parseInt(ver.substring(0, dot), 0) : Strings.parseInt(ver, 0);
|
||||||
String[] split = ver.split("\\.");
|
|
||||||
if(split.length == 2){
|
|
||||||
major = Strings.parseInt(split[0], 0);
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
major = Strings.parseInt(ver, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
return major;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getMinMinor(){
|
|
||||||
String ver = meta.minGameVersion == null ? "0" : meta.minGameVersion;
|
|
||||||
|
|
||||||
if(ver.contains(".")){
|
|
||||||
String[] split = ver.split("\\.");
|
|
||||||
if(split.length == 2){
|
|
||||||
return Strings.parseInt(split[1], 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user