From 0a3d559b3970226bd10e6597d7c70ac9652a9960 Mon Sep 17 00:00:00 2001 From: Daniel Saukel Date: Thu, 19 Mar 2020 17:06:23 +0100 Subject: [PATCH] Handle interval == 0 windups --- .../java/de/erethon/dungeonsxl/api/sign/Windup.java | 12 +++++++++--- .../de/erethon/dungeonsxl/sign/windup/DropSign.java | 10 ---------- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/api/src/main/java/de/erethon/dungeonsxl/api/sign/Windup.java b/api/src/main/java/de/erethon/dungeonsxl/api/sign/Windup.java index 0ea91560..ef91ed79 100644 --- a/api/src/main/java/de/erethon/dungeonsxl/api/sign/Windup.java +++ b/api/src/main/java/de/erethon/dungeonsxl/api/sign/Windup.java @@ -153,8 +153,12 @@ public abstract class Windup extends Deactivatable { @Override public void activate() { - active = true; - startTask(); + if (interval <= 0) { + runnable.run(); + } else { + active = true; + startTask(); + } } /** @@ -163,7 +167,9 @@ public abstract class Windup extends Deactivatable { @Override public void deactivate() { active = false; - getTask().cancel(); + if (getTask() != null) { + getTask().cancel(); + } } /** diff --git a/core/src/main/java/de/erethon/dungeonsxl/sign/windup/DropSign.java b/core/src/main/java/de/erethon/dungeonsxl/sign/windup/DropSign.java index 5b05147e..7345fa6a 100644 --- a/core/src/main/java/de/erethon/dungeonsxl/sign/windup/DropSign.java +++ b/core/src/main/java/de/erethon/dungeonsxl/sign/windup/DropSign.java @@ -102,14 +102,4 @@ public class DropSign extends Windup { }); } - @Override - public void activate() { - if (interval < 0) { - active = true; - getRunnable().run(); - } else { - super.activate(); - } - } - }