Skip to content

Commit

Permalink
Merge pull request #2 from CraptiCraft-Development/feature/1.21-support
Browse files Browse the repository at this point in the history
1.21 Support
  • Loading branch information
Loving11ish authored Jul 8, 2024
2 parents 35f180f + e30b811 commit c053a96
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>me.loving11ish</groupId>
<artifactId>EpicHomes</artifactId>
<version>1.0.8</version>
<version>1.0.9</version>
<packaging>jar</packaging>

<name>EpicHomes</name>
Expand Down
12 changes: 9 additions & 3 deletions src/main/java/me/loving11ish/epichomes/EpicHomes.java
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@ public void onLoad() {
versionCheckerUtils.setVersion();

// Server version compatibility check
if (versionCheckerUtils.getVersion() != 20 || !versionCheckerUtils.isVersionCheckedSuccessfully()) {
if (versionCheckerUtils.getVersion() < 16 || versionCheckerUtils.getVersion() > 21
|| !versionCheckerUtils.isVersionCheckedSuccessfully()) {
MessageUtils.sendConsole("&4-------------------------------------------");
MessageUtils.sendConsole("&4Your server version is: &d" + Bukkit.getVersion());
MessageUtils.sendConsole("&4This plugin is only supported on the Minecraft versions listed below:");
Expand All @@ -98,6 +99,7 @@ public void onLoad() {
MessageUtils.sendConsole("&41.18.x");
MessageUtils.sendConsole("&41.19.x");
MessageUtils.sendConsole("&41.20.x");
MessageUtils.sendConsole("&41.21.x");
MessageUtils.sendConsole("&4Is now disabling!");
MessageUtils.sendConsole("&4-------------------------------------------");
Bukkit.getPluginManager().disablePlugin(this);
Expand Down Expand Up @@ -343,8 +345,12 @@ public static PlayerMenuUtility getPlayerMenuUtility(Player player) {
private void setVersion() {
String packageName = Bukkit.getServer().getClass().getPackage().getName();
String bukkitVersion = Bukkit.getServer().getBukkitVersion();
if (bukkitVersion.contains("1.20.5") || bukkitVersion.contains("1.20.6")) {
serverVersion = ServerVersion.v1_20_R4;
if (bukkitVersion.contains("1.20.5")) {
serverVersion = ServerVersion.v1_20_R5;
} else if (bukkitVersion.contains("1.20.6")) {
serverVersion = ServerVersion.v1_20_R5;
} else if (bukkitVersion.contains("1.21")) {
serverVersion = ServerVersion.v1_21_R1;
} else {
serverVersion = ServerVersion.valueOf(packageName.replace("org.bukkit.craftbukkit.", ""));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ public enum ServerVersion {
v1_20_R1,
v1_20_R2,
v1_20_R3,
v1_20_R4;
v1_20_R4,
v1_20_R5,
v1_21_R1;

public boolean serverVersionEqual(ServerVersion version) {
return this.equals(version);
Expand Down

0 comments on commit c053a96

Please sign in to comment.