Created removeAllGroups method in permissions manager

This commit is contained in:
Tim Visée 2015-11-21 15:34:38 +01:00
parent f7f455a56a
commit 1091db0e15

View File

@ -711,6 +711,28 @@ public class PermissionsManager {
return result; return result;
} }
/**
* Remove all groups of the specified player, if supported.
* Systems like Essentials GroupManager don't allow all groups to be removed from a player, thus the user will stay
* in it's primary group. All the subgroups are removed just fine.
*
* @param player The player to remove all groups from.
*
* @return True if succeed, false otherwise.
* False will also be returned if this feature isn't supported for the used permissions system.
*/
public boolean removeAllGroups(Player player) {
// If no permissions system is used, return false
if(!isEnabled())
return false;
// Get a list of current groups
List<String> groupNames = getGroups(player);
// Remove each group
return removeGroups(player, groupNames);
}
public enum PermissionsSystemType { public enum PermissionsSystemType {
NONE("None"), NONE("None"),
PERMISSIONS_EX("PermissionsEx"), PERMISSIONS_EX("PermissionsEx"),