Skip to content

Commit

Permalink
fix: normalize version to semver
Browse files Browse the repository at this point in the history
  • Loading branch information
timbru31 authored Jun 25, 2024
1 parent a50b0e1 commit 88f6557
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,8 @@ public void onEnable() {
if (_nmsVersion.equals("craftbukkit")) {
try {
final String minecraftVersion = (String) Server.class.getDeclaredMethod("getMinecraftVersion").invoke(Bukkit.getServer());
final Semver semver = new Semver(minecraftVersion);
final String normalizedVersion = minecraftVersion.matches("^\\d+\\.\\d+$") ? minecraftVersion + ".0" : minecraftVersion;
final Semver semver = new Semver(normalizedVersion);
if (semver.isGreaterThanOrEqualTo("1.20.5")) {
@SuppressWarnings("deprecation")
final int protocolVersion = (Integer) UnsafeValues.class.getDeclaredMethod("getProtocolVersion")
Expand Down

0 comments on commit 88f6557

Please sign in to comment.