Fork of Poseidon providing Bukkit #1060 to older Beta versions (b1.0-b1.7.3)
at develop 106 lines 3.9 kB view raw
1package org.bukkit.permissions; 2 3import org.bukkit.plugin.Plugin; 4 5import java.util.Set; 6 7/** 8 * Represents an object that may be assigned permissions 9 */ 10public interface Permissible extends ServerOperator { 11 /** 12 * Checks if this object contains an override for the specified permission, by fully qualified name 13 * 14 * @param name Name of the permission 15 * @return true if the permission is set, otherwise false 16 */ 17 public boolean isPermissionSet(String name); 18 19 /** 20 * Checks if this object contains an override for the specified {@link Permission} 21 * 22 * @param perm Permission to check 23 * @return true if the permission is set, otherwise false 24 */ 25 public boolean isPermissionSet(Permission perm); 26 27 /** 28 * Gets the value of the specified permission, if set. 29 * <p> 30 * If a permission override is not set on this object, the default value of the permission will be returned. 31 * 32 * @param name Name of the permission 33 * @return Value of the permission 34 */ 35 public boolean hasPermission(String name); 36 37 /** 38 * Gets the value of the specified permission, if set. 39 * <p> 40 * If a permission override is not set on this object, the default value of the permission will be returned 41 * 42 * @param perm Permission to get 43 * @return Value of the permission 44 */ 45 public boolean hasPermission(Permission perm); 46 47 /** 48 * Adds a new {@link PermissionAttachment} with a single permission by name and value 49 * 50 * @param plugin Plugin responsible for this attachment, may not be null or disabled 51 * @param name Name of the permission to attach 52 * @param value Value of the permission 53 * @return The PermissionAttachment that was just created 54 */ 55 public PermissionAttachment addAttachment(Plugin plugin, String name, boolean value); 56 57 /** 58 * Adds a new empty {@link PermissionAttachment} to this object 59 * 60 * @param plugin Plugin responsible for this attachment, may not be null or disabled 61 * @return The PermissionAttachment that was just created 62 */ 63 public PermissionAttachment addAttachment(Plugin plugin); 64 65 /** 66 * Temporarily adds a new {@link PermissionAttachment} with a single permission by name and value 67 * 68 * @param plugin Plugin responsible for this attachment, may not be null or disabled 69 * @param name Name of the permission to attach 70 * @param value Value of the permission 71 * @param ticks Amount of ticks to automatically remove this attachment after 72 * @return The PermissionAttachment that was just created 73 */ 74 public PermissionAttachment addAttachment(Plugin plugin, String name, boolean value, int ticks); 75 76 /** 77 * Temporarily adds a new empty {@link PermissionAttachment} to this object 78 * 79 * @param plugin Plugin responsible for this attachment, may not be null or disabled 80 * @param ticks Amount of ticks to automatically remove this attachment after 81 * @return The PermissionAttachment that was just created 82 */ 83 public PermissionAttachment addAttachment(Plugin plugin, int ticks); 84 85 /** 86 * Removes the given {@link PermissionAttachment} from this object 87 * 88 * @param attachment Attachment to remove 89 * @throws IllegalArgumentException Thrown when the specified attachment isn't part of this object 90 */ 91 public void removeAttachment(PermissionAttachment attachment); 92 93 /** 94 * Recalculates the permissions for this object, if the attachments have changed values. 95 * <p> 96 * This should very rarely need to be called from a plugin. 97 */ 98 public void recalculatePermissions(); 99 100 /** 101 * Gets a set containing all of the permissions currently in effect by this object 102 * 103 * @return Set of currently effective permissions 104 */ 105 public Set<PermissionAttachmentInfo> getEffectivePermissions(); 106}