geforkt von Mirrors/Velocity
Merge pull request #364 from FrankHeijden/feature/alias-checking
Add ability to check for command alias existence in api module
Dieser Commit ist enthalten in:
Commit
9befb006c0
@ -122,4 +122,12 @@ public interface CommandManager {
|
|||||||
* Can be completed exceptionally if an exception is thrown during execution.
|
* Can be completed exceptionally if an exception is thrown during execution.
|
||||||
*/
|
*/
|
||||||
CompletableFuture<Boolean> executeImmediatelyAsync(CommandSource source, String cmdLine);
|
CompletableFuture<Boolean> executeImmediatelyAsync(CommandSource source, String cmdLine);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns whether the given alias is registered on this manager.
|
||||||
|
*
|
||||||
|
* @param alias the command alias to check
|
||||||
|
* @return {@code true} if the alias is registered
|
||||||
|
*/
|
||||||
|
boolean hasCommand(String alias);
|
||||||
}
|
}
|
||||||
|
@ -227,6 +227,7 @@ public class VelocityCommandManager implements CommandManager {
|
|||||||
* @param alias the command alias to check
|
* @param alias the command alias to check
|
||||||
* @return {@code true} if the alias is registered
|
* @return {@code true} if the alias is registered
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public boolean hasCommand(final String alias) {
|
public boolean hasCommand(final String alias) {
|
||||||
Preconditions.checkNotNull(alias, "alias");
|
Preconditions.checkNotNull(alias, "alias");
|
||||||
return dispatcher.getRoot().getChild(alias.toLowerCase(Locale.ENGLISH)) != null;
|
return dispatcher.getRoot().getChild(alias.toLowerCase(Locale.ENGLISH)) != null;
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren