geforkt von Mirrors/FastAsyncWorldEdit
Added multiworld permissions support to WEPIF
Dieser Commit ist enthalten in:
Ursprung
08c8a5ab23
Commit
c21357de28
2
pom.xml
2
pom.xml
@ -31,7 +31,7 @@
|
||||
<dependency>
|
||||
<groupId>com.sk89q</groupId>
|
||||
<artifactId>dummypermscompat</artifactId>
|
||||
<version>1.1</version>
|
||||
<version>1.2</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Bukkit -->
|
||||
|
@ -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<String> groups = userGroups.get(player.toLowerCase());
|
||||
if (groups == null) {
|
||||
|
@ -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<String> groups = userGroups.get(player.toLowerCase());
|
||||
if (groups == null) {
|
||||
|
@ -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 {
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren