File tree Expand file tree Collapse file tree 1 file changed +15
-3
lines changed
spigot/common/src/main/java/io/github/projectunified/blockutil/spigot/common Expand file tree Collapse file tree 1 file changed +15
-3
lines changed Original file line number Diff line number Diff line change 99public class Version {
1010 private static final int MAJOR_VERSION ;
1111 private static final int MINOR_VERSION ;
12+ private static final int PATCH_VERSION ;
1213
1314 static {
14- Matcher versionMatcher = Pattern .compile ("MC: \\ d\\ .(\\ d+)(\\ .(\\ d+))?" ).matcher (Bukkit .getVersion ());
15+ Matcher versionMatcher = Pattern .compile ("MC: ( \\ d+) \\ .(\\ d+)(\\ .(\\ d+))?" ).matcher (Bukkit .getVersion ());
1516 if (versionMatcher .find ()) {
16- MAJOR_VERSION = Integer .parseInt (versionMatcher .group (1 ));
17- MINOR_VERSION = Optional .ofNullable (versionMatcher .group (3 )).filter (s -> !s .isEmpty ()).map (Integer ::parseInt ).orElse (0 );
17+ int majorVersion = Integer .parseInt (versionMatcher .group (1 ));
18+ int minorVersion = Integer .parseInt (versionMatcher .group (2 ));
19+ int patchVersion = Optional .ofNullable (versionMatcher .group (4 )).filter (s -> !s .isEmpty ()).map (Integer ::parseInt ).orElse (0 );
20+ if (majorVersion == 1 ) {
21+ MAJOR_VERSION = minorVersion ;
22+ MINOR_VERSION = patchVersion ;
23+ PATCH_VERSION = 0 ;
24+ } else {
25+ MAJOR_VERSION = majorVersion ;
26+ MINOR_VERSION = minorVersion ;
27+ PATCH_VERSION = patchVersion ;
28+ }
1829 } else {
1930 MAJOR_VERSION = -1 ;
2031 MINOR_VERSION = -1 ;
32+ PATCH_VERSION = -1 ;
2133 }
2234 }
2335
You can’t perform that action at this time.
0 commit comments