diff --git a/pom.xml b/pom.xml
index 52e088e98..530d7f142 100644
--- a/pom.xml
+++ b/pom.xml
@@ -31,7 +31,7 @@
com.sk89q
dummypermscompat
- 1.1
+ 1.2
diff --git a/src/main/java/com/sk89q/bukkit/migration/ConfigurationPermissionsResolver.java b/src/main/java/com/sk89q/bukkit/migration/ConfigurationPermissionsResolver.java
index 50185d3cb..ffd02e20b 100644
--- a/src/main/java/com/sk89q/bukkit/migration/ConfigurationPermissionsResolver.java
+++ b/src/main/java/com/sk89q/bukkit/migration/ConfigurationPermissionsResolver.java
@@ -109,7 +109,12 @@ public class ConfigurationPermissionsResolver implements PermissionsResolver {
return perms.contains("*") || perms.contains(permission);
}
-
+
+ public boolean hasPermission(String worldName, String player, String permission) {
+ return hasPermission(player, "worlds." + worldName + "." + permission)
+ || hasPermission(player, permission);
+ }
+
public boolean inGroup(String player, String group) {
Set groups = userGroups.get(player.toLowerCase());
if (groups == null) {
diff --git a/src/main/java/com/sk89q/bukkit/migration/FlatFilePermissionsResolver.java b/src/main/java/com/sk89q/bukkit/migration/FlatFilePermissionsResolver.java
index 1484117eb..131cd2cbd 100644
--- a/src/main/java/com/sk89q/bukkit/migration/FlatFilePermissionsResolver.java
+++ b/src/main/java/com/sk89q/bukkit/migration/FlatFilePermissionsResolver.java
@@ -168,7 +168,12 @@ public class FlatFilePermissionsResolver implements PermissionsResolver {
return perms.contains("*") || perms.contains(permission);
}
-
+
+ public boolean hasPermission(String worldName, String player, String permission) {
+ return hasPermission(player, "worlds." + worldName + "." + permission)
+ || hasPermission(player, permission);
+ }
+
public boolean inGroup(String player, String group) {
Set groups = userGroups.get(player.toLowerCase());
if (groups == null) {
diff --git a/src/main/java/com/sk89q/bukkit/migration/NijiPermissionsResolver.java b/src/main/java/com/sk89q/bukkit/migration/NijiPermissionsResolver.java
index 32d12e032..3218ddad0 100644
--- a/src/main/java/com/sk89q/bukkit/migration/NijiPermissionsResolver.java
+++ b/src/main/java/com/sk89q/bukkit/migration/NijiPermissionsResolver.java
@@ -20,6 +20,7 @@
package com.sk89q.bukkit.migration;
import org.bukkit.Server;
+import org.bukkit.World;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.PluginManager;
@@ -66,6 +67,15 @@ public class NijiPermissionsResolver implements PermissionsResolver {
}
}
+ public boolean hasPermission(String worldName, String name, String permission) {
+ try {
+ return api.getHandler().has(worldName, name, permission);
+ } catch (Throwable t) {
+ t.printStackTrace();
+ return false;
+ }
+ }
+
@SuppressWarnings({ "static-access" })
public boolean inGroup(String name, String group) {
try {
diff --git a/src/main/java/com/sk89q/bukkit/migration/PermissionsProvider.java b/src/main/java/com/sk89q/bukkit/migration/PermissionsProvider.java
index b332d7f6a..a95f9324d 100644
--- a/src/main/java/com/sk89q/bukkit/migration/PermissionsProvider.java
+++ b/src/main/java/com/sk89q/bukkit/migration/PermissionsProvider.java
@@ -21,6 +21,7 @@ package com.sk89q.bukkit.migration;
public interface PermissionsProvider {
public boolean hasPermission(String name, String permission);
+ public boolean hasPermission(String worldName, String name, String permission);
public boolean inGroup(String player, String group);
public String[] getGroups(String player);
}
diff --git a/src/main/java/com/sk89q/bukkit/migration/PermissionsResolver.java b/src/main/java/com/sk89q/bukkit/migration/PermissionsResolver.java
index 3c3cf41ec..6544bb01e 100644
--- a/src/main/java/com/sk89q/bukkit/migration/PermissionsResolver.java
+++ b/src/main/java/com/sk89q/bukkit/migration/PermissionsResolver.java
@@ -22,6 +22,7 @@ package com.sk89q.bukkit.migration;
public interface PermissionsResolver {
public void load();
public boolean hasPermission(String name, String permission);
+ public boolean hasPermission(String worldName, String name, String permission);
public boolean inGroup(String player, String group);
public String[] getGroups(String player);
}
diff --git a/src/main/java/com/sk89q/bukkit/migration/PermissionsResolverManager.java b/src/main/java/com/sk89q/bukkit/migration/PermissionsResolverManager.java
index 2336134ab..487a956f9 100644
--- a/src/main/java/com/sk89q/bukkit/migration/PermissionsResolverManager.java
+++ b/src/main/java/com/sk89q/bukkit/migration/PermissionsResolverManager.java
@@ -102,6 +102,10 @@ public class PermissionsResolverManager implements PermissionsResolver {
return perms.hasPermission(name, permission);
}
+ public boolean hasPermission(String worldName, String name, String permission) {
+ return perms.hasPermission(worldName, name, permission);
+ }
+
public boolean inGroup(String player, String group) {
return perms.inGroup(player, group);
}
diff --git a/src/main/java/com/sk89q/bukkit/migration/PluginPermissionsResolver.java b/src/main/java/com/sk89q/bukkit/migration/PluginPermissionsResolver.java
index 48956736d..602a5ac2f 100644
--- a/src/main/java/com/sk89q/bukkit/migration/PluginPermissionsResolver.java
+++ b/src/main/java/com/sk89q/bukkit/migration/PluginPermissionsResolver.java
@@ -34,6 +34,10 @@ public class PluginPermissionsResolver implements PermissionsResolver {
return resolver.hasPermission(name, permission);
}
+ public boolean hasPermission(String worldName, String name, String permission) {
+ return resolver.hasPermission(worldName, name, permission);
+ }
+
public boolean inGroup(String player, String group) {
return resolver.inGroup(player, group);
}
diff --git a/src/main/java/com/sk89q/worldedit/bukkit/BukkitPlayer.java b/src/main/java/com/sk89q/worldedit/bukkit/BukkitPlayer.java
index c655bf7c0..753386b57 100644
--- a/src/main/java/com/sk89q/worldedit/bukkit/BukkitPlayer.java
+++ b/src/main/java/com/sk89q/worldedit/bukkit/BukkitPlayer.java
@@ -109,7 +109,8 @@ public class BukkitPlayer extends LocalPlayer {
@Override
public boolean hasPermission(String perm) {
return (!plugin.getLocalConfiguration().noOpPermissions && player.isOp())
- || plugin.getPermissionsResolver().hasPermission(player.getName(), perm);
+ || plugin.getPermissionsResolver().hasPermission(
+ player.getWorld().getName(), player.getName(), perm);
}
@Override