Skip to content

Commit

Permalink
Fixed sign script behavior; resolves #443 and #563
Browse files Browse the repository at this point in the history
  • Loading branch information
Sataniel98 committed May 4, 2019
1 parent 4252eb3 commit c7c4bfc
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/main/java/de/erethon/dungeonsxl/sign/SignScript.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -49,11 +49,15 @@ public SignScript(String name, FileConfiguration config) {
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<String> 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++;
}
}

Expand Down

0 comments on commit c7c4bfc

Please sign in to comment.