Added a check for existing protections in LWC

Fixes a bug where multiple protections are used
This commit is contained in:
Acrobot 2012-12-31 02:46:42 +01:00
parent 3bf60c061c
commit b53751af32
1 changed files with 7 additions and 0 deletions

View File

@ -86,6 +86,13 @@ public class LightweightChestProtection implements Listener {
String worldName = block.getWorld().getName();
Protection existingProtection = lwc.getPhysicalDatabase().loadProtection(worldName, x, y, z);
if (existingProtection != null) {
event.setProtected(true);
return;
}
Protection protection = lwc.getPhysicalDatabase().registerProtection(block.getTypeId(), Protection.Type.PRIVATE, worldName, event.getName(), "", x, y, z);
if (protection != null) {