Fix open door sign

This commit is contained in:
Daniel Saukel 2016-08-01 23:12:35 +02:00
parent 7d19bb28d7
commit d43234943b
2 changed files with 19 additions and 4 deletions

View File

@ -33,6 +33,7 @@ public class OpenDoorSign extends DSign {
private DSignType type = DSignTypeDefault.OPEN_DOOR;
private LockedDoor door;
private boolean active = true;
public OpenDoorSign(Sign sign, String[] lines, DGameWorld gameWorld) {
super(sign, lines, gameWorld);
@ -54,6 +55,21 @@ public class OpenDoorSign extends DSign {
this.door = door;
}
/**
* @return if the sign is active
*/
public boolean isActive() {
return active;
}
/**
* @param active
* toggle the sign active
*/
public void setActive(boolean active) {
this.active = active;
}
@Override
public DSignType getType() {
return type;
@ -85,8 +101,9 @@ public class OpenDoorSign extends DSign {
@Override
public void onTrigger() {
if (door != null) {
if (door != null && active) {
door.open();
active = false;
}
}

View File

@ -19,7 +19,6 @@ package io.github.dre2n.dungeonsxl.world.block;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.material.Door;
/**
* @author Daniel Saukel
@ -54,8 +53,7 @@ public class LockedDoor extends GameBlock implements MultiBlock {
* Opens the door.
*/
public void open() {
((Door) block.getState().getData()).setOpen(true);
block.getState().update(true);
block.setData((byte) (block.getData() + 4));
}
}