From 2c94175a23ab367a825d8108834e61b1265b4889 Mon Sep 17 00:00:00 2001 From: Acrobot Date: Sun, 27 Oct 2013 16:49:48 +0100 Subject: [PATCH] Add LWC protection removal --- .../Plugins/LightweightChestProtection.java | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/main/java/com/Acrobot/ChestShop/Plugins/LightweightChestProtection.java b/src/main/java/com/Acrobot/ChestShop/Plugins/LightweightChestProtection.java index 8751813..34cbca7 100644 --- a/src/main/java/com/Acrobot/ChestShop/Plugins/LightweightChestProtection.java +++ b/src/main/java/com/Acrobot/ChestShop/Plugins/LightweightChestProtection.java @@ -5,6 +5,7 @@ import com.Acrobot.ChestShop.Configuration.Properties; import com.Acrobot.ChestShop.Events.Protection.ProtectBlockEvent; import com.Acrobot.ChestShop.Events.Protection.ProtectionCheckEvent; import com.Acrobot.ChestShop.Events.ShopCreatedEvent; +import com.Acrobot.ChestShop.Events.ShopDestroyedEvent; import com.Acrobot.ChestShop.Security; import com.griefcraft.lwc.LWC; import com.griefcraft.model.Protection; @@ -104,4 +105,23 @@ public class LightweightChestProtection implements Listener { event.setProtected(true); } } + + @EventHandler + public void onShopRemove(ShopDestroyedEvent event) { + Protection signProtection = lwc.findProtection(event.getSign().getBlock()); + + if (signProtection != null) { + signProtection.remove(); + } + + if (event.getChest() == null) { + return; + } + + Protection chestProtection = lwc.findProtection(event.getChest().getBlock()); + + if (chestProtection != null) { + chestProtection.remove(); + } + } }