From a9c52d201ddae2b560a9c755b7dbea45161a1b86 Mon Sep 17 00:00:00 2001 From: Daniel Saukel Date: Sat, 24 Oct 2020 20:04:28 +0200 Subject: [PATCH] Only set script sign to air if the last sign isSetToAir() --- .../dungeonsxl/sign/passive/ScriptSign.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/core/src/main/java/de/erethon/dungeonsxl/sign/passive/ScriptSign.java b/core/src/main/java/de/erethon/dungeonsxl/sign/passive/ScriptSign.java index 9c9073c4..0b453656 100644 --- a/core/src/main/java/de/erethon/dungeonsxl/sign/passive/ScriptSign.java +++ b/core/src/main/java/de/erethon/dungeonsxl/sign/passive/ScriptSign.java @@ -82,8 +82,9 @@ public class ScriptSign extends Passive { return; } + DungeonSign dSign = null; for (String[] lines : script.getSigns()) { - DungeonSign dSign = getGameWorld().createDungeonSign(getSign(), lines); + dSign = getGameWorld().createDungeonSign(getSign(), lines); if (dSign.isErroneous()) { getGameWorld().removeDungeonSign(dSign); continue; @@ -91,9 +92,6 @@ public class ScriptSign extends Passive { try { dSign.initialize(); - if (dSign.isSetToAir()) { - dSign.setToAir(); - } } catch (Exception exception) { dSign.markAsErroneous("An error occurred while initializing a sign of the type " + dSign.getName() + ". This is not a user error. Please report the following stacktrace to the developer of the plugin:"); @@ -109,6 +107,14 @@ public class ScriptSign extends Passive { } } } + + if (dSign == null) { + markAsErroneous("The script \"" + scriptName + "\" could not be found."); + return; + } + if (dSign.isSetToAir()) { + dSign.setToAir(); + } } }