PermissionHelper
PermissionHelper is designed to help developers support all permission plugins without forcing them to write separate methods for each one of them. It automaticlly hooks into any permission plugin when its enabled, itll work even if no permission plugin is found (defaulting to superperms). You can also get a list of groups a user is a member of or get a list of all groups.
Currently supports bPermissions, Permissions, PermissionsBukkit and PermissionsEx! (Some methods will return null if the permission plugin doesnt support it or isnt found)
How to hook into PermissionHelper (after adding PermissionHelper.jar to the build path):
import com.vildaberper.PermissionHelper.PermissionHelper;
public class MyPlugin extends JavaPlugin{
public static PermissionHelper ph;
@Override
public void onEnable(){
if(getServer().getPluginManager().getPlugin("PermissionHelper") != null && getServer().getPluginManager().getPlugin("PermissionHelper").isEnabled()){
MyPlugin.ph = (PermissionHelper) Bukkit.getPluginManager().getPlugin("PermissionHelper");
}
}
}
How to check if a player has permission:
if(MyPlugin.ph.hasPermission(player.getWorld().getName(), player, "myplugin.some.node")){
User has permission
}else{
Nope.avi
}
How to get all groups:
(you have to cast the object if you need it as Group, String or PermissionGroup)
List<Object> groups = MyPlugin.ph.getAllGroups(world.getName());
How to get all groups as strings (only the names):
List<String> groups = MyPlugin.ph.getAllGroupsString(world.getName());
You can also get the groups a user is a member of:
List<Object> groups = MyPlugin.ph.getAllGroups(world.getName(), player.getName());
and
List<String> groups = MyPlugin.ph.getAllGroupsString(world.getName(), player.getName());
How to get the permission plugin that PermissionHelper is hooked into (will return null if no permission plugin was found):
Plugin plugin = MyPlugin.ph.getPlugin();
I upgraded it to 1.7.2 for craftbukkit from source. Link Removed: http://www.mediafire.com/download/xrw2bwxljoixi9b/PermissionsHelper.jar
This is a duplicate of Vault, WEPIF and various other systems people have written for their plugins. Why?
Look at this
@mrvertigo27
Yeah, the name is the only thing I dont like with it. xD Im pretty surprised this is the first of its kind though.
interesting concept.... i would have taken the name permissionary but I like the concept!
@Hildcroft
Exactly, if I understood Register correctly. :)
So just like Register, but with permissions plugins?