程序包 org.bukkit.permissions

# 类 PermissionAttachment

java.lang.Object
org.bukkit.permissions.PermissionAttachment

public class PermissionAttachment extends Object
Holds information about a permission attachment on a `Permissible` object

- ## 构造器概要

  构造器
  构造器
  说明
  `PermissionAttachment(@NotNull Plugin plugin, @NotNull Permissible permissible)`

- ## 方法概要

  修饰符和类型
  方法
  说明
  `@NotNull Permissible`
  `getPermissible()`
  Gets the Permissible that this is attached to
  `@NotNull Map<String,Boolean>`
  `getPermissions()`
  Gets a copy of all set permissions and values contained within this attachment.
  `@NotNull Plugin`
  `getPlugin()`
  Gets the plugin responsible for this attachment
  `@Nullable PermissionRemovedExecutor`
  `getRemovalCallback()`
  Gets the class that was previously set to be called when this attachment was removed from a `Permissible`.
  `boolean`
  `remove()`
  Removes this attachment from its registered `Permissible`
  `void`
  `setPermission(@NotNull String name, boolean value)`
  Sets a permission to the given value, by its fully qualified name
  `void`
  `setPermission(@NotNull Permission perm, boolean value)`
  Sets a permission to the given value
  `void`
  `setRemovalCallback(@Nullable PermissionRemovedExecutor ex)`
  Sets an object to be called for when this attachment is removed from a `Permissible`.
  `void`
  `unsetPermission(@NotNull String name)`
  Removes the specified permission from this attachment.
  `void`
  `unsetPermission(@NotNull Permission perm)`
  Removes the specified permission from this attachment.

  ### 从类继承的方法 java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## 构造器详细资料

  - ### PermissionAttachment

    public PermissionAttachment(@NotNull @NotNull Plugin plugin, @NotNull @NotNull Permissible permissible)

- ## 方法详细资料

  - ### getPlugin

    @NotNull public @NotNull Plugin getPlugin()
    Gets the plugin responsible for this attachment
    返回:
      Plugin responsible for this permission attachment

  - ### setRemovalCallback

    public void setRemovalCallback(@Nullable @Nullable PermissionRemovedExecutor ex)
    Sets an object to be called for when this attachment is removed from a `Permissible`. May be null.
    参数:
      `ex` - Object to be called when this is removed

  - ### getRemovalCallback

    @Nullable public @Nullable PermissionRemovedExecutor getRemovalCallback()
    Gets the class that was previously set to be called when this attachment was removed from a `Permissible`. May be null.
    返回:
      Object to be called when this is removed

  - ### getPermissible

    @NotNull public @NotNull Permissible getPermissible()
    Gets the Permissible that this is attached to
    返回:
      Permissible containing this attachment

  - ### getPermissions

    @NotNull public @NotNull Map<String,Boolean> getPermissions()
    Gets a copy of all set permissions and values contained within this attachment.

    This map may be modified but will not affect the attachment, as it is a copy.

    返回:
      Copy of all permissions and values expressed by this attachment

  - ### setPermission

    public void setPermission(@NotNull @NotNull String name, boolean value)
    Sets a permission to the given value, by its fully qualified name
    参数:
      `name` - Name of the permission
      `value` - New value of the permission

  - ### setPermission

    public void setPermission(@NotNull @NotNull Permission perm, boolean value)
    Sets a permission to the given value
    参数:
      `perm` - Permission to set
      `value` - New value of the permission

  - ### unsetPermission

    public void unsetPermission(@NotNull @NotNull String name)
    Removes the specified permission from this attachment.

    If the permission does not exist in this attachment, nothing will happen.

    参数:
      `name` - Name of the permission to remove

  - ### unsetPermission

    public void unsetPermission(@NotNull @NotNull Permission perm)
    Removes the specified permission from this attachment.

    If the permission does not exist in this attachment, nothing will happen.

    参数:
      `perm` - Permission to remove

  - ### remove

    public boolean remove()
    Removes this attachment from its registered `Permissible`
    返回:
      true if the permissible was removed successfully, false if it did not exist