Accept unsuffixed release versions in getIrisVersion

getIrisVersion returned -1 for releases like 4.3.4 and threw NumberFormatException on non-numeric versions. It now parses the release number and returns -1 when the version is malformed or overflows.

Upstream: 4b44bcb12
This commit is contained in:
piexel committed 2026-11-10 01:22:13 +01:00
1 parent de31f75797
commit a578e90ecf
2 files changed
+57 -6

No files matched your search

@@ -1227,14 +1227,17 @@ public class Iris extends VolmitPlugin implements Listener, ReloadAware {
}
public int getIrisVersion() {
String input = Iris.instance.getDescription().getVersion();
String input = getDescription().getVersion();
int hyphenIndex = input.indexOf('-');
if (hyphenIndex != -1) {
String result = input.substring(0, hyphenIndex);
result = result.replaceAll("\\.", "");
return Integer.parseInt(result);
String release = hyphenIndex < 0 ? input : input.substring(0, hyphenIndex);
if (!release.matches("[0-9]+(?:\\.[0-9]+)*")) {
return -1;
}
try {
return Integer.parseInt(release.replace(".", ""));
} catch (NumberFormatException invalid) {
return -1;
}
return -1;
}
public int getMCVersion() {