MCPcopy Create free account
hub / github.com/Teneted/Tenet / execute

Method execute

src/main/java/org/bukkit/command/PluginCommand.java:32–57  ·  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

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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 9

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

Tested by

no test coverage detected