mirror of
https://github.com/DRE2N/DungeonsXL.git
synced 2024-12-01 06:53:26 +01:00
Fix redstone signs; resolves #761
This commit is contained in:
parent
cfa03ec391
commit
88679e6a51
@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
package de.erethon.dungeonsxl.sign.windup;
|
package de.erethon.dungeonsxl.sign.windup;
|
||||||
|
|
||||||
import de.erethon.dungeonsxl.api.DungeonsAPI;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -24,19 +24,19 @@ import org.bukkit.scheduler.BukkitRunnable;
|
|||||||
*/
|
*/
|
||||||
public class DelayedPowerTask extends BukkitRunnable {
|
public class DelayedPowerTask extends BukkitRunnable {
|
||||||
|
|
||||||
private DungeonsAPI api;
|
private String worldName;
|
||||||
|
|
||||||
private RedstoneSign sign;
|
private RedstoneSign sign;
|
||||||
private boolean enable;
|
private boolean enable;
|
||||||
|
|
||||||
public DelayedPowerTask(DungeonsAPI api, RedstoneSign sign, boolean enable) {
|
public DelayedPowerTask(RedstoneSign sign, boolean enable) {
|
||||||
|
worldName = sign.getSign().getWorld().getName();
|
||||||
this.sign = sign;
|
this.sign = sign;
|
||||||
this.enable = enable;
|
this.enable = enable;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if (api.getGameWorld(sign.getSign().getWorld()) != null) {
|
if (Bukkit.getWorld(worldName) == null) {
|
||||||
sign.getEnableTask().cancel();
|
sign.getEnableTask().cancel();
|
||||||
sign.getDisableTask().cancel();
|
sign.getDisableTask().cancel();
|
||||||
return;
|
return;
|
||||||
|
@ -156,11 +156,11 @@ public class RedstoneSign extends Rocker {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (delay > 0) {
|
if (delay > 0) {
|
||||||
enableTask = new DelayedPowerTask(api, this, true).runTaskTimer(api, delay, delay + offDelay);
|
enableTask = new DelayedPowerTask(this, true).runTaskTimer(api, delay, delay + offDelay);
|
||||||
|
|
||||||
if (repeat != 1) {
|
if (repeat != 1) {
|
||||||
repeatsToDo = repeat;
|
repeatsToDo = repeat;
|
||||||
disableTask = new DelayedPowerTask(api, this, false).runTaskTimer(api, delay + offDelay, delay + offDelay);
|
disableTask = new DelayedPowerTask(this, false).runTaskTimer(api, delay + offDelay, delay + offDelay);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user