diff --git a/pom.xml b/pom.xml
index f7fe4fb4..0a2e60c2 100644
--- a/pom.xml
+++ b/pom.xml
@@ -130,6 +130,11 @@
PermissionsBukkit
1.6
+
+ org.anjocaido
+ EssentialsGroupManager
+ 2.10.1
+
1.7
diff --git a/src/main/java/org/dynmap/bukkit/DynmapPlugin.java b/src/main/java/org/dynmap/bukkit/DynmapPlugin.java
index 1be44f52..ea603f22 100644
--- a/src/main/java/org/dynmap/bukkit/DynmapPlugin.java
+++ b/src/main/java/org/dynmap/bukkit/DynmapPlugin.java
@@ -82,6 +82,7 @@ import org.dynmap.bukkit.permissions.NijikokunPermissions;
import org.dynmap.bukkit.permissions.OpPermissions;
import org.dynmap.bukkit.permissions.PEXPermissions;
import org.dynmap.bukkit.permissions.PermBukkitPermissions;
+import org.dynmap.bukkit.permissions.GroupManagerPermissions;
import org.dynmap.bukkit.permissions.PermissionProvider;
import org.dynmap.bukkit.permissions.bPermPermissions;
import org.dynmap.common.BiomeMap;
@@ -724,6 +725,8 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
permissions = PEXPermissions.create(getServer(), "dynmap");
if (permissions == null)
permissions = bPermPermissions.create(getServer(), "dynmap", perdefs);
+ if (permissions == null)
+ permissions = GroupManagerPermissions.create(getServer(), "dynmap");
if (permissions == null)
permissions = PermBukkitPermissions.create(getServer(), "dynmap", perdefs);
if (permissions == null)
diff --git a/src/main/java/org/dynmap/bukkit/permissions/GroupManagerPermissions.java b/src/main/java/org/dynmap/bukkit/permissions/GroupManagerPermissions.java
new file mode 100644
index 00000000..d1b9c424
--- /dev/null
+++ b/src/main/java/org/dynmap/bukkit/permissions/GroupManagerPermissions.java
@@ -0,0 +1,64 @@
+package org.dynmap.bukkit.permissions;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.bukkit.Server;
+import org.bukkit.command.CommandSender;
+import org.bukkit.entity.Player;
+import org.bukkit.plugin.Plugin;
+import org.dynmap.Log;
+import org.anjocaido.groupmanager.GroupManager;
+import org.anjocaido.groupmanager.dataholder.worlds.WorldsHolder;
+import org.anjocaido.groupmanager.permissions.AnjoPermissionsHandler;
+
+public class GroupManagerPermissions implements PermissionProvider {
+ String name;
+ GroupManager gm;
+ WorldsHolder wh;
+
+ public static GroupManagerPermissions create(Server server, String name) {
+ Plugin permissionsPlugin = server.getPluginManager().getPlugin("GroupManager");
+ if (permissionsPlugin == null)
+ return null;
+ server.getPluginManager().enablePlugin(permissionsPlugin);
+ if(permissionsPlugin.isEnabled() == false)
+ return null;
+ Log.info("Using GroupManager " + permissionsPlugin.getDescription().getVersion() + " for access control");
+ return new GroupManagerPermissions(name, permissionsPlugin);
+ }
+
+ public GroupManagerPermissions(String name, Plugin permissionsPlugin) {
+ this.name = name;
+ gm = (GroupManager)permissionsPlugin;
+ wh = gm.getWorldsHolder();
+ }
+
+ @Override
+ public boolean has(CommandSender sender, String permission) {
+ Player player = sender instanceof Player ? (Player) sender : null;
+ return (player != null) ? wh.getWorldPermissions(player).has(player, name + "." + permission) : true;
+ }
+
+ @Override
+ public Set hasOfflinePermissions(String player, Set perms) {
+ HashSet hasperms = new HashSet();
+ AnjoPermissionsHandler apm = wh.getWorldPermissionsByPlayerName(player);
+ if (apm != null) {
+ for (String pp : perms) {
+ if (apm.permission(player, name + "." + pp)) {
+ hasperms.add(pp);
+ }
+ }
+ }
+ return hasperms;
+ }
+ @Override
+ public boolean hasOfflinePermission(String player, String perm) {
+ AnjoPermissionsHandler apm = wh.getWorldPermissionsByPlayerName(player);
+ if(apm != null) {
+ return apm.permission(player, name + "." + perm);
+ }
+ return false;
+ }
+}