@@ -30,7 +30,7 @@ public class VersionService {
3030
3131 public VersionService (GMusicMain gMusicMain ) {
3232 this .gMusicMain = gMusicMain ;
33- serverVersion = getMinecraftVersion ();
33+ serverVersion = extractServerVersion ();
3434 serverVersionParts = Arrays .stream (serverVersion .split ("\\ ." )).mapToInt (Integer ::parseInt ).toArray ();
3535 String packageVersion = "v" + serverVersion .replace ("." , "_" );
3636 packagePath = gMusicMain .getClass ().getPackage ().getName () + ".mcv." + VERSION_MAPPING .getOrDefault (packageVersion , packageVersion );
@@ -40,17 +40,15 @@ public VersionService(GMusicMain gMusicMain) {
4040 available = hasPackageClass ("model.gui.MusicInputGUI" );
4141 }
4242
43- private String getMinecraftVersion () {
43+ private String extractServerVersion () {
4444 String rawServerVersion = Bukkit .getServer ().getVersion ();
4545 int mcIndexStart = rawServerVersion .indexOf ("MC:" );
4646 if (mcIndexStart != -1 ) {
47- mcIndexStart += 3 ;
47+ mcIndexStart += 4 ;
4848 int mcIndexEnd = rawServerVersion .indexOf (')' , mcIndexStart );
4949 if (mcIndexEnd != -1 ) rawServerVersion = rawServerVersion .substring (mcIndexStart , mcIndexEnd );
50- int mcDashIndex = rawServerVersion .indexOf ('-' , mcIndexStart );
51- if (mcDashIndex != -1 ) rawServerVersion = rawServerVersion .substring (mcIndexStart , mcDashIndex );
5250 }
53- return rawServerVersion .trim ();
51+ return rawServerVersion .split ( " " )[ 0 ]. trim ();
5452 }
5553
5654 public String getServerVersion () { return serverVersion ; }
0 commit comments