Skip to content

Commit

Permalink
Handle new Spigot version naming convention
Browse files Browse the repository at this point in the history
Spigot added the build number to the version number.

Fixes #1648
  • Loading branch information
tastybento committed Feb 19, 2021
1 parent 06caf1c commit c9a7804
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,11 @@ public Compatibility checkCompatibility() {
*/
@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) {
Expand Down

0 comments on commit c9a7804

Please sign in to comment.