🐛 Fix suggestions in console (Bukkit/Paper)
This commit is contained in:
parent
a978adc79f
commit
d812ea633a
3 changed files with 15 additions and 7 deletions
|
|
@ -43,7 +43,7 @@ final class AsyncCommandSuggestionsListener<C> implements Listener {
|
|||
|
||||
@EventHandler
|
||||
void onTabCompletion(final @NonNull AsyncTabCompleteEvent event) {
|
||||
if (event.getBuffer().isEmpty() || !event.getBuffer().startsWith("/")) {
|
||||
if (event.getBuffer().isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -51,8 +51,11 @@ final class AsyncCommandSuggestionsListener<C> implements Listener {
|
|||
final BukkitPluginRegistrationHandler<C> bukkitPluginRegistrationHandler =
|
||||
(BukkitPluginRegistrationHandler<C>) this.paperCommandManager.getCommandRegistrationHandler();
|
||||
|
||||
/* Turn '/plugin:command arg1 arg2 ...' into 'plugin:command' */
|
||||
final String commandLabel = event.getBuffer().substring(1).split(" ")[0];
|
||||
/* Turn '(/)plugin:command arg1 arg2 ...' into 'plugin:command' */
|
||||
final String commandLabel = (event.getBuffer().startsWith("/")
|
||||
? event.getBuffer().substring(1)
|
||||
: event.getBuffer())
|
||||
.split(" ")[0];
|
||||
if (!bukkitPluginRegistrationHandler.isRecognized(commandLabel)) {
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue