Skip to content

Commit

Permalink
Missed a version check
Browse files Browse the repository at this point in the history
  • Loading branch information
XSoussou committed Sep 19, 2023
1 parent dac2151 commit bb06232
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
14 changes: 7 additions & 7 deletions src/main/java/com/ranull/graves/Graves.java
Original file line number Diff line number Diff line change
Expand Up @@ -341,13 +341,6 @@ private void updateChecker() {
}
}

private double getVersionAsNumber(String version) throws NumberFormatException {
String integerPart = version.split("\\.")[0];
String decimalPart = version.split("-")[0].substring(integerPart.length()).replace(".", "");

return Double.parseDouble(integerPart + "." + decimalPart);
}

private void compatibilityChecker() {
compatibility = versionManager.hasBlockData() ? new CompatibilityBlockData() : new CompatibilityMaterialData();

Expand Down Expand Up @@ -634,4 +627,11 @@ public final int getSpigotID() {
public final int getMetricsID() {
return 12849;
}

public static double getVersionAsNumber(String version) throws NumberFormatException {
String integerPart = version.split("\\.")[0];
String decimalPart = version.split("-")[0].substring(integerPart.length()).replace(".", "");

return Double.parseDouble(integerPart + "." + decimalPart);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ public void onPlayerJoin(PlayerJoinEvent event) {

if (latestVersion != null) {
try {
double pluginVersion = Double.parseDouble(plugin.getVersion());
double pluginVersionLatest = Double.parseDouble(latestVersion);
double pluginVersion = Graves.getVersionAsNumber(plugin.getVersion());
double pluginVersionLatest = Graves.getVersionAsNumber(latestVersion);

if (pluginVersion < pluginVersionLatest) {
player.sendMessage(ChatColor.RED + "☠" + ChatColor.DARK_GRAY + " » " + ChatColor.RESET
Expand Down

0 comments on commit bb06232

Please sign in to comment.