diff --git a/src/main/lombok/nl/sbdeveloper/themeparkplus/commands/TPPCMD.java b/src/main/lombok/nl/sbdeveloper/themeparkplus/commands/TPPCMD.java index 4f3c04e..9a0e2b2 100644 --- a/src/main/lombok/nl/sbdeveloper/themeparkplus/commands/TPPCMD.java +++ b/src/main/lombok/nl/sbdeveloper/themeparkplus/commands/TPPCMD.java @@ -15,6 +15,7 @@ import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.World; import org.bukkit.block.Block; +import org.bukkit.block.BlockState; import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandSender; @@ -171,15 +172,19 @@ public class TPPCMD implements CommandExecutor { Block block = loc.getBlock(); Material oldMaterial = block.getType(); - byte oldData = block.getData(); + byte oldData = block.getState().getRawData(); Material redstoneMaterial = XMaterial.REDSTONE_BLOCK.parseMaterial(); if (redstoneMaterial == null) throw new IllegalArgumentException("Redstone Material not found."); Bukkit.getScheduler().scheduleSyncDelayedTask(ThemeParkPlus.getInstance(), () -> { block.setType(redstoneMaterial); - if (!XMaterial.isNewVersion()) block.getState().setRawData(oldData); //LEGACY - Bukkit.getScheduler().scheduleSyncDelayedTask(ThemeParkPlus.getInstance(), () -> block.setType(oldMaterial), offDelayTicks); + Bukkit.getScheduler().scheduleSyncDelayedTask(ThemeParkPlus.getInstance(), () -> { + BlockState state = block.getState(); + state.setType(oldMaterial); + if (!XMaterial.isNewVersion()) state.setRawData(oldData); + state.update(true); + }, offDelayTicks); }, onDelayTicks); HashMap replacements = new HashMap<>();