mirror of
https://github.com/DRE2N/DungeonsXL.git
synced 2024-11-28 05:26:29 +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;
|
||||
|
||||
import de.erethon.dungeonsxl.api.DungeonsAPI;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
/**
|
||||
@ -24,19 +24,19 @@ import org.bukkit.scheduler.BukkitRunnable;
|
||||
*/
|
||||
public class DelayedPowerTask extends BukkitRunnable {
|
||||
|
||||
private DungeonsAPI api;
|
||||
|
||||
private String worldName;
|
||||
private RedstoneSign sign;
|
||||
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.enable = enable;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
if (api.getGameWorld(sign.getSign().getWorld()) != null) {
|
||||
if (Bukkit.getWorld(worldName) == null) {
|
||||
sign.getEnableTask().cancel();
|
||||
sign.getDisableTask().cancel();
|
||||
return;
|
||||
|
@ -156,11 +156,11 @@ public class RedstoneSign extends Rocker {
|
||||
}
|
||||
|
||||
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) {
|
||||
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 {
|
||||
|
Loading…
Reference in New Issue
Block a user