接口 IPermissionHandler

所有已知实现类:
DefaultPermissionHandler

public interface IPermissionHandler
This is the Heart of the PermissionAPI, it manages PermissionNodes as well as it handles all permission queries.

Note: You do not need to implement a PermissionHandler to query for permissions.

API Note:
You can implement your own PermissionHandler using the PermissionGatherEvent.Handler event.
Implementation Note:
The DefaultPermissionHandler does forward all permission queries to the PermissionNodes default resolver.
  • 方法详细资料

    • getIdentifier

      ResourceLocation getIdentifier()
      返回 an identifier for the PermissionHandler。
      返回:
      an identifier for the PermissionHandler
    • getRegisteredNodes

      Set<PermissionNode<?>> getRegisteredNodes()
      返回 an unmodifiable view of the collection of registered permission nodes。
      返回:
      an unmodifiable view of the collection of registered permission nodes
    • getPermission

      <T> T getPermission(ServerPlayer player, PermissionNode<T> node, PermissionDynamicContext<?>... context)
      Mods must use PermissionAPI.getPermission(ServerPlayer, PermissionNode, PermissionDynamicContext[])

      Queries a player's permission for a given node and contexts

      Warning: PermissionNodes must be registered using the PermissionGatherEvent.Nodes event before querying.

      类型参数:
      T - type of the queried PermissionNode
      参数:
      player - player for which you want to check permissions
      node - the PermissionNode for which you want to query
      context - optional array of PermissionDynamicContext, single entries will be ignored if they weren't registered to the node
      返回:
      a value of type <T>, that the combination of Player and PermissionNode map to.
    • getOfflinePermission

      <T> T getOfflinePermission(UUID player, PermissionNode<T> node, PermissionDynamicContext<?>... context)
      类型参数:
      T - type of the queried PermissionNode
      参数:
      player - offline player for which you want to check permissions
      node - the PermissionNode for which you want to query
      context - optional array of PermissionDynamicContext, single entries will be ignored if they weren't registered to the node
      返回:
      a value of type <T>, that the combination of Player and PermissionNode map to.