mirror of
https://github.com/DRE2N/DungeonsXL.git
synced 2025-02-16 12:21:30 +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 DSignType type = DSignTypeDefault.OPEN_DOOR;
|
||||||
|
|
||||||
private LockedDoor door;
|
private LockedDoor door;
|
||||||
|
private boolean active = true;
|
||||||
|
|
||||||
public OpenDoorSign(Sign sign, String[] lines, DGameWorld gameWorld) {
|
public OpenDoorSign(Sign sign, String[] lines, DGameWorld gameWorld) {
|
||||||
super(sign, lines, gameWorld);
|
super(sign, lines, gameWorld);
|
||||||
@ -54,6 +55,21 @@ public class OpenDoorSign extends DSign {
|
|||||||
this.door = door;
|
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
|
@Override
|
||||||
public DSignType getType() {
|
public DSignType getType() {
|
||||||
return type;
|
return type;
|
||||||
@ -85,8 +101,9 @@ public class OpenDoorSign extends DSign {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onTrigger() {
|
public void onTrigger() {
|
||||||
if (door != null) {
|
if (door != null && active) {
|
||||||
door.open();
|
door.open();
|
||||||
|
active = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,7 +19,6 @@ package io.github.dre2n.dungeonsxl.world.block;
|
|||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.BlockFace;
|
import org.bukkit.block.BlockFace;
|
||||||
import org.bukkit.event.block.BlockBreakEvent;
|
import org.bukkit.event.block.BlockBreakEvent;
|
||||||
import org.bukkit.material.Door;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Daniel Saukel
|
* @author Daniel Saukel
|
||||||
@ -54,8 +53,7 @@ public class LockedDoor extends GameBlock implements MultiBlock {
|
|||||||
* Opens the door.
|
* Opens the door.
|
||||||
*/
|
*/
|
||||||
public void open() {
|
public void open() {
|
||||||
((Door) block.getState().getData()).setOpen(true);
|
block.setData((byte) (block.getData() + 4));
|
||||||
block.getState().update(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user