mirror of
https://github.com/EssentialsX/Essentials.git
synced 2024-12-27 03:28:30 +01:00
Workaround for the crippled bukkit permissions.
Splits the node at . and checks for * permissions on all levels.
This commit is contained in:
parent
3d232e13d9
commit
d2bc7e01a2
@ -5,7 +5,6 @@ import org.bukkit.entity.Player;
|
||||
|
||||
public class BukkitPermissionsHandler implements IPermissionsHandler
|
||||
{
|
||||
|
||||
public String getGroup(Player base)
|
||||
{
|
||||
return "default";
|
||||
@ -23,6 +22,20 @@ public class BukkitPermissionsHandler implements IPermissionsHandler
|
||||
|
||||
public boolean hasPermission(Player base, String node)
|
||||
{
|
||||
if (base.hasPermission("-" + node))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
final String[] parts = node.split("\\.");
|
||||
final StringBuilder sb = new StringBuilder();
|
||||
for (String part : parts)
|
||||
{
|
||||
if (base.hasPermission(sb.toString() + "*"))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
sb.append(part).append(".");
|
||||
}
|
||||
return base.hasPermission(node);
|
||||
}
|
||||
|
||||
@ -35,5 +48,4 @@ public class BukkitPermissionsHandler implements IPermissionsHandler
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user