#761 Restore permission group in sync with limbo players

- Couple AuthGroupHandler closer to the LimboService: whenever a limbo player is restored, the auth group should be restored as well. This fixes some consistency issues.
- Move AuthGroupHandler into limbo package and make it package-private
- Change permission handler to skip any empty groups (prevents odd command output e.g. for BukkitPermissions)
This commit is contained in:
ljacqu
2017-04-29 22:37:34 +02:00
parent d4c1370da6
commit e0e4cd112d
15 changed files with 47 additions and 104 deletions
@@ -342,19 +342,20 @@ public class PermissionsManager implements Reloadable {
* @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.
* @return True if at least one group was removed, false otherwise.
* False is also returned if this feature isn't supported for the current permissions system.
*/
public boolean removeGroups(Player player, String... groupNames) {
// If no permissions system is used, return false
if (!isEnabled())
if (!isEnabled()) {
return false;
}
// Add each group to the user
boolean result = true;
boolean result = false;
for (String groupName : groupNames) {
if (!handler.removeFromGroup(player, groupName)) {
result = false;
if (!groupName.isEmpty()) {
result |= handler.removeFromGroup(player, groupName);
}
}