/** * Sets a permission to the given value * * @param perm Permission to set * @param value New value of the permission */ public void setPermission(Permission perm, boolean value) { setPermission(perm.getName(), value); }
/** * Removes the specified permission from this attachment. * <p> * If the permission does not exist in this attachment, nothing will * happen. * * @param perm Permission to remove */ public void unsetPermission(Permission perm) { unsetPermission(perm.getName()); }
public boolean isOp() { if (opable == null) { return false; } else { return opable.isOp(); } }
public boolean hasPermission(Permission perm) { if (perm == null) { throw new IllegalArgumentException("Permission cannot be null"); } String name = perm.getName().toLowerCase(); if (isPermissionSet(name)) { return permissions.get(name).getValue(); } return perm.getDefault().getValue(isOp()); }
public boolean isPermissionSet(Permission perm) { if (perm == null) { throw new IllegalArgumentException("Permission cannot be null"); } return isPermissionSet(perm.getName()); }
public void removeAttachment(PermissionAttachment attachment) { if (attachment == null) { throw new IllegalArgumentException("Attachment cannot be null"); } if (attachments.contains(attachment)) { attachments.remove(attachment); PermissionRemovedExecutor ex = attachment.getRemovalCallback(); if (ex != null) { ex.attachmentRemoved(attachment); } recalculatePermissions(); } else { throw new IllegalArgumentException("Given attachment is not part of Permissible object " + parent); } }
@Override public PermissionAttachment addAttachment(Plugin plugin, String name, boolean value, int ticks) { return permissions.addAttachment(plugin, name, value, ticks); }
public PermissibleBase(ServerOperator opable) { this.opable = opable; if (opable instanceof Permissible) { this.parent = (Permissible) opable; } recalculatePermissions(); }
public void run() { attachment.remove(); } }
@Override public boolean isPermissionSet(String name) { return permissions.isPermissionSet(name); }
@Override public boolean hasPermission(String name) { return perm.hasPermission(name); }
/** * Removes this attachment from its registered {@link Permissible} * * @return true if the permissible was removed successfully, false if it * did not exist */ public boolean remove() { try { permissible.removeAttachment(this); return true; } catch (IllegalArgumentException ex) { return false; } } }
@Override public void removeAttachment(PermissionAttachment attachment) { permissions.removeAttachment(attachment); }
@Override public Set<PermissionAttachmentInfo> getEffectivePermissions() { return permissions.getEffectivePermissions(); }
@Override public PermissionAttachment addAttachment(Plugin plugin, String name, boolean value, int ticks) { return perm.addAttachment(plugin, name, value, ticks); }
@Override public void recalculatePermissions() { permissions.recalculatePermissions(); }
@Override public boolean hasPermission(Permission perm) { return this.perm.hasPermission(perm); }
@Override public void removeAttachment(PermissionAttachment attachment) { perm.removeAttachment(attachment); }
@Override public PermissionAttachment addAttachment(Plugin plugin) { return permissions.addAttachment(plugin); }
@Override public PermissionAttachment addAttachment(Plugin plugin) { return perm.addAttachment(plugin); }