org.bukkit.permissions
Class Permission

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

public class Permission
extends Object

Represents a unique permission that may be attached to a Permissible


Field Summary
static PermissionDefault DEFAULT_PERMISSION
           
 
Constructor Summary
Permission(String name)
           
Permission(String name, Map<String,Boolean> children)
           
Permission(String name, PermissionDefault defaultValue)
           
Permission(String name, PermissionDefault defaultValue, Map<String,Boolean> children)
           
Permission(String name, String description)
           
Permission(String name, String description, Map<String,Boolean> children)
           
Permission(String name, String description, PermissionDefault defaultValue)
           
Permission(String name, String description, PermissionDefault defaultValue, Map<String,Boolean> children)
           
 
Method Summary
 void addParent(Permission perm, boolean value)
          Adds this permission to the specified parent permission.
 Permission addParent(String name, boolean value)
          Adds this permission to the specified parent permission.
 Map<String,Boolean> getChildren()
          Gets the children of this permission.
 PermissionDefault getDefault()
          Gets the default value of this permission.
 String getDescription()
          Gets a brief description of this permission, if set
 String getName()
          Returns the unique fully qualified name of this Permission
 Set<Permissible> getPermissibles()
          Gets a set containing every Permissible that has this permission.
static Permission loadPermission(String name, Map<?,?> data, PermissionDefault def, List<Permission> output)
          Loads a Permission from a map of data, usually used from retrieval from a yaml file.
static Permission loadPermission(String name, Map<String,Object> data)
          Loads a Permission from a map of data, usually used from retrieval from a yaml file.
static List<Permission> loadPermissions(Map<?,?> data, String error, PermissionDefault def)
          Loads a list of Permissions from a map of data, usually used from retrieval from a yaml file.
 void recalculatePermissibles()
          Recalculates all Permissibles that contain this permission.
 void setDefault(PermissionDefault value)
          Sets the default value of this permission.
 void setDescription(String value)
          Sets the description of this permission.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_PERMISSION

public static final PermissionDefault DEFAULT_PERMISSION
Constructor Detail

Permission

public Permission(String name)

Permission

public Permission(String name,
                  String description)

Permission

public Permission(String name,
                  PermissionDefault defaultValue)

Permission

public Permission(String name,
                  String description,
                  PermissionDefault defaultValue)

Permission

public Permission(String name,
                  Map<String,Boolean> children)

Permission

public Permission(String name,
                  String description,
                  Map<String,Boolean> children)

Permission

public Permission(String name,
                  PermissionDefault defaultValue,
                  Map<String,Boolean> children)

Permission

public Permission(String name,
                  String description,
                  PermissionDefault defaultValue,
                  Map<String,Boolean> children)
Method Detail

getName

public String getName()
Returns the unique fully qualified name of this Permission

Returns:
Fully qualified name

getChildren

public Map<String,Boolean> getChildren()
Gets the children of this permission. If you change this map in any form, you must call recalculatePermissibles() to recalculate all Permissibles

Returns:
Permission children

getDefault

public PermissionDefault getDefault()
Gets the default value of this permission.

Returns:
Default value of this permission.

setDefault

public void setDefault(PermissionDefault value)
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

Parameters:
value - The new default to set

getDescription

public String getDescription()
Gets a brief description of this permission, if set

Returns:
Brief description of this permission

setDescription

public void setDescription(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.

Parameters:
value - The new description to set

getPermissibles

public Set<Permissible> getPermissibles()
Gets a set containing every Permissible that has this permission.

This set cannot be modified.

Returns:
Set containing permissibles with this permission

recalculatePermissibles

public void recalculatePermissibles()
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

public Permission addParent(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.

Parameters:
name - Name of the parent permission
value - The value to set this permission to
Returns:
Parent permission it created or loaded

addParent

public void addParent(Permission perm,
                      boolean value)
Adds this permission to the specified parent permission.

Parameters:
perm - Parent permission to register with
value - The value to set this permission to

loadPermissions

public static List<Permission> loadPermissions(Map<?,?> data,
                                               String error,
                                               PermissionDefault def)
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 of child permissions. If not specified, empty list. description: Short string containing a very small description of this description. If not specified, empty string.

Parameters:
data - Map of permissions
error - An error message to show if a permission is invalid.
def - Default permission value to use if missing
Returns:
Permission object

loadPermission

public static Permission loadPermission(String name,
                                        Map<String,Object> data)
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 of child permissions. If not specified, empty list. description: Short string containing a very small description of this description. If not specified, empty string.

Parameters:
name - Name of the permission
data - Map of keys
Returns:
Permission object

loadPermission

public static Permission loadPermission(String name,
                                        Map<?,?> data,
                                        PermissionDefault def,
                                        List<Permission> output)
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 of child permissions. If not specified, empty list. description: Short string containing a very small description of this description. If not specified, empty string.

Parameters:
name - Name of the permission
data - Map of keys
def - Default permission value to use if not set
output - A list to append any created child-Permissions to, may be null
Returns:
Permission object


Copyright © 2013. All Rights Reserved.