Created removeGroups method in permissions manager

This commit is contained in:
Tim Visée 2015-11-21 15:16:19 +01:00
parent bcf4eeab00
commit 462a2e9878

View File

@ -501,7 +501,7 @@ public class PermissionsManager {
}
/**
* Add the permission group of a player, if supported.
* Add the permission groups of a player, if supported.
*
* @param player The player
* @param groupNames The name of the groups to add.
@ -583,6 +583,31 @@ public class PermissionsManager {
}
}
/**
* Remove the permission groups of a player, if supported.
*
* @param player The player
* @param groupNames The name of the groups to add.
*
* @return True if succeed, false otherwise.
* False is also returned if this feature isn't supported for the current permissions system.
*/
@SuppressWarnings({"unchecked", "rawtypes", "deprecation"})
public boolean removeGroups(Player player, List<String> groupNames) {
// If no permissions system is used, return false
if(!isEnabled())
return false;
// Add each group to the user
boolean result = true;
for(String groupName : groupNames)
if(!removeGroup(player, groupName))
result = false;
// Return the result
return result;
}
/**
* Set the permission group of a player, if supported.
*