mirror of
https://github.com/BlueMap-Minecraft/BlueMap.git
synced 2025-01-08 09:17:43 +01:00
Fix version detection from spigot
This commit is contained in:
parent
6032043126
commit
62174c60c5
@ -80,6 +80,11 @@ public BukkitPlugin() {
|
|||||||
Matcher versionMatcher = Pattern.compile("(\\d+(?:\\.\\d+){1,2})[-_].*").matcher(versionString);
|
Matcher versionMatcher = Pattern.compile("(\\d+(?:\\.\\d+){1,2})[-_].*").matcher(versionString);
|
||||||
if (!versionMatcher.matches()) throw new IllegalArgumentException();
|
if (!versionMatcher.matches()) throw new IllegalArgumentException();
|
||||||
version = versionMatcher.group(1);
|
version = versionMatcher.group(1);
|
||||||
|
|
||||||
|
// minecraft omits .0 in its versions (e.g. 1.21 instead of 1.21.0) so we should remove it as well
|
||||||
|
if (version.endsWith(".0"))
|
||||||
|
version = version.substring(0, version.length() - 2);
|
||||||
|
|
||||||
} catch (IllegalArgumentException e) {
|
} catch (IllegalArgumentException e) {
|
||||||
Logger.global.logWarning("Failed to detect the minecraft version of this server! Using latest version.");
|
Logger.global.logWarning("Failed to detect the minecraft version of this server! Using latest version.");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user