Handle new Spigot version naming convention

Spigot added the build number to the version number.

Fixes https://github.com/BentoBoxWorld/BentoBox/issues/1648
This commit is contained in:
tastybento 2021-02-19 15:03:05 -08:00
parent 06caf1c147
commit c9a7804921
1 changed files with 5 additions and 1 deletions

View File

@ -258,7 +258,11 @@ public class ServerCompatibility {
*/
@NonNull
public ServerSoftware getServerSoftware() {
String serverSoftware = Bukkit.getServer().getVersion().substring(4).split("-")[0];
String[] parts = Bukkit.getServer().getVersion().split("-");
if (parts.length < 2) {
return ServerSoftware.UNKNOWN.setName(Bukkit.getServer().getVersion().toUpperCase(Locale.ENGLISH));
}
String serverSoftware = Bukkit.getServer().getVersion().split("-")[1];
try {
return ServerSoftware.valueOf(serverSoftware.toUpperCase(Locale.ENGLISH));
} catch (IllegalArgumentException e) {