Archiviert
13
0

Merge pull request #60 from Techcable/patch-1

Only compile version pattern once
Dieser Commit ist enthalten in:
Dan Mulloy 2015-03-16 16:03:33 -04:00
Commit cb5633aba8

Datei anzeigen

@ -42,7 +42,7 @@ public class MinecraftVersion implements Comparable<MinecraftVersion>, Serializa
/**
* Regular expression used to parse version strings.
*/
private static final String VERSION_PATTERN = ".*\\(.*MC.\\s*([a-zA-z0-9\\-\\.]+)\\s*\\)";
private static final Pattern VERSION_PATTERN = Pattern.compile(".*\\(.*MC.\\s*([a-zA-z0-9\\-\\.]+)\\s*\\)");
/**
* Version 1.8 - the "bountiful" update.
@ -293,8 +293,7 @@ public class MinecraftVersion implements Comparable<MinecraftVersion>, Serializa
* @throws IllegalStateException If we could not parse the version string.
*/
public static String extractVersion(String text) {
Pattern versionPattern = Pattern.compile(VERSION_PATTERN);
Matcher version = versionPattern.matcher(text);
Matcher version = VERSION_PATTERN.matcher(text);
if (version.matches() && version.group(1) != null) {
return version.group(1);