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

Merge pull request #1724 from FireML/ownership-npe-fix

Add more null checks to BlockOwnerShip#clear
This commit is contained in:
Zrips 2024-04-15 12:43:19 +03:00 committed by GitHub
commit 0ab6c20d21
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -266,22 +266,25 @@ public class BlockOwnerShip {
}
public int clear(UUID uuid) {
HashMap<String, blockLoc> ls = blockOwnerShips.remove(uuid);
if (ls == null)
return 0;
HashMap<String, blockLoc> 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<String, UUID> oldRecord = ownerMapByLocation.get(one.getWorldName());
if (oldRecord != null)
oldRecord.remove(one.toVectorString());
Map<String, UUID> 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<String, blockLoc> ls = blockOwnerShips.get(uuid);
if (ls == null)