mirror of
https://github.com/EssentialsX/Essentials.git
synced 2024-11-07 19:40:23 +01:00
Merge pull request #46 from krinsdeath/master
Added Privileges to known Permissions plugins
This commit is contained in:
commit
bbc6da5106
@ -76,6 +76,7 @@ file.reference.MultiCurrency.jar=../lib/MultiCurrency.jar
|
||||
file.reference.Permissions3.jar=../lib/Permissions3.jar
|
||||
file.reference.PermissionsBukkit-1.2.jar=../lib/PermissionsBukkit-1.2.jar
|
||||
file.reference.PermissionsEx.jar=../lib/PermissionsEx.jar
|
||||
file.reference.Privileges.jar=..\\lib\\Privileges.jar
|
||||
file.reference.Vault.jar=../lib/Vault.jar
|
||||
includes=**
|
||||
jar.archive.disabled=${jnlp.enabled}
|
||||
@ -95,7 +96,8 @@ javac.classpath=\
|
||||
${reference.EssentialsGroupManager.jar}:\
|
||||
${file.reference.bukkit.jar}:\
|
||||
${file.reference.craftbukkit.jar}:\
|
||||
${file.reference.Vault.jar}
|
||||
${file.reference.Vault.jar}:\
|
||||
${file.reference.Privileges.jar}
|
||||
# Space-separated list of extra javac options
|
||||
javac.compilerargs=
|
||||
javac.deprecation=false
|
||||
|
@ -144,6 +144,17 @@ public class PermissionsHandler implements IPermissionsHandler
|
||||
return;
|
||||
}
|
||||
|
||||
final Plugin privPlugin = pluginManager.getPlugin("Privileges");
|
||||
if (privPlugin != null && privPlugin.isEnabled())
|
||||
{
|
||||
if (!(handler instanceof PrivilegesHandler))
|
||||
{
|
||||
LOGGER.log(Level.INFO, "Essentials: Using Privileges based permissions.");
|
||||
handler = new PrivilegesHandler(privPlugin);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
final Plugin permPlugin = pluginManager.getPlugin("Permissions");
|
||||
if (permPlugin != null && permPlugin.isEnabled())
|
||||
{
|
||||
|
@ -0,0 +1,61 @@
|
||||
package com.earth2me.essentials.perm;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import net.krinsoft.privileges.Privileges;
|
||||
import net.krinsoft.privileges.groups.Group;
|
||||
import net.krinsoft.privileges.groups.GroupManager;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
public class PrivilegesHandler extends SuperpermsHandler
|
||||
{
|
||||
private final transient Privileges plugin;
|
||||
private final GroupManager manager;
|
||||
|
||||
public PrivilegesHandler(final Plugin plugin)
|
||||
{
|
||||
this.plugin = (Privileges) plugin;
|
||||
this.manager = this.plugin.getGroupManager();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getGroup(final Player base)
|
||||
{
|
||||
Group group = manager.getGroup(base);
|
||||
if (group == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return group.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getGroups(final Player base)
|
||||
{
|
||||
Group group = manager.getGroup(base);
|
||||
if (group == null)
|
||||
{
|
||||
return new ArrayList<String>();
|
||||
}
|
||||
return group.getGroupTree();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean inGroup(final Player base, final String group)
|
||||
{
|
||||
Group pGroup = manager.getGroup(base);
|
||||
if (pGroup == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return pGroup.isMemberOf(group);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBuild(Player base, String group)
|
||||
{
|
||||
return base.hasPermission("essentials.build") || base.hasPermission("privileges.build");
|
||||
}
|
||||
|
||||
}
|
BIN
lib/Privileges.jar
Normal file
BIN
lib/Privileges.jar
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user