Class PermissionAPI
- java.lang.Object
-
- net.minecraftforge.server.permission.PermissionAPI
-
public class PermissionAPI extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description private static org.apache.logging.log4j.Logger
LOGGER
private static IPermissionHandler
permissionHandler
-
Constructor Summary
Constructors Constructor Description PermissionAPI()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static IPermissionHandler
getPermissionHandler()
static boolean
hasPermission(com.mojang.authlib.GameProfile profile, java.lang.String node, IContext context)
static boolean
hasPermission(PlayerEntity player, java.lang.String node)
Shortcut method using EntityPlayer and creating PlayerContextstatic 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!
-
-
-
Field Detail
-
LOGGER
private static final org.apache.logging.log4j.Logger LOGGER
-
permissionHandler
private static IPermissionHandler permissionHandler
-
-
Method Detail
-
setPermissionHandler
public static void setPermissionHandler(IPermissionHandler handler)
Only use this in PreInit state!
-
getPermissionHandler
public static IPermissionHandler getPermissionHandler()
-
registerNode
public static java.lang.String registerNode(java.lang.String node, DefaultPermissionLevel level, java.lang.String desc)
Only use this after PreInit state!- Parameters:
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 node
-
hasPermission
public static boolean hasPermission(com.mojang.authlib.GameProfile profile, java.lang.String node, @Nullable IContext context)
- Parameters:
profile
- GameProfile of the player who is requesting permission. The player doesn't have to be onlinenode
- Permission node. SeeregisterNode(String, DefaultPermissionLevel, String)
context
- Context for this permission. Highly recommended to not be null. SeeIContext
- Returns:
- true, if player has permission, false if he does not.
- See Also:
DefaultPermissionHandler
-
hasPermission
public static boolean hasPermission(PlayerEntity player, java.lang.String node)
Shortcut method using EntityPlayer and creating PlayerContext
-
-