From 2af82e095862e5325d443524dc3d2b171c0daaa3 Mon Sep 17 00:00:00 2001 From: Ghost_chu <2908803755@qq.com> Date: Tue, 13 Jul 2021 21:51:05 +0800 Subject: [PATCH] Fixed shop delete bypassing in previous commit --- .../GriefPreventionIntegration.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/maxgamer/quickshop/integration/griefprevention/GriefPreventionIntegration.java b/src/main/java/org/maxgamer/quickshop/integration/griefprevention/GriefPreventionIntegration.java index c49367079..19f47723d 100644 --- a/src/main/java/org/maxgamer/quickshop/integration/griefprevention/GriefPreventionIntegration.java +++ b/src/main/java/org/maxgamer/quickshop/integration/griefprevention/GriefPreventionIntegration.java @@ -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 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 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(); + } } } }