Class PermissionAPI
java.lang.Object
net.neoforged.neoforge.server.permission.PermissionAPI
- 
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static IPermissionHandlerprivate static final org.apache.logging.log4j.Logger - 
Constructor Summary
Constructors - 
Method Summary
Modifier and TypeMethodDescriptionstatic @Nullable ResourceLocationstatic <T> TgetOfflinePermission(UUID player, PermissionNode<T> node, PermissionDynamicContext<?>... context) static <T> TgetPermission(ServerPlayer player, PermissionNode<T> node, PermissionDynamicContext<?>... context) Queries a player's permission for a given node and contextsstatic Collection<PermissionNode<?>>static voidHelper method for internal use only! 
- 
Field Details
- 
LOGGER
private static final org.apache.logging.log4j.Logger LOGGER - 
activeHandler
 
 - 
 - 
Constructor Details
- 
PermissionAPI
private PermissionAPI() 
 - 
 - 
Method Details
- 
getRegisteredNodes
 - 
getActivePermissionHandler
- Returns:
 - the Identifier of the currently active permission handler
 
 - 
getPermission
public static <T> T getPermission(ServerPlayer player, PermissionNode<T> node, PermissionDynamicContext<?>... context) Queries a player's permission for a given node and contexts
Warning: PermissionNodes must be registered using the
PermissionGatherEvent.Nodesevent before querying.- Type Parameters:
 T- type of the queried PermissionNode- Parameters:
 player- player for which you want to check permissionsnode- the PermissionNode for which you want to querycontext- optional array of PermissionDynamicContext, single entries will be ignored if they weren't registered to the node- Returns:
 - a value of type 
<T>, that the combination of Player and PermissionNode map to, defaults to the PermissionNodes default handler. - Throws:
 UnregisteredPermissionException- when the PermissionNode wasn't registered properly
 - 
getOfflinePermission
public static <T> T getOfflinePermission(UUID player, PermissionNode<T> node, PermissionDynamicContext<?>... context) - Type Parameters:
 T- type of the queried PermissionNode- Parameters:
 player- offline player for which you want to check permissionsnode- the PermissionNode for which you want to querycontext- optional array of PermissionDynamicContext, single entries will be ignored if they weren't registered to the node- Returns:
 - a value of type 
<T>, that the combination of Player and PermissionNode map to, defaults to the PermissionNodes default handler. - Throws:
 UnregisteredPermissionException- when the PermissionNode wasn't registered properly
 - 
initializePermissionAPI
public static void initializePermissionAPI()Helper method for internal use only!
Initializes the active permission handler based on the users config.
 
 -