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

Method execute

src/main/java/org/bukkit/command/PluginCommand.java:27–52  ·  view source on GitHub ↗

Executes the command, returning its success @param sender Source object which is executing this command @param commandLabel The alias of the command used @param args All arguments passed to the command, split via ' ' @return true if the command was successful, otherwise false

(CommandSender sender, String commandLabel, String[] args)

Source from the content-addressed store, hash-verified

25 * @return true if the command was successful, otherwise false
26 */
27 @Override
28 public boolean execute(CommandSender sender, String commandLabel, String[] args) {
29 boolean success = false;
30
31 if (!owningPlugin.isEnabled()) {
32 return false;
33 }
34
35 if (!testPermission(sender)) {
36 return true;
37 }
38
39 try {
40 success = executor.onCommand(sender, this, commandLabel, args);
41 } catch (Throwable ex) {
42 throw new CommandException("Unhandled exception executing command '" + commandLabel + "' in plugin " + owningPlugin.getDescription().getFullName(), ex);
43 }
44
45 if (!success && usageMessage.length() > 0) {
46 for (String line: usageMessage.replace("<command>", commandLabel).split("\n")) {
47 sender.sendMessage(line);
48 }
49 }
50
51 return success;
52 }
53
54 /**
55 * Sets the {@link CommandExecutor} to run when parsing this command

Callers

nothing calls this directly

Calls 7

testPermissionMethod · 0.80
getFullNameMethod · 0.80
isEnabledMethod · 0.65
onCommandMethod · 0.65
getDescriptionMethod · 0.65
sendMessageMethod · 0.65
lengthMethod · 0.45

Tested by

no test coverage detected