diff --git a/Essentials/src/main/java/com/earth2me/essentials/perm/IPermissionsHandler.java b/Essentials/src/main/java/com/earth2me/essentials/perm/IPermissionsHandler.java index 707be09c8..10ab3627d 100644 --- a/Essentials/src/main/java/com/earth2me/essentials/perm/IPermissionsHandler.java +++ b/Essentials/src/main/java/com/earth2me/essentials/perm/IPermissionsHandler.java @@ -14,6 +14,8 @@ public interface IPermissionsHandler { List getGroups(Player base); + List getGroups(); + boolean canBuild(Player base, String group); boolean inGroup(Player base, String group); diff --git a/Essentials/src/main/java/com/earth2me/essentials/perm/PermissionsHandler.java b/Essentials/src/main/java/com/earth2me/essentials/perm/PermissionsHandler.java index 722c55a9a..ce949344e 100644 --- a/Essentials/src/main/java/com/earth2me/essentials/perm/PermissionsHandler.java +++ b/Essentials/src/main/java/com/earth2me/essentials/perm/PermissionsHandler.java @@ -55,6 +55,17 @@ public class PermissionsHandler implements IPermissionsHandler { return Collections.unmodifiableList(groups); } + @Override + public List getGroups() { + final long start = System.nanoTime(); + List 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); diff --git a/Essentials/src/main/java/com/earth2me/essentials/perm/impl/AbstractVaultHandler.java b/Essentials/src/main/java/com/earth2me/essentials/perm/impl/AbstractVaultHandler.java index 9f2777f7d..89621a100 100644 --- a/Essentials/src/main/java/com/earth2me/essentials/perm/impl/AbstractVaultHandler.java +++ b/Essentials/src/main/java/com/earth2me/essentials/perm/impl/AbstractVaultHandler.java @@ -41,6 +41,11 @@ public abstract class AbstractVaultHandler extends SuperpermsHandler { return Arrays.asList(perms.getPlayerGroups(base)); } + @Override + public List getGroups() { + return Arrays.asList(perms.getGroups()); + } + @Override public boolean inGroup(final Player base, final String group) { return perms.playerInGroup(base, group); diff --git a/Essentials/src/main/java/com/earth2me/essentials/perm/impl/SuperpermsHandler.java b/Essentials/src/main/java/com/earth2me/essentials/perm/impl/SuperpermsHandler.java index 1e285b8bb..73679611d 100644 --- a/Essentials/src/main/java/com/earth2me/essentials/perm/impl/SuperpermsHandler.java +++ b/Essentials/src/main/java/com/earth2me/essentials/perm/impl/SuperpermsHandler.java @@ -30,6 +30,11 @@ public class SuperpermsHandler implements IPermissionsHandler { return null; } + @Override + public List getGroups() { + return null; + } + @Override public boolean canBuild(final Player base, final String group) { return hasPermission(base, "essentials.build");