public class PermissionAPI
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private static IPermissionHandler |
permissionHandler |
Constructor and Description |
---|
PermissionAPI() |
Modifier and Type | Method and Description |
---|---|
static IPermissionHandler |
getPermissionHandler() |
static boolean |
hasPermission(EntityPlayer player,
java.lang.String node)
Shortcut method using EntityPlayer and creating PlayerContext
|
static boolean |
hasPermission(com.mojang.authlib.GameProfile profile,
java.lang.String node,
IContext context) |
static java.lang.String |
registerNode(java.lang.String node,
DefaultPermissionLevel level,
java.lang.String desc)
Only use this after PreInit state!
|
static void |
setPermissionHandler(IPermissionHandler handler)
Only use this in PreInit state!
|
private static IPermissionHandler permissionHandler
public static void setPermissionHandler(IPermissionHandler handler)
public static IPermissionHandler getPermissionHandler()
public static java.lang.String registerNode(java.lang.String node, DefaultPermissionLevel level, java.lang.String desc)
node
- Permission node, best if it's lowercase and contains '.' (e.g. "modid.subgroup.permission_id"
)level
- Default permission level for this node. If not isn't registered, it's level is going to be 'NONE'desc
- Optional description of the nodepublic static boolean hasPermission(com.mojang.authlib.GameProfile profile, java.lang.String node, @Nullable IContext context)
profile
- GameProfile of the player who is requesting permission. The player doesn't have to be onlinenode
- Permission node. See registerNode(String, DefaultPermissionLevel, String)
context
- Context for this permission. Highly recommended to not be null. See IContext
DefaultPermissionHandler
public static boolean hasPermission(EntityPlayer player, java.lang.String node)