diff --git a/src/main/java/net/coreprotect/listener/player/InventoryChangeListener.java b/src/main/java/net/coreprotect/listener/player/InventoryChangeListener.java index fac8ac4..4aa4a0f 100644 --- a/src/main/java/net/coreprotect/listener/player/InventoryChangeListener.java +++ b/src/main/java/net/coreprotect/listener/player/InventoryChangeListener.java @@ -317,7 +317,12 @@ public final class InventoryChangeListener extends Queue implements Listener { return; } - Location location = event.getSource().getLocation(); + Inventory sourceInventory = event.getSource(); + if (sourceInventory == null) { + return; + } + + Location location = sourceInventory.getLocation(); if (location == null) { return; } @@ -327,7 +332,7 @@ public final class InventoryChangeListener extends Queue implements Listener { return; } - InventoryHolder sourceHolder = PaperAdapter.ADAPTER.getHolder(event.getSource(), false); + InventoryHolder sourceHolder = PaperAdapter.ADAPTER.getHolder(sourceInventory, false); if (sourceHolder == null) { return; }