MCPcopy Create free account
hub / github.com/Bukkit/Bukkit / Command

Class Command

src/main/java/org/bukkit/command/Command.java:14–250  ·  view source on GitHub ↗

Represents a Command, which executes various tasks upon user input

Source from the content-addressed store, hash-verified

12 * Represents a Command, which executes various tasks upon user input
13 */
14public abstract class Command {
15 private final String name;
16 private String nextLabel;
17 private String label;
18 private List<String> aliases;
19 private List<String> activeAliases;
20 private CommandMap commandMap = null;
21 protected String description = "";
22 protected String usageMessage;
23 private String permission;
24
25 protected Command(String name) {
26 this(name, "", "/" + name, new ArrayList<String>());
27 }
28
29 protected Command(String name, String description, String usageMessage, List<String> aliases) {
30 this.name = name;
31 this.nextLabel = name;
32 this.label = name;
33 this.description = description;
34 this.usageMessage = usageMessage;
35 this.aliases = aliases;
36 this.activeAliases = new ArrayList<String>(aliases);
37 }
38
39 /**
40 * Executes the command, returning its success
41 *
42 * @param sender Source object which is executing this command
43 * @param commandLabel The alias of the command used
44 * @param args All arguments passed to the command, split via ' '
45 * @return true if the command was successful, otherwise false
46 */
47 public abstract boolean execute(CommandSender sender, String commandLabel, String[] args);
48
49 /**
50 * Returns the name of this command
51 *
52 * @return Name of this command
53 */
54 public String getName() {
55 return name;
56 }
57
58 /**
59 * Gets the permission required by users to be able to perform this command
60 *
61 * @return Permission name, or null if none
62 */
63 public String getPermission() {
64 return permission;
65 }
66
67 /**
68 * Sets the permission required by users to be able to perform this command
69 *
70 * @param permission Permission name or null
71 */

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected