Fixed shop delete bypassing in previous commit

This commit is contained in:
Ghost_chu committed 2021-07-13 21:51:05 +08:00
1 parent 4da50a75d7
commit 2af82e0958
1 file changed
+12 -2
@@ -151,12 +151,17 @@ public class GriefPreventionIntegration extends QSIntegratedPlugin {
return;
}
Claim claim = event.getClaim();
if (event.getClaim().getOwnerID() == null) {
return;
}
for (Chunk chunk : claim.getChunks()) {
Map<Location, Shop> shops = plugin.getShopManager().getShops(chunk);
if (shops != null && !shops.isEmpty()) {
for (Shop shop : shops.values()) {
if (griefPrevention.dataStore.getClaimAt(shop.getLocation(), true, true, null) == null) {
shop.delete();
if (event.getClaim().getOwnerID().equals(shop.getOwner())) {
shop.delete();
}
}
}
}
@@ -168,13 +173,18 @@ public class GriefPreventionIntegration extends QSIntegratedPlugin {
if (!deleteOnClaimExpired) {
return;
}
if (event.getClaim().getOwnerID() == null) {
return;
}
Claim claim = event.getClaim();
for (Chunk chunk : claim.getChunks()) {
Map<Location, Shop> shops = plugin.getShopManager().getShops(chunk);
if (shops != null && !shops.isEmpty()) {
for (Shop shop : shops.values()) {
if (griefPrevention.dataStore.getClaimAt(shop.getLocation(), true, true, null) == null) {
shop.delete();
if (event.getClaim().getOwnerID().equals(shop.getOwner())) {
shop.delete();
}
}
}
}