Bukkit-API  1.7.9-R0.2
The inofficial Bukkit-API
org.bukkit.permissions.PermissionAttachment Class Reference

Public Member Functions

 PermissionAttachment (Plugin plugin, Permissible Permissible)
 
Plugin getPlugin ()
 
void setRemovalCallback (PermissionRemovedExecutor ex)
 
PermissionRemovedExecutor getRemovalCallback ()
 
Permissible getPermissible ()
 
Map< String, Boolean > getPermissions ()
 
void setPermission (String name, boolean value)
 
void setPermission (Permission perm, boolean value)
 
void unsetPermission (String name)
 
void unsetPermission (Permission perm)
 
boolean remove ()
 

Detailed Description

Holds information about a permission attachment on a Permissible object

Definition at line 11 of file PermissionAttachment.java.

Member Function Documentation

Permissible org.bukkit.permissions.PermissionAttachment.getPermissible ( )

Gets the Permissible that this is attached to

Returns
Permissible containing this attachment

Definition at line 62 of file PermissionAttachment.java.

62  {
63  return permissible;
64  }
Map<String, Boolean> org.bukkit.permissions.PermissionAttachment.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.

Returns
Copy of all permissions and values expressed by this attachment

Definition at line 75 of file PermissionAttachment.java.

75  {
76  return new LinkedHashMap<String, Boolean>(permissions);
77  }
Plugin org.bukkit.permissions.PermissionAttachment.getPlugin ( )

Gets the plugin responsible for this attachment

Returns
Plugin responsible for this permission attachment

Definition at line 33 of file PermissionAttachment.java.

33  {
34  return plugin;
35  }
PermissionRemovedExecutor org.bukkit.permissions.PermissionAttachment.getRemovalCallback ( )

Gets the class that was previously set to be called when this attachment was removed from a Permissible. May be null.

Returns
Object to be called when this is removed

Definition at line 53 of file PermissionAttachment.java.

Referenced by org.bukkit.permissions.PermissibleBase.removeAttachment().

53  {
54  return removed;
55  }
boolean org.bukkit.permissions.PermissionAttachment.remove ( )

Removes this attachment from its registered Permissible

Returns
true if the permissible was removed successfully, false if it did not exist

Definition at line 131 of file PermissionAttachment.java.

Referenced by org.bukkit.permissions.PermissibleBase.addAttachment().

131  {
132  try {
133  permissible.removeAttachment(this);
134  return true;
135  } catch (IllegalArgumentException ex) {
136  return false;
137  }
138  }
void removeAttachment(PermissionAttachment attachment)
void org.bukkit.permissions.PermissionAttachment.setPermission ( String  name,
boolean  value 
)

Sets a permission to the given value, by its fully qualified name

Parameters
nameName of the permission
valueNew value of the permission

Definition at line 85 of file PermissionAttachment.java.

Referenced by org.bukkit.permissions.PermissibleBase.addAttachment(), and org.bukkit.permissions.PermissionAttachment.setPermission().

85  {
86  permissions.put(name.toLowerCase(), value);
87  permissible.recalculatePermissions();
88  }
void org.bukkit.permissions.PermissionAttachment.setPermission ( Permission  perm,
boolean  value 
)

Sets a permission to the given value

Parameters
permPermission to set
valueNew value of the permission

Definition at line 96 of file PermissionAttachment.java.

References org.bukkit.permissions.Permission.getName(), and org.bukkit.permissions.PermissionAttachment.setPermission().

96  {
97  setPermission(perm.getName(), value);
98  }
void setPermission(String name, boolean value)
void org.bukkit.permissions.PermissionAttachment.setRemovalCallback ( PermissionRemovedExecutor  ex)

Sets an object to be called for when this attachment is removed from a Permissible. May be null.

Parameters
exObject to be called when this is removed

Definition at line 43 of file PermissionAttachment.java.

43  {
44  removed = ex;
45  }
void org.bukkit.permissions.PermissionAttachment.unsetPermission ( String  name)

Removes the specified permission from this attachment.

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

Parameters
nameName of the permission to remove

Definition at line 108 of file PermissionAttachment.java.

Referenced by org.bukkit.permissions.PermissionAttachment.unsetPermission().

108  {
109  permissions.remove(name.toLowerCase());
110  permissible.recalculatePermissions();
111  }
void org.bukkit.permissions.PermissionAttachment.unsetPermission ( Permission  perm)

Removes the specified permission from this attachment.

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

Parameters
permPermission to remove

Definition at line 121 of file PermissionAttachment.java.

References org.bukkit.permissions.Permission.getName(), and org.bukkit.permissions.PermissionAttachment.unsetPermission().

121  {
122  unsetPermission(perm.getName());
123  }

The documentation for this class was generated from the following file: