mirror of
https://github.com/DRE2N/DungeonsXL.git
synced 2024-11-24 19:45:43 +01:00
Fix open door sign
This commit is contained in:
parent
7d19bb28d7
commit
d43234943b
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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));
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user