package markehme.factionsplus.Cmds;

import markehme.factionsplus.FactionsBridge.*;
import markehme.factionsplus.extras.*;

import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.entity.Player;

import com.massivecraft.factions.cmd.FCommand;
import com.massivecraft.factions.struct.Permission;

public class CmdClearLocks extends FCommand {
	public CmdClearLocks() {
		this.aliases.add("clearlocks");
		this.errorOnToManyArgs = true;
				
		this.permission = Permission.HELP.node;
		this.disableOnLock = false;
		
		senderMustBePlayer = true;
		senderMustBeMember = false;
//		senderMustBeAdmin = true;
		Bridge.factions.setSenderMustBeFactionAdmin(this, true);
		
		this.setHelpShort("Clears all LWC protections not owned by a faction member of the user's faction");
	}
	
	@Override
	public void perform() {
		Location loc = fme.getPlayer().getLocation();
		Player name = fme.getPlayer();
		int clearedlocks = LWCFunctions.clearLocksCommand(name, loc);
		if( clearedlocks < 0 ) {
			return;
		}
		if( clearedlocks == 0 ) {
			name.sendMessage(ChatColor.GOLD + "No unlockable protections were found in this chunk");
			return;
		}
		name.sendMessage(ChatColor.GOLD + "Successfully removed " + clearedlocks + " protections from this chunk");
		
	}

}

@@ -30,16 +30,59 @@
 .Cmds;%0A%0A
+import markehme.factionsplus.FactionsPlus;%0A
 import m
@@ -946,16 +946,98 @@
 ayer();%0A
+%09%09if(!FactionsPlus.permission.has(fme.getPlayer(), %22factionsplus.clearlocks%22)) %7B%0A%09
 %09%09int cl
@@ -1092,16 +1092,17 @@
 , loc);%0A
+%09
 %09%09if( cl
@@ -1119,24 +1119,25 @@
  %3C 0 ) %7B%0A%09%09%09
+%09
 return;%0A%09%09%7D%0A
@@ -1134,18 +1134,20 @@
 turn;%0A%09%09
+%09
 %7D%0A
+%09
 %09%09if( cl
@@ -1166,16 +1166,17 @@
 = 0 ) %7B%0A
+%09
 %09%09%09name.
@@ -1262,24 +1262,25 @@
 k%22);%0A%09%09%09
+%09
 return;%0A
 %09%09%7D%0A%09%09na
@@ -1271,22 +1271,24 @@
 return;%0A
+%09
 %09%09%7D%0A%09%09
+%09
 name.sen
@@ -1387,16 +1387,20 @@
 hunk%22);%0A
+%09%09%7D%0A
 %09%09%0A%09%7D%0A%0A%7D

Add Permissions Check For ClearLocks Command