✨ Throw an IllegalStateException when trying to register async completions on an unsupported server
This commit is contained in:
parent
5a89f98a25
commit
80988ec986
1 changed files with 6 additions and 1 deletions
|
|
@ -85,8 +85,13 @@ public class PaperCommandManager<C> extends BukkitCommandManager<C> {
|
||||||
/**
|
/**
|
||||||
* Register asynchronous completions. This requires all argument parsers to be thread safe, and it
|
* Register asynchronous completions. This requires all argument parsers to be thread safe, and it
|
||||||
* is up to the caller to guarantee that such is the case
|
* is up to the caller to guarantee that such is the case
|
||||||
|
*
|
||||||
|
* @throws IllegalStateException when the server does not support asynchronous completions.
|
||||||
*/
|
*/
|
||||||
public void registerAsynchronousCompletions() {
|
public void registerAsynchronousCompletions() throws IllegalStateException {
|
||||||
|
if (!this.queryCapability(CloudBukkitCapabilities.ASYNCHRONOUS_COMPLETION)) {
|
||||||
|
throw new IllegalStateException("Failed to register asynchronous command completion listener.");
|
||||||
|
}
|
||||||
Bukkit.getServer().getPluginManager().registerEvents(new AsyncCommandSuggestionsListener<>(this), this.getOwningPlugin());
|
Bukkit.getServer().getPluginManager().registerEvents(new AsyncCommandSuggestionsListener<>(this), this.getOwningPlugin());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue