diff --git a/core/src/main/java/de/erethon/dungeonsxl/sign/windup/DelayedPowerTask.java b/core/src/main/java/de/erethon/dungeonsxl/sign/windup/DelayedPowerTask.java index 60f676e2..1c0e78bc 100644 --- a/core/src/main/java/de/erethon/dungeonsxl/sign/windup/DelayedPowerTask.java +++ b/core/src/main/java/de/erethon/dungeonsxl/sign/windup/DelayedPowerTask.java @@ -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; diff --git a/core/src/main/java/de/erethon/dungeonsxl/sign/windup/RedstoneSign.java b/core/src/main/java/de/erethon/dungeonsxl/sign/windup/RedstoneSign.java index 0447baba..e660be08 100644 --- a/core/src/main/java/de/erethon/dungeonsxl/sign/windup/RedstoneSign.java +++ b/core/src/main/java/de/erethon/dungeonsxl/sign/windup/RedstoneSign.java @@ -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 {