类 PermissionAPI
java.lang.Object
net.neoforged.neoforge.server.permission.PermissionAPI
-
字段概要
字段 -
构造器概要
构造器 -
方法概要
修饰符和类型方法说明static @Nullable ResourceLocation
static <T> T
getOfflinePermission
(UUID player, PermissionNode<T> node, PermissionDynamicContext<?>... context) static <T> T
getPermission
(ServerPlayer player, PermissionNode<T> node, PermissionDynamicContext<?>... context) Queries a player's permission for a given node and contextsstatic Collection
<PermissionNode<?>> static void
Helper method for internal use only!
-
字段详细资料
-
LOGGER
private static final org.apache.logging.log4j.Logger LOGGER -
activeHandler
-
-
构造器详细资料
-
PermissionAPI
private PermissionAPI()
-
-
方法详细资料
-
getRegisteredNodes
-
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 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- 返回:
- 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 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- 返回:
- 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.
-