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.
This commit is contained in:
Daniel Saukel 2019-03-21 00:28:38 +01:00
parent 820527ea28
commit c80a93f370
2 changed files with 6 additions and 6 deletions

View File

@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>de.erethon</groupId> <groupId>de.erethon</groupId>
<artifactId>dungeonsxl</artifactId> <artifactId>dungeonsxl</artifactId>
<version>0.17.6</version> <version>0.17.7</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<name>DungeonsXL</name> <name>DungeonsXL</name>
<url>https://dre2n.github.io</url> <url>https://dre2n.github.io</url>

View File

@ -17,11 +17,10 @@
package de.erethon.dungeonsxl.world.block; package de.erethon.dungeonsxl.world.block;
import de.erethon.dungeonsxl.DungeonsXL; import de.erethon.dungeonsxl.DungeonsXL;
import de.erethon.dungeonsxl.util.MagicValueUtil;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.block.BlockFace; import org.bukkit.block.BlockFace;
import org.bukkit.block.BlockState;
import org.bukkit.event.block.BlockBreakEvent; import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.material.Door;
/** /**
* A locked door that may be opened with a trigger. * A locked door that may be opened with a trigger.
@ -58,9 +57,10 @@ public class LockedDoor extends GameBlock implements MultiBlock {
* Opens the door. * Opens the door.
*/ */
public void open() { public void open() {
BlockState state = block.getState(); /*Openable data = ((Openable) block.getBlockData());
((Door) state.getData()).setOpen(true); data.setOpen(true);
state.update(true); block.setBlockData(data);*/
MagicValueUtil.setBlockData(block, (byte) (block.getData() + 4));
} }
@Override @Override