PermissionHelper

This project is abandoned and its default file will likely not work with the most recent version of Minecraft. Whether this project is out of date or its author has marked it as abandoned, this project is no longer maintained.

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();


Comments

Posts Quoted:
Reply
Clear All Quotes

About This Project

Categories

Members

Recent Files

Bukkit