Commits

md_5 authored a45afbadf57
SPIGOT-3748: Throw error message if executing disabled command
No tags

src/main/java/org/bukkit/command/PluginCommand.java

Modified
26 26 * @param sender Source object which is executing this command
27 27 * @param commandLabel The alias of the command used
28 28 * @param args All arguments passed to the command, split via ' '
29 29 * @return true if the command was successful, otherwise false
30 30 */
31 31 @Override
32 32 public boolean execute(CommandSender sender, String commandLabel, String[] args) {
33 33 boolean success = false;
34 34
35 35 if (!owningPlugin.isEnabled()) {
36 - return false;
36 + throw new CommandException("Cannot execute command '" + commandLabel + "' in plugin " + owningPlugin.getDescription().getFullName() + " - plugin is disabled.");
37 37 }
38 38
39 39 if (!testPermission(sender)) {
40 40 return true;
41 41 }
42 42
43 43 try {
44 44 success = executor.onCommand(sender, this, commandLabel, args);
45 45 } catch (Throwable ex) {
46 46 throw new CommandException("Unhandled exception executing command '" + commandLabel + "' in plugin " + owningPlugin.getDescription().getFullName(), ex);

Everything looks good. We'll let you know here if there's anything you should know about.

Add shortcut