1 /***
2 * Jetrix TetriNET Server
3 * Copyright (C) 2001-2004 Emmanuel Bourg
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 */
19
20 package net.jetrix.commands;
21
22 import java.util.*;
23
24 import net.jetrix.messages.channel.CommandMessage;
25
26 /***
27 * A command consummes a CommandMessage to execute a specific operation.
28 *
29 * @author Emmanuel Bourg
30 * @version $Revision: 798 $, $Date: 2009-02-18 16:24:28 +0100 (Wed, 18 Feb 2009) $
31 */
32 public interface Command
33 {
34 /***
35 * Return the different names available to invoke this command.
36 * An alias doesn't contain the leading character used to call
37 * a command ("/" or "!"). The first alias in the array is the
38 * default name that will be displayed in the /help list.
39 */
40 String[] getAliases();
41
42 /***
43 * Return the usage of this command, for example
44 * <tt>/cmd <param1> <param2></tt>
45 *
46 * @param locale the locale to be used for the usage
47 */
48 String getUsage(Locale locale);
49
50 /***
51 * Return a description of this command.
52 *
53 * @param locale the locale to be used for the description
54 */
55 String getDescription(Locale locale);
56
57 /***
58 * Return the required access level to execute this command.
59 */
60 int getAccessLevel();
61
62 /***
63 * Set the access level required to execute this command.
64 *
65 * @since 0.2
66 *
67 * @param level the access level
68 */
69 void setAccessLevel(int level);
70
71 /***
72 * Tells if the command is hidden from the /help list.
73 *
74 * @since 0.2
75 */
76 boolean isHidden();
77
78 /***
79 * Change the hidden status of the command on the /help list.
80 *
81 * @since 0.2
82 *
83 * @param hidden
84 */
85 void setHidden(boolean hidden);
86
87 /***
88 * Execute the command.
89 */
90 void execute(CommandMessage message);
91
92 }