From c80a93f370a5181d573481a3101f73e4d9531869 Mon Sep 17 00:00:00 2001 From: Daniel Saukel Date: Thu, 21 Mar 2019 00:28:38 +0100 Subject: [PATCH] Revert LockedDoor to magic values The old MaterialData based solution did not work with 1.13.x and wasn't modern either. This one has the advantage that it works in all versions. A better solution to use in the future when support for -1.12.2 is dropped has been added as comments. --- pom.xml | 2 +- .../de/erethon/dungeonsxl/world/block/LockedDoor.java | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/pom.xml b/pom.xml index 7a84e801..b19607f4 100644 --- a/pom.xml +++ b/pom.xml @@ -2,7 +2,7 @@ 4.0.0 de.erethon dungeonsxl - 0.17.6 + 0.17.7 jar DungeonsXL https://dre2n.github.io diff --git a/src/main/java/de/erethon/dungeonsxl/world/block/LockedDoor.java b/src/main/java/de/erethon/dungeonsxl/world/block/LockedDoor.java index 56fd8ee8..2abe5967 100644 --- a/src/main/java/de/erethon/dungeonsxl/world/block/LockedDoor.java +++ b/src/main/java/de/erethon/dungeonsxl/world/block/LockedDoor.java @@ -17,11 +17,10 @@ package de.erethon.dungeonsxl.world.block; import de.erethon.dungeonsxl.DungeonsXL; +import de.erethon.dungeonsxl.util.MagicValueUtil; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; -import org.bukkit.block.BlockState; import org.bukkit.event.block.BlockBreakEvent; -import org.bukkit.material.Door; /** * A locked door that may be opened with a trigger. @@ -58,9 +57,10 @@ public class LockedDoor extends GameBlock implements MultiBlock { * Opens the door. */ public void open() { - BlockState state = block.getState(); - ((Door) state.getData()).setOpen(true); - state.update(true); + /*Openable data = ((Openable) block.getBlockData()); + data.setOpen(true); + block.setBlockData(data);*/ + MagicValueUtil.setBlockData(block, (byte) (block.getData() + 4)); } @Override