From d49dd7cc62feaa30a215e3c1838c3a740dedb900 Mon Sep 17 00:00:00 2001 From: Apehum <36326454+Apehum@users.noreply.github.com> Date: Sun, 3 Nov 2024 18:06:07 +0800 Subject: [PATCH] fix(velocity): fallback to "" commandAlias on CommandExecuteEvent --- .../su/plo/slib/velocity/command/VelocityCommandManager.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/velocity/src/main/kotlin/su/plo/slib/velocity/command/VelocityCommandManager.kt b/velocity/src/main/kotlin/su/plo/slib/velocity/command/VelocityCommandManager.kt index e7d3778..5331870 100644 --- a/velocity/src/main/kotlin/su/plo/slib/velocity/command/VelocityCommandManager.kt +++ b/velocity/src/main/kotlin/su/plo/slib/velocity/command/VelocityCommandManager.kt @@ -19,7 +19,9 @@ class VelocityCommandManager( @Subscribe fun onCommandExecute(event: CommandExecuteEvent) { val command = event.command - val commandAlias = command.split(" ".toRegex()).dropLastWhile { it.isEmpty() }.toTypedArray()[0] + val commandAlias = command.split(" ") + .dropLastWhile { it.isEmpty() } + .getOrNull(0) ?: "" val commandSource = getCommandSource(event.commandSource) McProxyCommandExecuteEvent.invoker.onCommandExecute(commandSource, command)