Add explicit null-check for interact events

This commit is contained in:
Gabriel Tofvesson 2021-04-24 17:44:12 +02:00
parent da495eb88a
commit 029716512a

View File

@ -23,7 +23,8 @@ public class SortListener implements Listener {
if (event.hasBlock() &&
(event.getClickedBlock().getState() instanceof Chest || event.getClickedBlock().getState() instanceof ShulkerBox) &&
(Objects.requireNonNull(event.getClickedBlock()).getState() instanceof Chest ||
event.getClickedBlock().getState() instanceof ShulkerBox) &&
event.getPlayer().isSneaking() &&
playerInventory.getItemInMainHand().getType().name().endsWith("_SWORD")
) {