Skip to content

Commit

Permalink
Additional changes to support 1.21
Browse files Browse the repository at this point in the history
  • Loading branch information
dniym committed Jul 8, 2024
1 parent a3b1767 commit 8761b9e
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 17 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ tasks.compileJava.configure {
options.release.set(8)
}

version = "2.9.11-SNAPSHOT-01"
version = "2.9.12-SNAPSHOT-01"

tasks.named<Copy>("processResources") {
filesMatching("plugin.yml") {
Expand Down
52 changes: 36 additions & 16 deletions src/main/java/main/java/me/dniym/enums/Protections.java
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
package main.java.me.dniym.enums;


import java.lang.reflect.Field;
import java.nio.charset.Charset;
import java.nio.charset.IllegalCharsetNameException;
import java.nio.charset.UnsupportedCharsetException;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.logging.Level;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.bukkit.ChatColor;
Expand Down Expand Up @@ -700,7 +697,7 @@ public enum Protections {
8,
true,
"Destroy Rail / Carpet Dupers",
"1.12/1.13/1.14/1.15/1.16/1.17/1.18/1.19/1.20",
"1.12/1.13/1.14/1.15/1.16/1.17/1.18/1.19/1.20/1.21",
"Exploits.Other.PreventRailDupe",
"Prevent redstone machines designed to dupe carpets and rails, these items are usually duped to provide infinite fuel for furnaces or to sell for in game money in shops.",
"",
Expand Down Expand Up @@ -972,7 +969,7 @@ public enum Protections {
19,
true,
"Prevent Villager Trade Cheesing",
"1.14 / 1.15 / 1.16 / 1.17 / 1.18 / 1.19 / 1.20",
"1.14 / 1.15 / 1.16 / 1.17 / 1.18 / 1.19 / 1.20 / 1.21",
"Exploits.1_14_Exploits.Traders.BlockVillagerTradeCheesing",
"Prevents players from placing / breaking a villagers work station over and over which forces them to get new trades, typically people abuse this to make sure they get specific enchantments or items from a villager rather than it being a random mechanic.",
"",
Expand Down Expand Up @@ -1014,7 +1011,7 @@ public enum Protections {
46,
true,
"Prevent Tripwire Dupe",
"1.15 / 1.16 / 1.17 / 1.18 / 1.19 / 1.20",
"1.15 / 1.16 / 1.17 / 1.18 / 1.19 / 1.20 / 1.21",
"Exploits.1_15_Exploits.Dupes.PreventTripwireDupe",
"Prevents players from using trapdoors to dupe tripwire hooks.",
"",
Expand Down Expand Up @@ -1743,30 +1740,34 @@ public boolean isRelevantToVersion(String serverVersion) {
return false; //must be a child node
}

if (this.getVersion().contains("< 1.21")) {
return !serverVersion.contains("1.21");
}

if (this.getVersion().contains("< 1.20")) {
return !serverVersion.contains("1.20");
}

if (this.getVersion().contains("< 1.19")) {
return !serverVersion.contains("1.19") && !serverVersion.contains("1.20");
return !serverVersion.contains("1.19") && !serverVersion.contains("1.20") && !serverVersion.contains("1.21");
}

if (this.getVersion().contains("< 1.18")) {
return !serverVersion.contains("1.18") && !serverVersion.contains("1.18")
&& !serverVersion.contains("1.19") && !serverVersion.contains("1.20");
&& !serverVersion.contains("1.19") && !serverVersion.contains("1.20") && !serverVersion.contains("1.21");
}

if (this.getVersion().contains("< 1.17")) {
return !serverVersion.contains("1.17") && !serverVersion.contains("1.16") && !serverVersion.contains("1.17") && !serverVersion.contains("1.18")
&& !serverVersion.contains("1.19") && !serverVersion.contains("1.20");
&& !serverVersion.contains("1.19") && !serverVersion.contains("1.20") && !serverVersion.contains("1.21");
}
if (this.getVersion().contains("< 1.16")) {
return !serverVersion.contains("1.16") && !serverVersion.contains("1.17") && !serverVersion.contains("1.18")
&& !serverVersion.contains("1.19") && !serverVersion.contains("1.20");
&& !serverVersion.contains("1.19") && !serverVersion.contains("1.20") && !serverVersion.contains("1.21");
}
if (this.getVersion().contains("< 1.15")) {
return !serverVersion.contains("1.15") && !serverVersion.contains("1.16") && !serverVersion.contains("1.17") && !serverVersion.contains("1.18")
&& !serverVersion.contains("1.19") && !serverVersion.contains("1.20");
&& !serverVersion.contains("1.19") && !serverVersion.contains("1.20") && !serverVersion.contains("1.21");
}

if (this.getVersion().equalsIgnoreCase("1.14.4") && !serverVersion.contains("1.14.R4")) {
Expand All @@ -1781,6 +1782,10 @@ public boolean isRelevantToVersion(String serverVersion) {
return true;
}

if (this.getVersion().equalsIgnoreCase("1.21") && serverVersion.contains("1.21")) {
return true;
}

if (this.getVersion().equalsIgnoreCase("1.20") && serverVersion.contains("1.20")) {
return true;
}
Expand Down Expand Up @@ -1837,15 +1842,20 @@ public boolean isRelevantToVersion(String serverVersion) {
return true;
}

if (this.getVersion().contains("1.21") && serverVersion.contains("1.21")) {
return true;
}


if (this.getVersion().contains("> 1.12")) {
if (serverVersion.contains("1.20") || serverVersion.contains("1.19") || serverVersion.contains("1.18") || serverVersion.contains("1.17") || serverVersion.contains("1.16") || serverVersion.contains("1.15") || serverVersion
.contains("1.14") || serverVersion.contains("1.13") || serverVersion.contains("1.12")) {
if (serverVersion.contains("1.21") || serverVersion.contains("1.20") || serverVersion.contains("1.19") || serverVersion.contains("1.18") || serverVersion.contains("1.17") || serverVersion.contains("1.16")
|| serverVersion.contains("1.15") || serverVersion.contains("1.14") || serverVersion.contains("1.13") || serverVersion.contains("1.12")) {
return true;
}
}

if (this.getVersion().contains("> 1.9")) {
if (serverVersion.contains("1.20") || serverVersion.contains("1.19") || serverVersion.contains("1.18") || serverVersion.contains("1.17") || serverVersion.contains("1.16") || serverVersion.contains("1.15") || serverVersion
if (serverVersion.contains("1.21") || serverVersion.contains("1.20") || serverVersion.contains("1.19") || serverVersion.contains("1.18") || serverVersion.contains("1.17") || serverVersion.contains("1.16") || serverVersion.contains("1.15") || serverVersion
.contains("1.14") || serverVersion.contains("1.13") || serverVersion.contains("1.12") || serverVersion.contains(
"1.11") ||
this.serverVersion.contains("1.10") || this.serverVersion.contains("1.9")) {
Expand All @@ -1854,7 +1864,7 @@ public boolean isRelevantToVersion(String serverVersion) {
}

if (this.getVersion().contains("> 1.11")) {
if (serverVersion.contains("1.20") || serverVersion.contains("1.19") || serverVersion.contains("1.18") || serverVersion.contains("1.17") || serverVersion.contains("1.16") || serverVersion.contains("1.15") || serverVersion
if (serverVersion.contains("1.21") || serverVersion.contains("1.20") || serverVersion.contains("1.19") || serverVersion.contains("1.18") || serverVersion.contains("1.17") || serverVersion.contains("1.16") || serverVersion.contains("1.15") || serverVersion
.contains("1.14") || serverVersion.contains("1.13") || serverVersion.contains("1.12") || serverVersion.contains(
"1.11")) {
return true;
Expand Down Expand Up @@ -1886,6 +1896,12 @@ public boolean isVersionSpecific(String serverVersion) {
return false;
}

if (this.getVersion().equals("1.21")) {
if (serverVersion.contains("v1_21")) {
return true;
}
}

if (this.getVersion().equals("1.20")) {
if (serverVersion.contains("v1_20")) {
return true;
Expand Down Expand Up @@ -1930,7 +1946,11 @@ public boolean isVersionSpecific(String serverVersion) {
if (this.getVersion().equals("1.14.3")) {
return serverVersion.contains("v1_14_R3");
}


if (serverVersion.contains("v1_21") && this.getVersion().contains("1.21")) {
return true;
}

if (serverVersion.contains("v1_20") && this.getVersion().contains("1.20")) {
return true;
}
Expand Down

0 comments on commit 8761b9e

Please sign in to comment.