🐛 Fix suggestions in console (Bukkit/Paper)
This commit is contained in:
parent
a978adc79f
commit
d812ea633a
3 changed files with 15 additions and 7 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -107,6 +107,7 @@ local.properties
|
|||
|
||||
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
|
||||
hs_err_pid*
|
||||
java_pid*
|
||||
|
||||
### JetBrains+all ###
|
||||
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
|
||||
|
|
|
|||
|
|
@ -44,15 +44,19 @@ final class CloudBukkitListener<C> implements Listener {
|
|||
|
||||
@EventHandler
|
||||
void onTabCompletion(final @NonNull TabCompleteEvent event) {
|
||||
if (event.getBuffer().isEmpty() || !event.getBuffer().startsWith("/")) {
|
||||
if (event.getBuffer().isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked") final BukkitPluginRegistrationHandler<C> bukkitPluginRegistrationHandler =
|
||||
@SuppressWarnings("unchecked")
|
||||
final BukkitPluginRegistrationHandler<C> bukkitPluginRegistrationHandler =
|
||||
(BukkitPluginRegistrationHandler<C>) this.bukkitCommandManager.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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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