mirror of
https://github.com/EssentialsX/Essentials.git
synced 2024-12-22 09:08:01 +01:00
Add IPermissionsHandler#getGroups to fetch all groups
This commit is contained in:
parent
939e5c5a55
commit
e6af246170
@ -14,6 +14,8 @@ public interface IPermissionsHandler {
|
||||
|
||||
List<String> getGroups(Player base);
|
||||
|
||||
List<String> getGroups();
|
||||
|
||||
boolean canBuild(Player base, String group);
|
||||
|
||||
boolean inGroup(Player base, String group);
|
||||
|
@ -55,6 +55,17 @@ public class PermissionsHandler implements IPermissionsHandler {
|
||||
return Collections.unmodifiableList(groups);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getGroups() {
|
||||
final long start = System.nanoTime();
|
||||
List<String> groups = handler.getGroups();
|
||||
if (groups == null || groups.isEmpty()) {
|
||||
groups = Collections.singletonList(defaultGroup);
|
||||
}
|
||||
checkPermLag(start, "Getting all groups");
|
||||
return Collections.unmodifiableList(groups);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBuild(final Player base, final String group) {
|
||||
return handler.canBuild(base, group);
|
||||
|
@ -41,6 +41,11 @@ public abstract class AbstractVaultHandler extends SuperpermsHandler {
|
||||
return Arrays.asList(perms.getPlayerGroups(base));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getGroups() {
|
||||
return Arrays.asList(perms.getGroups());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean inGroup(final Player base, final String group) {
|
||||
return perms.playerInGroup(base, group);
|
||||
|
@ -30,6 +30,11 @@ public class SuperpermsHandler implements IPermissionsHandler {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getGroups() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBuild(final Player base, final String group) {
|
||||
return hasPermission(base, "essentials.build");
|
||||
|
Loading…
Reference in New Issue
Block a user