类 PermissionAPI

java.lang.Object
net.neoforged.neoforge.server.permission.PermissionAPI

public final class PermissionAPI extends Object
  • 字段详细资料

    • LOGGER

      private static final org.apache.logging.log4j.Logger LOGGER
    • activeHandler

      private static IPermissionHandler activeHandler
  • 构造器详细资料

    • PermissionAPI

      private PermissionAPI()
  • 方法详细资料

    • getRegisteredNodes

      public static Collection<PermissionNode<?>> getRegisteredNodes()
    • getActivePermissionHandler

      @Nullable public static @Nullable ResourceLocation getActivePermissionHandler()
      返回:
      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.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, defaults to the PermissionNodes default handler.
      抛出:
      UnregisteredPermissionException - when the PermissionNode wasn't registered properly
    • getOfflinePermission

      public static <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, defaults to the PermissionNodes default handler.
      抛出:
      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.