Fix redstone signs; resolves #761

This commit is contained in:
Daniel Saukel 2020-04-18 17:32:41 +02:00
parent cfa03ec391
commit 88679e6a51
2 changed files with 7 additions and 7 deletions

View File

@ -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;

View File

@ -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 {