diff --git a/src/main/java/net/Indyuce/mmocore/listener/BlockListener.java b/src/main/java/net/Indyuce/mmocore/listener/BlockListener.java index 8fb16ba4..e5450e06 100644 --- a/src/main/java/net/Indyuce/mmocore/listener/BlockListener.java +++ b/src/main/java/net/Indyuce/mmocore/listener/BlockListener.java @@ -24,6 +24,7 @@ import net.Indyuce.mmocore.manager.CustomBlockManager.BlockInfo; import net.Indyuce.mmocore.manager.RestrictionManager.BlockPermissions; import net.Indyuce.mmoitems.MMOItems; import net.Indyuce.mmoitems.api.CustomBlock; +import net.mmogroup.mmolib.MMOLib; public class BlockListener implements Listener { private static final BlockFace[] order = { BlockFace.UP, BlockFace.DOWN, BlockFace.EAST, BlockFace.NORTH, BlockFace.WEST, BlockFace.SOUTH }; @@ -34,7 +35,7 @@ public class BlockListener implements Listener { if (player.getGameMode() == GameMode.CREATIVE) return; - String savedData = event.getBlock().getBlockData().getAsString(); + String savedData = MMOLib.plugin.getVersion().isStrictlyHigher(1, 12) ? event.getBlock().getBlockData().getAsString() : ""; Block block = event.getBlock(); /* * if custom mining enabled, check for item breaking restrictions @@ -104,8 +105,12 @@ public class BlockListener implements Listener { /* * enable block regen. */ - if (info.hasRegen()) - MMOCore.plugin.mineManager.initialize(info.generateRegenInfo(Bukkit.createBlockData(savedData), block.getLocation())); + if (info.hasRegen()) { + if(MMOLib.plugin.getVersion().isStrictlyHigher(1, 12)) + MMOCore.plugin.mineManager.initialize(info.generateRegenInfo(Bukkit.createBlockData(savedData), block.getLocation())); + else + MMOCore.plugin.mineManager.initialize(info.generateRegenInfo(block.getLocation())); + } } } diff --git a/src/main/java/net/Indyuce/mmocore/manager/CustomBlockManager.java b/src/main/java/net/Indyuce/mmocore/manager/CustomBlockManager.java index b9b3220f..58ce60a3 100644 --- a/src/main/java/net/Indyuce/mmocore/manager/CustomBlockManager.java +++ b/src/main/java/net/Indyuce/mmocore/manager/CustomBlockManager.java @@ -82,11 +82,11 @@ public class CustomBlockManager extends MMOManager { if(MMOCore.plugin.isMILoaded() && info.getRegen().getCustomRegenBlockID() != 0) { CustomBlock block = MMOItems.plugin.getCustomBlocks().getBlock(info.getRegen().getCustomRegenBlockID()); info.getLocation().getBlock().setType(block.getType()); - info.getLocation().getBlock().setBlockData(block.getBlockData()); + if(MMOLib.plugin.getVersion().isStrictlyHigher(1, 12)) info.getLocation().getBlock().setBlockData(block.getBlockData()); } else info.getLocation().getBlock().setType(info.getRegen().getTemporaryBlock()); if(isPlayerSkull(info.getLocation().getBlock().getType())) { - if(isPlayerSkull(info.getRegen().getBlock())) info.getLocation().getBlock().setBlockData(info.getBlockData()); + if(isPlayerSkull(info.getRegen().getBlock()) && MMOLib.plugin.getVersion().isStrictlyHigher(1, 12)) info.getLocation().getBlock().setBlockData(info.getBlockData()); MMOLib.plugin.getNMS().setSkullValue(info.getLocation().getBlock(), info.getRegen().getRegenHeadValue()); } @@ -96,7 +96,8 @@ public class CustomBlockManager extends MMOManager { } private void regen(RegenInfo info) { - info.getLocation().getBlock().setBlockData(info.getBlockData()); + if(MMOLib.plugin.getVersion().isStrictlyHigher(1, 12)) + info.getLocation().getBlock().setBlockData(info.getBlockData()); if(isPlayerSkull(info.getLocation().getBlock().getType())) MMOLib.plugin.getNMS().setSkullValue(info.getLocation().getBlock(), info.getRegen().getHeadValue()); active.remove(info); @@ -216,6 +217,10 @@ public class CustomBlockManager extends MMOManager { return new RegenInfo(data, loc, this); } + public RegenInfo generateRegenInfo(Location loc) { + return new RegenInfo(null, loc, this); + } + public int getCustomBlockID() { return customBlockId; }