mirror of
https://github.com/darksaid98/AntiCheatReloaded.git
synced 2026-12-01 22:14:49 +00:00
Fixed a lot of things. Plugin should work a lot better on 1.12 now.
This commit is contained in:
1 parent
f609758d28
commit
06c1eab2e6
52 files changed
+416
-343
No files matched your search
@@ -1,6 +1,8 @@
|
||||
package com.rammelkast.anticheatreloaded.util;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
@@ -8,10 +10,27 @@ import org.bukkit.entity.Player;
|
||||
|
||||
public class VersionUtil {
|
||||
|
||||
private static final List<String> SUPPORTED_VERSIONS = Arrays.asList(new String[] {
|
||||
"v1_8",
|
||||
"v1_9",
|
||||
"v1_10",
|
||||
"v1_11",
|
||||
"v1_12"
|
||||
});
|
||||
|
||||
public static String getVersion() {
|
||||
return Bukkit.getServer().getClass().getPackage().getName().replace(".", ",").split(",")[3];
|
||||
}
|
||||
|
||||
public static boolean isSupported() {
|
||||
for (String versionId : SUPPORTED_VERSIONS) {
|
||||
if (getVersion().startsWith(versionId)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private static final EnumSet<Material> MOVE_UP_BLOCKS_1_8 = EnumSet.of(Material.ACACIA_STAIRS,
|
||||
Material.BIRCH_WOOD_STAIRS, Material.BRICK_STAIRS, Material.COBBLESTONE_STAIRS, Material.DARK_OAK_STAIRS,
|
||||
Material.JUNGLE_WOOD_STAIRS, Material.NETHER_BRICK_STAIRS, Material.QUARTZ_STAIRS,
|
||||
@@ -52,6 +71,9 @@ public class VersionUtil {
|
||||
|
||||
public static boolean isFrostWalk(Player player) {
|
||||
if (getVersion().startsWith("v1_9") || getVersion().startsWith("v1_10") || getVersion().startsWith("v1_11") || getVersion().startsWith("v1_12")) {
|
||||
if (player.getInventory().getBoots() == null) {
|
||||
return false;
|
||||
}
|
||||
return player.getInventory().getBoots().containsEnchantment(NMS_1_9_PLUS.FROST_WALKER);
|
||||
} else {
|
||||
return false;
|
||||
|
||||
Reference in new issue
Block a user