Write NMSVersion parsing special case for FakeServer.

This commit is contained in:
Ali Moghnieh 2017-07-28 20:13:13 +01:00
parent 50f2e7a95f
commit 9963476218
No known key found for this signature in database
GPG Key ID: F09D3A1BAF2E6D70
1 changed files with 7 additions and 1 deletions

View File

@ -234,7 +234,13 @@ public class ReflUtil {
public static NMSVersion fromString(String string) {
Preconditions.checkNotNull(string, "string cannot be null.");
Matcher matcher = VERSION_PATTERN.matcher(string);
Preconditions.checkArgument(matcher.matches(), string + " is not in valid version format. e.g. v1_10_R1");
if (!matcher.matches()) {
if (!Bukkit.getName().equals("Essentials Fake Server")) {
throw new IllegalArgumentException(string + " is not in valid version format. e.g. v1_10_R1");
}
matcher = VERSION_PATTERN.matcher(V1_12_R1.toString());
Preconditions.checkArgument(matcher.matches(), string + " is not in valid version format. e.g. v1_10_R1");
}
return new NMSVersion(Integer.parseInt(matcher.group(1)), Integer.parseInt(matcher.group(2)), Integer.parseInt(matcher.group(3)));
}