Add LWC protection removal

This commit is contained in:
Acrobot 2013-10-27 16:49:48 +01:00
parent 87d768a524
commit 2c94175a23
1 changed files with 20 additions and 0 deletions

View File

@ -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();
}
}
}