Skip to content

Commit

Permalink
fix old builds of 1.20.6 not loading properly
Browse files Browse the repository at this point in the history
  • Loading branch information
CodedRedGIT committed Jun 20, 2024
1 parent 0bfb51e commit 393000c
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 11 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ plugins {
}

group = 'dev.codedred'
version = '1.6.2'
version = '1.6.2b'

repositories {
mavenLocal()
Expand Down
2 changes: 1 addition & 1 deletion release.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

NEW_VERSION="1.6.2"
NEW_VERSION="1.6.2b"

git checkout main
git pull origin main
Expand Down
36 changes: 28 additions & 8 deletions src/main/java/me/codedred/playtimes/utils/ServerUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,36 @@ public static boolean isNewerVersion() {
* @return true if so
*/
public static boolean isRisenVersion() {
String[] versionParts = Bukkit.getServer().getVersion().split("\\.");
String version = Bukkit.getServer().getVersion();
String mcVersion = null;

int majorVersion = Integer.parseInt(
versionParts[1].replaceAll("[^0-9]", "")
);
int minorVersion = 0;
if (versionParts.length >= 3) minorVersion =
Integer.parseInt(versionParts[2].replaceAll("[^0-9]", ""));
if (version.contains("(MC:")) {
int startIndex = version.indexOf("(MC:") + 5;
int endIndex = version.indexOf(")", startIndex);
mcVersion = version.substring(startIndex, endIndex).trim();
}

if (mcVersion == null) {
Bukkit
.getLogger()
.warning("PlayTimes failed to extract Minecraft version: " + version);
return false;
}

return majorVersion >= 17 && minorVersion >= 0;
String[] versionParts = mcVersion.split("\\.");

try {
int minorVersion = versionParts.length >= 2
? Integer.parseInt(versionParts[1])
: 0;

return minorVersion >= 17;
} catch (NumberFormatException e) {
Bukkit
.getLogger()
.warning("PlayTimes failed to parse Minecraft version: " + mcVersion);
return false;
}
}

public static boolean hasPAPI() {
Expand Down
1 change: 0 additions & 1 deletion src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
name: Playtimes
version: "${version}"
main: me.codedred.playtimes.PlayTimes
api-version: 1.19
author: Cmaaxx
authors: [CodedRed]
softdepend: [PlaceholderAPI]
Expand Down

0 comments on commit 393000c

Please sign in to comment.