geforkt von Mirrors/Paper
Fixed no command found being sent to the command sender for command handlers which return failure (false)
By: stevenh <steven.hartland@multiplay.co.uk>
Dieser Commit ist enthalten in:
Ursprung
9469bb110d
Commit
e96e0e657f
@ -44,7 +44,7 @@ public interface CommandMap {
|
|||||||
* Looks for the requested command and executes it if found.
|
* Looks for the requested command and executes it if found.
|
||||||
*
|
*
|
||||||
* @param cmdLine command + arguments. Example: "/test abc 123"
|
* @param cmdLine command + arguments. Example: "/test abc 123"
|
||||||
* @return targetFound returns false if no target is found.
|
* @return targetFound returns false if no target is found, true otherwise.
|
||||||
* @throws CommandException Thrown when the executor for the given command fails with an unhandled exception
|
* @throws CommandException Thrown when the executor for the given command fails with an unhandled exception
|
||||||
*/
|
*/
|
||||||
public boolean dispatch(CommandSender sender, String cmdLine) throws CommandException;
|
public boolean dispatch(CommandSender sender, String cmdLine) throws CommandException;
|
||||||
|
@ -124,12 +124,16 @@ public final class SimpleCommandMap implements CommandMap {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return target.execute(sender, sentCommandLabel, Arrays_copyOfRange(args, 1, args.length));
|
// Note: we don't return the result of target.execute as thats success / failure, we return handled (true) or not handled (false)
|
||||||
|
target.execute(sender, sentCommandLabel, Arrays_copyOfRange(args, 1, args.length));
|
||||||
} catch (CommandException ex) {
|
} catch (CommandException ex) {
|
||||||
throw ex;
|
throw ex;
|
||||||
} catch (Throwable ex) {
|
} catch (Throwable ex) {
|
||||||
throw new CommandException("Unhandled exception executing '" + commandLine + "' in " + target, ex);
|
throw new CommandException("Unhandled exception executing '" + commandLine + "' in " + target, ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// return true as command was handled
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized void clearCommands() {
|
public synchronized void clearCommands() {
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren