001    package org.bukkit;
002    
003    import java.util.Date;
004    import java.util.Set;
005    
006    /**
007     * A ban list, containing bans of some {@link Type}.
008     */
009    public interface BanList {
010    
011        /**
012         * Represents a ban-type that a {@link BanList} may track.
013         */
014        public enum Type {
015            /**
016             * Banned player names
017             */
018            NAME,
019            /**
020             * Banned player IP addresses
021             */
022            IP,
023            ;
024        }
025    
026        /**
027         * Gets a {@link BanEntry} by target.
028         *
029         * @param target entry parameter to search for
030         * @return the corresponding entry, or null if none found
031         */
032        public BanEntry getBanEntry(String target);
033    
034        /**
035         * Adds a ban to the this list. If a previous ban exists, this will
036         * update the previous entry.
037         *
038         * @param target the target of the ban
039         * @param reason reason for the ban, null indicates implementation default
040         * @param expires date for the ban's expiration (unban), or null to imply
041         *     forever
042         * @param source source of the ban, null indicates implementation default
043         * @return the entry for the newly created ban, or the entry for the
044         *     (updated) previous ban
045         */
046        public BanEntry addBan(String target, String reason, Date expires, String source);
047    
048        /**
049         * Gets a set containing every {@link BanEntry} in this list.
050         *
051         * @return an immutable set containing every entry tracked by this list
052         */
053        public Set<BanEntry> getBanEntries();
054    
055        /**
056         * Gets if a {@link BanEntry} exists for the target, indicating an active
057         * ban status.
058         *
059         * @param target the target to find
060         * @return true if a {@link BanEntry} exists for the name, indicating an
061         *     active ban status, false otherwise
062         */
063        public boolean isBanned(String target);
064    
065        /**
066         * Removes the specified target from this list, therefore indicating a
067         * "not banned" status.
068         *
069         * @param target the target to remove from this list
070         */
071        public void pardon(String target);
072    }