📚 Improve the Bukkit and PaperCommandManager documentation

This commit is contained in:
Alexander Söderberg 2020-10-17 18:58:31 +02:00 committed by Alexander Söderberg
parent de0666aa73
commit d6cdeca1c3
2 changed files with 55 additions and 5 deletions

View file

@ -85,8 +85,24 @@ public class BukkitCommandManager<C> extends CommandManager<C> {
/**
* Construct a new Bukkit command manager
*
* @param owningPlugin Plugin that is constructing the manager
* @param commandExecutionCoordinator Coordinator provider
* @param owningPlugin Plugin that is constructing the manager. This will be used when registering the
* commands to the Bukkit command map.
* @param commandExecutionCoordinator Execution coordinator instance. The coordinator is in charge of executing incoming
* commands. Some considerations must be made when picking a suitable execution
* coordinator. For example, an entirely asynchronous coordinator is not suitable
* when the parsers used in your commands are not thread safe. If you have
* commands that perform blocking operations, however, it might not be a good idea to
* use a synchronous execution coordinator. In most cases you will want to pick between
* {@link CommandExecutionCoordinator#simpleCoordinator()} and
* {@link cloud.commandframework.execution.AsynchronousCommandExecutionCoordinator}.
* <p>
* A word of caution: When using the asynchronous command executor in Bukkit, it is very
* likely that you will have to perform manual synchronization when executing the commands
* in many cases, as Bukkit makes no guarantees of thread safety in common classes. To
* make this easier, {@link #taskRecipe()} is provided. Furthermore, it may be unwise to
* use asynchronous command parsing, especially when dealing with things such as players
* and entities. To make this more safe, the asynchronous command execution allows you
* to state that you want synchronous command parsing.
* @param commandSenderMapper Function that maps {@link CommandSender} to the command sender type
* @param backwardsCommandSenderMapper Function that maps the command sender type to {@link CommandSender}
* @throws Exception If the construction of the manager fails
@ -219,6 +235,12 @@ public class BukkitCommandManager<C> extends CommandManager<C> {
this.splitAliases = value;
}
/**
* Check whether or not Brigadier can be used on the server instance
*
* @throws BrigadierFailureException An exception is thrown if Brigadier isn't available. The exception
* will contain the reason for this.
*/
protected final void checkBrigadierCompatibility() throws BrigadierFailureException {
if (!this.queryCapability(CloudBukkitCapabilities.BRIGADIER)) {
throw new BrigadierFailureException(