Fix NPE during InventoryMoveItemEvent. Fixes #285

This commit is contained in:
bloodshot 2020-10-11 15:12:15 -04:00
parent c93dad7bea
commit ba722f7e52
1 changed files with 4 additions and 0 deletions

View File

@ -127,6 +127,10 @@ public class BlockEventHandler implements Listener {
final Inventory targetInventory = event.getDestination();
final Location sourceLocation = sourceInventory.getLocation();
final Location targetLocation = targetInventory.getLocation();
if (sourceLocation == null || targetLocation == null) {
return;
}
final GDClaim sourceClaim = GriefDefenderPlugin.getInstance().dataStore.getClaimAt(sourceLocation);
final GDClaim targetClaim = GriefDefenderPlugin.getInstance().dataStore.getClaimAt(targetLocation);
if (sourceClaim.isWilderness() && targetClaim.isWilderness() || (GriefDefenderPlugin.getInstance().getVaultProvider() == null)) {