001    /**
002     * Jetrix TetriNET Server
003     * Copyright (C) 2001-2004  Emmanuel Bourg
004     *
005     * This program is free software; you can redistribute it and/or
006     * modify it under the terms of the GNU General Public License
007     * as published by the Free Software Foundation; either version 2
008     * of the License, or (at your option) any later version.
009     *
010     * This program is distributed in the hope that it will be useful,
011     * but WITHOUT ANY WARRANTY; without even the implied warranty of
012     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
013     * GNU General Public License for more details.
014     *
015     * You should have received a copy of the GNU General Public License
016     * along with this program; if not, write to the Free Software
017     * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
018     */
019    
020    package net.jetrix.commands;
021    
022    import java.util.*;
023    
024    import net.jetrix.messages.channel.CommandMessage;
025    
026    /**
027     * A command consummes a CommandMessage to execute a specific operation.
028     *
029     * @author Emmanuel Bourg
030     * @version $Revision: 798 $, $Date: 2009-02-18 16:24:28 +0100 (Wed, 18 Feb 2009) $
031     */
032    public interface Command
033    {
034        /**
035         * Return the different names available to invoke this command.
036         * An alias doesn't contain the leading character used to call
037         * a command ("/" or "!"). The first alias in the array is the 
038         * default name that will be displayed in the /help list.
039         */
040        String[] getAliases();
041    
042        /**
043         * Return the usage of this command, for example
044         * <tt>/cmd &lt;param1&gt; &lt;param2&gt;</tt>
045         *
046         * @param locale the locale to be used for the usage
047         */
048        String getUsage(Locale locale);
049    
050        /**
051         * Return a description of this command.
052         *
053         * @param locale the locale to be used for the description
054         */
055        String getDescription(Locale locale);
056    
057        /**
058         * Return the required access level to execute this command.
059         */
060        int getAccessLevel();
061    
062        /**
063         * Set the access level required to execute this command.
064         *
065         * @since 0.2
066         *
067         * @param level the access level
068         */
069        void setAccessLevel(int level);
070    
071        /**
072         * Tells if the command is hidden from the /help list.
073         *
074         * @since 0.2
075         */
076        boolean isHidden();
077    
078        /**
079         * Change the hidden status of the command on the /help list.
080         *
081         * @since 0.2
082         *
083         * @param hidden
084         */
085        void setHidden(boolean hidden);
086    
087        /**
088         * Execute the command.
089         */
090        void execute(CommandMessage message);
091    
092    }