public class PermissionAttachment extends Object
Permissible
objectConstructor and Description |
---|
PermissionAttachment(Plugin plugin,
Permissible permissible) |
Modifier and Type | Method and Description |
---|---|
Permissible |
getPermissible()
Gets the Permissible that this is attached to
|
Map<String,Boolean> |
getPermissions()
Gets a copy of all set permissions and values contained within this
attachment.
|
Plugin |
getPlugin()
Gets the plugin responsible for this attachment
|
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(Permission perm,
boolean value)
Sets a permission to the given value
|
void |
setPermission(String name,
boolean value)
Sets a permission to the given value, by its fully qualified name
|
void |
setRemovalCallback(PermissionRemovedExecutor ex)
Sets an object to be called for when this attachment is removed from a
Permissible . |
void |
unsetPermission(Permission perm)
Removes the specified permission from this attachment.
|
void |
unsetPermission(String name)
Removes the specified permission from this attachment.
|
public PermissionAttachment(@NotNull Plugin plugin, @NotNull Permissible permissible)
@NotNull public Plugin getPlugin()
public void setRemovalCallback(@Nullable PermissionRemovedExecutor ex)
Permissible
. May be null.ex
- Object to be called when this is removed@Nullable public PermissionRemovedExecutor getRemovalCallback()
Permissible
. May be null.@NotNull public Permissible getPermissible()
@NotNull public Map<String,Boolean> getPermissions()
This map may be modified but will not affect the attachment, as it is a copy.
public void setPermission(@NotNull String name, boolean value)
name
- Name of the permissionvalue
- New value of the permissionpublic void setPermission(@NotNull Permission perm, boolean value)
perm
- Permission to setvalue
- New value of the permissionpublic void unsetPermission(@NotNull String name)
If the permission does not exist in this attachment, nothing will happen.
name
- Name of the permission to removepublic void unsetPermission(@NotNull Permission perm)
If the permission does not exist in this attachment, nothing will happen.
perm
- Permission to removepublic boolean remove()
Permissible
Copyright © 2022. All rights reserved.