Fixes a potential exception when a portal with an invalid gate type is missing a sign

This commit is contained in:
Kristian Knarvik 2021-11-25 03:25:58 +01:00
parent 4b34ea3cf5
commit 27b964837f

View File

@ -293,7 +293,10 @@ public class PortalSignDrawer {
* @param lineIndex <p>The index of the line the invalid portal was found at</p>
*/
public static void markPortalWithInvalidGate(PortalLocation portalLocation, String gateName, int lineIndex) {
Sign sign = (Sign) portalLocation.getSignLocation().getBlock().getState();
BlockState blockState = portalLocation.getSignLocation().getBlock().getState();
if (!(blockState instanceof Sign sign)) {
return;
}
sign.setLine(3, errorColor + Stargate.getString("signInvalidGate"));
sign.update();