From c7c4bfc066ed47212e601b1086f38ae962051aea Mon Sep 17 00:00:00 2001 From: Daniel Saukel Date: Sun, 5 May 2019 00:23:57 +0200 Subject: [PATCH] Fixed sign script behavior; resolves #443 and #563 --- .../de/erethon/dungeonsxl/sign/SignScript.java | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/main/java/de/erethon/dungeonsxl/sign/SignScript.java b/src/main/java/de/erethon/dungeonsxl/sign/SignScript.java index 04561bfa..12085e2f 100644 --- a/src/main/java/de/erethon/dungeonsxl/sign/SignScript.java +++ b/src/main/java/de/erethon/dungeonsxl/sign/SignScript.java @@ -16,7 +16,7 @@ */ package de.erethon.dungeonsxl.sign; -import de.erethon.commons.misc.NumberUtil; +import de.erethon.commons.chat.MessageUtil; import java.io.File; import java.util.ArrayList; import java.util.List; @@ -49,11 +49,15 @@ public class SignScript { this.name = name; signs = new ArrayList<>(config.getKeys(false).size()); + int i = 0; for (String key : config.getKeys(false)) { - int index = NumberUtil.parseInt(key); - String[] lines = new String[]{}; - lines = config.getStringList(key).toArray(lines); - signs.add(index, lines); + List lines = config.getStringList(key); + if (lines.size() != 4) { + MessageUtil.log("Found an invalid sign (ID: " + key + ") in script \"" + name + "\". Every sign must have 4 text lines."); + continue; + } + signs.add(i, lines.toArray(new String[4])); + i++; } }