类 Permission

java.lang.Object
org.bukkit.permissions.Permission

public class Permission extends Object
代表一个可以附加到Permissible的唯一权限
  • 字段详细资料

  • 构造器详细资料

  • 方法详细资料

    • getName

      @NotNull public @NotNull String getName()
      返回此权限的唯一完全限定名称.

      原文: Returns the unique fully qualified name of this Permission

      返回:
      完全限定名称
    • getChildren

      @NotNull public @NotNull Map<String,Boolean> getChildren()
      获取此权限的子权限.

      如果你以任何形式更改此映射, 必须调用recalculatePermissibles()来重新计算所有Permissible

      原文: Gets the children of this permission.

      If you change this map in any form, you must call recalculatePermissibles() to recalculate all Permissibles

      返回:
      权限子项
    • getDefault

      @NotNull public @NotNull PermissionDefault getDefault()
      获取此权限的默认值.

      原文: Gets the default value of this permission.

      返回:
      此权限的默认值.
    • setDefault

      public void setDefault(@NotNull @NotNull PermissionDefault value)
      设置此权限的默认值.

      这不会保存到磁盘, 是服务器重新加载权限之前的临时操作. 更改此默认值将导致所有包含此权限的Permissible重新计算其权限.

      原文: Sets the default value of this permission.

      This will not be saved to disk, and is a temporary operation until the server reloads permissions. Changing this default will cause all Permissibles that contain this permission to recalculate their permissions

      参数:
      value - 要设置的新默认值
    • getDescription

      @NotNull public @NotNull String getDescription()
      获取此权限的简要描述, 可能为空.

      原文: Gets a brief description of this permission, may be empty

      返回:
      此权限的简要描述
    • setDescription

      public void setDescription(@Nullable @Nullable String value)
      设置此权限的描述.

      这不会保存到磁盘, 是服务器重新加载权限之前的临时操作.

      原文: Sets the description of this permission.

      This will not be saved to disk, and is a temporary operation until the server reloads permissions.

      参数:
      value - 要设置的新描述
    • getPermissibles

      @NotNull public @NotNull Set<Permissible> getPermissibles()
      获取包含此权限的每个Permissible的集合.

      此集合不能被修改.

      原文: Gets a set containing every Permissible that has this permission.

      This set cannot be modified.

      返回:
      包含拥有此权限的可权限对象的集合
    • recalculatePermissibles

      public void recalculatePermissibles()
      重新计算所有包含此权限的Permissible.

      在修改子项后应调用此方法, 在修改默认值后会自动调用.

      原文: Recalculates all Permissibles that contain this permission.

      This should be called after modifying the children, and is automatically called after modifying the default value

    • addParent

      @NotNull public @NotNull Permission addParent(@NotNull @NotNull String name, boolean value)
      将此权限添加到指定的父权限.

      如果父权限不存在, 将被创建并注册.

      原文: Adds this permission to the specified parent permission.

      If the parent permission does not exist, it will be created and registered.

      参数:
      name - 父权限名称
      value - 设置此权限的值
      返回:
      创建或加载的父权限
    • addParent

      public void addParent(@NotNull @NotNull Permission perm, boolean value)
      将此权限添加到指定的父权限.

      原文: Adds this permission to the specified parent permission.

      参数:
      perm - 要注册的父权限
      value - 设置此权限的值
    • loadPermissions

      @NotNull public static @NotNull List<Permission> loadPermissions(@NotNull @NotNull Map<?,?> data, @NotNull @NotNull String error, @Nullable @Nullable PermissionDefault def)
      从数据映射加载权限列表, 通常用于从yaml文件中检索.

      数据可能包含name:data列表, 其中data包含以下键:

      • default: Boolean true或false. 如果未指定则为false.
      • children: 子权限的Map<String, Boolean>. 如果未指定则为空列表.
      • description: 包含此描述的简短字符串. 如果未指定则为空字符串.

      原文: Loads a list of Permissions from a map of data, usually used from retrieval from a yaml file.

      The data may contain a list of name:data, where the data contains the following keys:

      • default: Boolean true or false. If not specified, false.
      • children: Map<String, Boolean> of child permissions. If not specified, empty list.
      • description: Short string containing a very small description of this description. If not specified, empty string.
      参数:
      data - 权限映射
      error - 如果权限无效时显示的错误消息. 可能包含"%s"格式标签, 将被替换为无效权限的名称.
      def - 如果缺失则使用的默认权限值
      返回:
      Permission对象
    • loadPermission

      @NotNull public static @NotNull Permission loadPermission(@NotNull @NotNull String name, @NotNull @NotNull Map<String,Object> data)
      从数据映射加载一个权限, 通常用于从 yaml 文件中检索.

      数据可能包含以下键:

      • default: Boolean true 或 false. 如果未指定则为 false.
      • children: 子权限的 Map<String, Boolean>. 如果未指定则为空列表.
      • description: 包含此权限简要描述的短字符串. 如果未指定则为空字符串.

      原文:Loads a Permission from a map of data, usually used from retrieval from a yaml file.

      The data may contain the following keys:

      • default: Boolean true or false. If not specified, false.
      • children: Map<String, Boolean> of child permissions. If not specified, empty list.
      • description: Short string containing a very small description of this description. If not specified, empty string.
      参数:
      name - 权限名称
      data - 键映射
      返回:
      Permission 对象
    • loadPermission

      从数据映射加载一个权限, 通常用于从 yaml 文件中检索.

      数据可能包含以下键:

      • default: Boolean true 或 false. 如果未指定则为 false.
      • children: 子权限的 Map<String, Boolean>. 如果未指定则为空列表.
      • description: 包含此权限简要描述的短字符串. 如果未指定则为空字符串.

      原文:Loads a Permission from a map of data, usually used from retrieval from a yaml file.

      The data may contain the following keys:

      • default: Boolean true or false. If not specified, false.
      • children: Map<String, Boolean> of child permissions. If not specified, empty list.
      • description: Short string containing a very small description of this description. If not specified, empty string.
      参数:
      name - 权限名称
      data - 键映射
      def - 如果未设置则使用的默认权限值
      output - 用于追加创建的子权限的列表, 可以为 null
      返回:
      Permission 对象