/*
 * DefaultPermissionTester.java
 *
 * Copyright (c) 2014. Graham Howden <graham_howden1 at yahoo.co.uk>.
 *
 * This file is part of PluginFramework.
 *
 * PluginFramework is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * PluginFramework is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with PluginFramework.  If not, see <http ://www.gnu.org/licenses/>.
 */

package com.publicuhc.pluginframework.routing.tester;

import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;

import java.util.HashSet;

/**
 * A tester that allows the command based on the permissions of the sender
 */
public class PermissionTester extends HashSet<String> implements CommandTester
{
    boolean matchingAll = false;

    public boolean isMatchingAll()
    {
        return matchingAll;
    }

    public void setMatchingAll(boolean matching)
    {
        matchingAll = matching;
    }

    @Override
    public boolean testCommand(Command command, CommandSender sender, String[] args)
    {
        //check permissions
        for(String permission : this) {
            if(sender.hasPermission(permission)) {
                if(!matchingAll) {
                    break;
                }
            } else {
                sender.sendMessage(ChatColor.RED + "You do not have permission to run this command. (" + permission + ")");
                return false;
            }
        }
        return true;
    }
}

@@ -1187,20 +1187,19 @@
 ngAll = 
-fals
+tru
 e;%0A%0A    
@@ -1549,19 +1549,35 @@
         
-if(
+boolean matching = 
 sender.h
@@ -1600,22 +1600,18 @@
 mission)
-) %7B%0A  
+;%0A
         
@@ -1618,14 +1618,11 @@
     
-  
 if(
-!
 matc
@@ -1632,75 +1632,22 @@
 gAll
-) %7B%0A                    break;%0A                %7D%0A            %7D else
+ && !matching)
  %7B%0A 
@@ -1769,16 +1769,16 @@
 + %22)%22);%0A
-
         
@@ -1805,32 +1805,112 @@
 ;%0A            %7D%0A
+            if(!matchingAll && matching) %7B%0A                break;%0A            %7D%0A
         %7D%0A      

fix the logic