Fix sign IOOB exception if line one length is small

This commit is contained in:
Daniel Saukel 2020-03-21 16:41:06 +01:00
parent 42e762911a
commit dede41827f

View File

@ -77,6 +77,9 @@ public class DSignListener implements Listener {
@EventHandler
public void onSignChange(SignChangeEvent event) {
String[] lines = event.getLines();
if (lines.length < 3 || !lines[0].startsWith("[")) {
return;
}
Player player = event.getPlayer();
Block block = event.getBlock();
BlockState state = block.getState();
@ -93,6 +96,7 @@ public class DSignListener implements Listener {
if (sign == null) {
return;
}
// Override sign plugins color codes etc.
sign.setLine(0, lines[0]);
sign.setLine(1, lines[1]);
sign.setLine(2, lines[2]);