001    package org.bukkit.permissions;
002    
003    /**
004     * Holds information on a permission and which {@link PermissionAttachment}
005     * provides it
006     */
007    public class PermissionAttachmentInfo {
008        private final Permissible permissible;
009        private final String permission;
010        private final PermissionAttachment attachment;
011        private final boolean value;
012    
013        public PermissionAttachmentInfo(Permissible permissible, String permission, PermissionAttachment attachment, boolean value) {
014            if (permissible == null) {
015                throw new IllegalArgumentException("Permissible may not be null");
016            } else if (permission == null) {
017                throw new IllegalArgumentException("Permissions may not be null");
018            }
019    
020            this.permissible = permissible;
021            this.permission = permission;
022            this.attachment = attachment;
023            this.value = value;
024        }
025    
026        /**
027         * Gets the permissible this is attached to
028         *
029         * @return Permissible this permission is for
030         */
031        public Permissible getPermissible() {
032            return permissible;
033        }
034    
035        /**
036         * Gets the permission being set
037         *
038         * @return Name of the permission
039         */
040        public String getPermission() {
041            return permission;
042        }
043    
044        /**
045         * Gets the attachment providing this permission. This may be null for
046         * default permissions (usually parent permissions).
047         *
048         * @return Attachment
049         */
050        public PermissionAttachment getAttachment() {
051            return attachment;
052        }
053    
054        /**
055         * Gets the value of this permission
056         *
057         * @return Value of the permission
058         */
059        public boolean getValue() {
060            return value;
061        }
062    }