Added 1.12.x compatibility, not tested yet (#90)

This commit is contained in:
Rammelkast committed 2020-10-18 12:05:54 +02:00
1 parent a84b573fa8
commit 1428b55591
3 files changed
+9 -5

No files matched your search

@@ -78,8 +78,9 @@ public class AntiCheatReloaded extends JavaPlugin {
eventList.add(new VehicleListener());
eventList.add(new InventoryListener());
// Handles 1.9+ potion effects
if (!VersionUtil.isBountifulUpdate())
if (!VersionUtil.isBountifulUpdate()) {
eventList.add(new PotionEffectListener());
}
// Order is important in some cases, don't screw with these unless
// needed, especially config
this.setupConfig();
@@ -187,8 +187,10 @@ public final class Utilities {
}
public static boolean isNearShulkerBox(Location location) {
if (VersionUtil.isBountifulUpdate())
// Shulkers are 1.12+
if (MinecraftVersion.getCurrentVersion().isAtLeast(MinecraftVersion.COLOR_UPDATE)) {
return false;
}
return isShulkerBox(location.getBlock()) || isShulkerBox(location.getBlock().getRelative(BlockFace.NORTH))
|| isShulkerBox(location.getBlock().getRelative(BlockFace.SOUTH))
|| isShulkerBox(location.getBlock().getRelative(BlockFace.EAST))
@@ -224,7 +226,8 @@ public final class Utilities {
}
public static boolean isHalfblock(Block block) {
if (!VersionUtil.isBountifulUpdate()) {
// getBoundingBox() is only available on 1.14+
if (MinecraftVersion.getCurrentVersion().isAtLeast(MinecraftVersion.VILLAGE_UPDATE)) {
BoundingBox box = block.getBoundingBox();
double height = box.getMaxY() - box.getMinY();
if (height > 0.42 && height <= 0.6 && block.getType().isSolid())
@@ -458,7 +461,7 @@ public final class Utilities {
return player.getLocation().getBlock().isLiquid()
|| player.getLocation().getBlock().getRelative(BlockFace.DOWN).isLiquid()
|| player.getLocation().getBlock().getRelative(BlockFace.UP).isLiquid()
|| (!VersionUtil.isBountifulUpdate()
|| (MinecraftVersion.getCurrentVersion().isAtLeast(MinecraftVersion.AQUATIC_UPDATE)
&& (player.getLocation().getBlock().getType() == XMaterial.KELP_PLANT.parseMaterial()
|| player.getLocation().getBlock().getRelative(BlockFace.UP)
.getType() == XMaterial.KELP_PLANT.parseMaterial()
@@ -36,7 +36,7 @@ import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
public class VersionUtil {
private static final List<String> SUPPORTED_VERSIONS = Arrays
.asList(new String[] { "v1_16", "v1_15", "v1_14", "v1_13", "v1_8_R3" });
.asList(new String[] { "v1_16", "v1_15", "v1_14", "v1_13", "v1_12", "v1_8_R3" });
public static String getVersion() {
return Bukkit.getServer().getClass().getPackage().getName().replace(".", ",").split(",")[3];