diff --git a/src/main/java/tech/sbdevelopment/v10lift/api/V10LiftAPI.java b/src/main/java/tech/sbdevelopment/v10lift/api/V10LiftAPI.java index babbe6c..0abe984 100644 --- a/src/main/java/tech/sbdevelopment/v10lift/api/V10LiftAPI.java +++ b/src/main/java/tech/sbdevelopment/v10lift/api/V10LiftAPI.java @@ -2,7 +2,7 @@ package tech.sbdevelopment.v10lift.api; import com.cryptomorin.xseries.XMaterial; import tech.sbdevelopment.v10lift.V10LiftPlugin; -import nl.SBDeveloper.V10Lift.api.objects.*; +import tech.sbdevelopment.v10lift.api.objects.*; import tech.sbdevelopment.v10lift.api.runnables.DoorCloser; import tech.sbdevelopment.v10lift.api.runnables.MoveLift; import tech.sbdevelopment.v10lift.managers.DataManager; @@ -180,7 +180,7 @@ public class V10LiftAPI { public int addBlockToLift(Set blocks, @Nonnull Block block) { Material type = block.getType(); LiftBlock lb; - if (XMaterial.isNewVersion()) { + if (XMaterial.supports(13)) { if (type.toString().contains("SIGN")) { Bukkit.getLogger().info("Block instanceof Dir 1.13 & is sign"); lb = new LiftBlock(block.getWorld().getName(), block.getX(), block.getY(), block.getZ(), type, DirectionUtil.getDirection(block), ((Sign) block.getState()).getLines()); @@ -237,7 +237,7 @@ public class V10LiftAPI { Lift lift = DataManager.getLift(liftName); Material type = block.getType(); LiftBlock lb; - if (XMaterial.isNewVersion()) { + if (XMaterial.supports(13)) { if (type.toString().contains("SIGN")) { Bukkit.getLogger().info("Block instanceof Dir 1.13 & is sign"); lb = new LiftBlock(block.getWorld().getName(), block.getX(), block.getY(), block.getZ(), type, DirectionUtil.getDirection(block), ((Sign) block.getState()).getLines()); @@ -294,7 +294,7 @@ public class V10LiftAPI { Material type = block.getType(); if (ForbiddenBlockManager.isForbidden(type)) return -2; LiftBlock lb; - if (XMaterial.isNewVersion()) { + if (XMaterial.supports(13)) { if (type.toString().contains("SIGN")) { Bukkit.getLogger().info("Block instanceof Dir 1.13 & is sign"); lb = new LiftBlock(block.getWorld().getName(), block.getX(), block.getY(), block.getZ(), type, DirectionUtil.getDirection(block), ((Sign) block.getState()).getLines()); @@ -467,7 +467,7 @@ public class V10LiftAPI { Block block = Objects.requireNonNull(Bukkit.getWorld(lb.getWorld()), "World is null at closeDoor").getBlockAt(lb.getX(), lb.getY(), lb.getZ()); BlockState state = block.getState(); state.setType(lb.getMat()); - if (!XMaterial.isNewVersion()) { + if (!XMaterial.supports(13)) { state.setRawData(lb.getData()); } state.update(true); @@ -897,7 +897,7 @@ public class V10LiftAPI { } BlockFace face; - if (XMaterial.isNewVersion()) { + if (XMaterial.supports(13)) { face = DirectionUtil.getDirection(block); } else { BlockState state = block.getState(); diff --git a/src/main/java/tech/sbdevelopment/v10lift/api/runnables/MoveLift.java b/src/main/java/tech/sbdevelopment/v10lift/api/runnables/MoveLift.java index 706b1f6..bb01ed4 100644 --- a/src/main/java/tech/sbdevelopment/v10lift/api/runnables/MoveLift.java +++ b/src/main/java/tech/sbdevelopment/v10lift/api/runnables/MoveLift.java @@ -5,7 +5,7 @@ import com.cryptomorin.xseries.XSound; import tech.sbdevelopment.v10lift.V10LiftPlugin; import tech.sbdevelopment.v10lift.api.V10LiftAPI; import tech.sbdevelopment.v10lift.api.enums.LiftDirection; -import nl.SBDeveloper.V10Lift.api.objects.*; +import tech.sbdevelopment.v10lift.api.objects.*; import tech.sbdevelopment.v10lift.managers.AntiCopyBlockManager; import tech.sbdevelopment.v10lift.managers.DataManager; import tech.sbdevelopment.v10lift.sbutils.LocationSerializer; @@ -213,12 +213,12 @@ public class MoveLift implements Runnable { BlockState state = nextBlock.getState(); state.setType(lib.getMat()); - if (!XMaterial.isNewVersion()) { + if (!XMaterial.supports(13)) { state.setRawData(lib.getData()); } state.update(true); - if (XMaterial.isNewVersion()) { + if (XMaterial.supports(13)) { DirectionUtil.setDirection(nextBlock, lib.getFace()); DirectionUtil.setBisected(nextBlock, lib.getBisected()); DirectionUtil.setSlabType(nextBlock, lib.getSlabtype()); @@ -264,12 +264,12 @@ public class MoveLift implements Runnable { BlockState state = block.getState(); state.setType(lib.getMat()); - if (!XMaterial.isNewVersion()) { + if (!XMaterial.supports(13)) { state.setRawData(lib.getData()); } state.update(true); - if (XMaterial.isNewVersion()) { + if (XMaterial.supports(13)) { DirectionUtil.setDirection(block, lib.getFace()); DirectionUtil.setBisected(block, lib.getBisected()); DirectionUtil.setSlabType(block, lib.getSlabtype()); @@ -343,7 +343,7 @@ public class MoveLift implements Runnable { if (rope.getType() == null) rope.setType(Material.AIR); block.setType(rope.getType()); - if (XMaterial.isNewVersion()) { + if (XMaterial.supports(13)) { DirectionUtil.setDirection(block, rope.getFace()); } else { BlockState state = block.getState(); diff --git a/src/main/java/tech/sbdevelopment/v10lift/listeners/PlayerInteractListener.java b/src/main/java/tech/sbdevelopment/v10lift/listeners/PlayerInteractListener.java index 6542f85..5256b95 100644 --- a/src/main/java/tech/sbdevelopment/v10lift/listeners/PlayerInteractListener.java +++ b/src/main/java/tech/sbdevelopment/v10lift/listeners/PlayerInteractListener.java @@ -283,7 +283,7 @@ public class PlayerInteractListener implements Listener { return; } LiftBlock lb; - if (XMaterial.isNewVersion()) { + if (XMaterial.supports(13)) { lb = new LiftBlock(block.getWorld().getName(), block.getX(), block.getY(), block.getZ(), block.getType()); } else { lb = new LiftBlock(block.getWorld().getName(), block.getX(), block.getY(), block.getZ(), block.getType(), block.getState().getRawData()); diff --git a/src/main/java/tech/sbdevelopment/v10lift/utils/DirectionUtil.java b/src/main/java/tech/sbdevelopment/v10lift/utils/DirectionUtil.java index 962ee3c..986bba7 100644 --- a/src/main/java/tech/sbdevelopment/v10lift/utils/DirectionUtil.java +++ b/src/main/java/tech/sbdevelopment/v10lift/utils/DirectionUtil.java @@ -11,7 +11,7 @@ public class DirectionUtil { @Nullable public static BlockFace getDirection(@Nonnull Block block) { - if (!XMaterial.isNewVersion()) return null; + if (!XMaterial.supports(13)) return null; if (block.getBlockData() instanceof org.bukkit.block.data.Directional) { org.bukkit.block.data.Directional dir = (org.bukkit.block.data.Directional) block.getBlockData(); return dir.getFacing(); @@ -20,7 +20,7 @@ public class DirectionUtil { } public static void setDirection(@Nonnull Block block, BlockFace blockFace) { - if (!XMaterial.isNewVersion()) return; + if (!XMaterial.supports(13)) return; if (blockFace != null && block.getBlockData() instanceof org.bukkit.block.data.Directional) { org.bukkit.block.data.BlockData bd = block.getBlockData(); org.bukkit.block.data.Directional dir = (org.bukkit.block.data.Directional) bd; @@ -31,7 +31,7 @@ public class DirectionUtil { @Nullable public static String getBisected(@Nonnull Block block) { - if (!XMaterial.isNewVersion()) return null; + if (!XMaterial.supports(13)) return null; if (block.getBlockData() instanceof org.bukkit.block.data.Bisected) { org.bukkit.block.data.Bisected bis = (org.bukkit.block.data.Bisected) block.getBlockData(); return bis.getHalf().toString(); @@ -40,7 +40,7 @@ public class DirectionUtil { } public static void setBisected(@Nonnull Block block, String bisected) { - if (!XMaterial.isNewVersion()) return; + if (!XMaterial.supports(13)) return; if (bisected != null && block.getBlockData() instanceof org.bukkit.block.data.Bisected) { org.bukkit.block.data.Bisected.Half half; @@ -60,7 +60,7 @@ public class DirectionUtil { @Nullable public static String getSlabType(@Nonnull Block block) { - if (!XMaterial.isNewVersion()) return null; + if (!XMaterial.supports(13)) return null; if (block.getBlockData() instanceof org.bukkit.block.data.type.Slab) { org.bukkit.block.data.type.Slab slab = (org.bukkit.block.data.type.Slab) block.getBlockData(); return slab.getType().toString(); @@ -69,7 +69,7 @@ public class DirectionUtil { } public static void setSlabType(@Nonnull Block block, String slabtype) { - if (!XMaterial.isNewVersion()) return; + if (!XMaterial.supports(13)) return; if (slabtype != null && block.getBlockData() instanceof org.bukkit.block.data.type.Slab) { org.bukkit.block.data.type.Slab.Type type; diff --git a/src/main/java/tech/sbdevelopment/v10lift/utils/DoorUtil.java b/src/main/java/tech/sbdevelopment/v10lift/utils/DoorUtil.java index b8af50c..bec0c34 100644 --- a/src/main/java/tech/sbdevelopment/v10lift/utils/DoorUtil.java +++ b/src/main/java/tech/sbdevelopment/v10lift/utils/DoorUtil.java @@ -21,7 +21,7 @@ public class DoorUtil { if (b.getType() == XMaterial.IRON_DOOR.parseMaterial()) XSound.BLOCK_IRON_DOOR_OPEN.play(b.getLocation()); if (b.getType().toString().contains("DOOR") && b.getType() != XMaterial.IRON_DOOR.parseMaterial()) XSound.BLOCK_WOODEN_DOOR_OPEN.play(b.getLocation()); if (b.getType().toString().contains("GATE")) XSound.BLOCK_FENCE_GATE_OPEN.play(b.getLocation()); - if (XMaterial.isNewVersion()) { + if (XMaterial.supports(13)) { //1.13+ org.bukkit.block.data.BlockData blockData = b.getBlockData(); if (isOpenable(b)) { @@ -59,7 +59,7 @@ public class DoorUtil { if (b.getType() == XMaterial.IRON_DOOR.parseMaterial()) XSound.BLOCK_IRON_DOOR_CLOSE.play(b.getLocation()); if (b.getType().toString().contains("DOOR") && b.getType() != XMaterial.IRON_DOOR.parseMaterial()) XSound.BLOCK_WOODEN_DOOR_CLOSE.play(b.getLocation()); if (b.getType().toString().contains("GATE")) XSound.BLOCK_FENCE_GATE_CLOSE.play(b.getLocation()); - if (XMaterial.isNewVersion()) { + if (XMaterial.supports(13)) { //1.13+ org.bukkit.block.data.BlockData blockData = b.getBlockData(); if (isOpenable(b)) { @@ -98,7 +98,7 @@ public class DoorUtil { if (b == null) { return false; } - if (XMaterial.isNewVersion()) { + if (XMaterial.supports(13)) { //1.13+ return b.getBlockData() instanceof org.bukkit.block.data.Openable; } else { @@ -116,7 +116,7 @@ public class DoorUtil { public static Location getLowerLocationOfDoor(@Nonnull Block block) { if (!isDoor(block)) return block.getLocation(); - if (XMaterial.isNewVersion()) { + if (XMaterial.supports(13)) { //1.13+ org.bukkit.block.data.type.Door door = (org.bukkit.block.data.type.Door) block.getBlockData(); Location lower; @@ -161,7 +161,7 @@ public class DoorUtil { if (b == null) { return false; } - if (XMaterial.isNewVersion()) { + if (XMaterial.supports(13)) { //1.13+ return b.getBlockData() instanceof org.bukkit.block.data.type.Door; } else {