Added new permission system

By: Dinnerbone <dinnerbone@dinnerbone.com>
This commit is contained in:
Bukkit/Spigot
2011-07-17 17:17:47 +01:00
parent 3c852a3c8f
commit 67a52cca79
15 changed files with 958 additions and 9 deletions

View File

@@ -0,0 +1,62 @@
package org.bukkit.permissions;
/**
* Holds information on a permission and which {@link PermissionAttachment} provides it
*/
public class PermissionAttachmentInfo {
private final Permissible permissible;
private final String permission;
private final PermissionAttachment attachment;
private final boolean value;
public PermissionAttachmentInfo(Permissible permissible, String permission, PermissionAttachment attachment, boolean value) {
if (permissible == null) {
throw new IllegalArgumentException("Permissible may not be null");
} else if (permission == null) {
throw new IllegalArgumentException("Permissions may not be null");
}
this.permissible = permissible;
this.permission = permission;
this.attachment = attachment;
this.value = value;
}
/**
* Gets the permissible this is attached to
*
* @return Permissible this permission is for
*/
public Permissible getPermissible() {
return permissible;
}
/**
* Gets the permission being set
*
* @return Name of the permission
*/
public String getPermission() {
return permission;
}
/**
* Gets the attachment providing this permission. This may be null for default
* permissions (usually parent permissions).
*
* @return Attachment
*/
public PermissionAttachment getAttachment() {
return attachment;
}
/**
* Gets the value of this permission
*
* @return Value of the permission
*/
public boolean getValue() {
return value;
}
}