001    package org.bukkit.plugin.messaging;
002    
003    import java.util.Set;
004    import org.bukkit.plugin.Plugin;
005    
006    /**
007     * Represents a possible recipient for a Plugin Message.
008     */
009    public interface PluginMessageRecipient {
010        /**
011         * Sends this recipient a Plugin Message on the specified outgoing
012         * channel.
013         * <p>
014         * The message may not be larger than {@link Messenger#MAX_MESSAGE_SIZE}
015         * bytes, and the plugin must be registered to send messages on the
016         * specified channel.
017         *
018         * @param source The plugin that sent this message.
019         * @param channel The channel to send this message on.
020         * @param message The raw message to send.
021         * @throws IllegalArgumentException Thrown if the source plugin is
022         *     disabled.
023         * @throws IllegalArgumentException Thrown if source, channel or message
024         *     is null.
025         * @throws MessageTooLargeException Thrown if the message is too big.
026         * @throws ChannelNotRegisteredException Thrown if the channel is not
027         *     registered for this plugin.
028         */
029        public void sendPluginMessage(Plugin source, String channel, byte[] message);
030    
031        /**
032         * Gets a set containing all the Plugin Channels that this client is
033         * listening on.
034         *
035         * @return Set containing all the channels that this client may accept.
036         */
037        public Set<String> getListeningPluginChannels();
038    }