1
0
mirror of https://github.com/Zrips/Jobs.git synced 2024-11-29 14:05:25 +01:00

Add Null Checks to BlockOwnerShip#clear(UUID)

This commit is contained in:
FireML 2024-03-21 12:10:36 +00:00
parent c96b24bb10
commit b328d5c9fc

View File

@ -259,22 +259,25 @@ public class BlockOwnerShip {
} }
public int clear(UUID uuid) { public int clear(UUID uuid) {
HashMap<String, blockLoc> ls = blockOwnerShips.remove(uuid); HashMap<String, blockLoc> ls = blockOwnerShips.remove(uuid);
if (ls == null) if (ls == null) {
return 0; return 0;
}
for (blockLoc one : ls.values()) { for (blockLoc one : ls.values()) {
one.getBlock().removeMetadata(metadataName, plugin); if (one.getBlock() != null) {
one.getBlock().removeMetadata(metadataName, plugin);
Map<String, UUID> oldRecord = ownerMapByLocation.get(one.getWorldName()); Map<String, UUID> oldRecord = ownerMapByLocation.get(one.getWorldName());
if (oldRecord != null) if (oldRecord != null)
oldRecord.remove(one.toVectorString()); oldRecord.remove(one.toVectorString());
}
}
return ls.size();
} }
return ls.size();
}
public int remove(UUID uuid, String location) { public int remove(UUID uuid, String location) {
HashMap<String, blockLoc> ls = blockOwnerShips.get(uuid); HashMap<String, blockLoc> ls = blockOwnerShips.get(uuid);
if (ls == null) if (ls == null)