diff --git a/src/main/java/com/gamingmesh/jobs/container/blockOwnerShip/BlockOwnerShip.java b/src/main/java/com/gamingmesh/jobs/container/blockOwnerShip/BlockOwnerShip.java index 2717f1d5..257fb6de 100644 --- a/src/main/java/com/gamingmesh/jobs/container/blockOwnerShip/BlockOwnerShip.java +++ b/src/main/java/com/gamingmesh/jobs/container/blockOwnerShip/BlockOwnerShip.java @@ -259,22 +259,25 @@ public class BlockOwnerShip { } public int clear(UUID uuid) { - HashMap ls = blockOwnerShips.remove(uuid); - if (ls == null) - return 0; + HashMap ls = blockOwnerShips.remove(uuid); + if (ls == null) { + return 0; + } - for (blockLoc one : ls.values()) { - one.getBlock().removeMetadata(metadataName, plugin); + for (blockLoc one : ls.values()) { + if (one.getBlock() != null) { + one.getBlock().removeMetadata(metadataName, plugin); - Map oldRecord = ownerMapByLocation.get(one.getWorldName()); - if (oldRecord != null) - oldRecord.remove(one.toVectorString()); + Map oldRecord = ownerMapByLocation.get(one.getWorldName()); + if (oldRecord != null) + oldRecord.remove(one.toVectorString()); + } + } + + return ls.size(); } - return ls.size(); - } - public int remove(UUID uuid, String location) { HashMap ls = blockOwnerShips.get(uuid); if (ls == null)