diff --git a/core/pom.xml b/core/pom.xml
index bfe2e16a5..3bd4fd492 100644
--- a/core/pom.xml
+++ b/core/pom.xml
@@ -58,8 +58,33 @@
0.5.9
compile
+
+ org.jetbrains.kotlin
+ kotlin-stdlib
+ 1.4.10
+ provided
+
+
+
+ org.jetbrains.kotlin
+ kotlin-maven-plugin
+ 1.4.10
+
+
+ compile
+ process-sources
+
+ compile
+
+
+
+
+ 1.8
+
+
+
${project.basedir}/../languages/core/
diff --git a/core/src/main/java/co/aikar/commands/RegisteredCommand.java b/core/src/main/java/co/aikar/commands/RegisteredCommand.java
index ba8094350..0eeb97425 100644
--- a/core/src/main/java/co/aikar/commands/RegisteredCommand.java
+++ b/core/src/main/java/co/aikar/commands/RegisteredCommand.java
@@ -32,6 +32,9 @@
import co.aikar.commands.annotation.Private;
import co.aikar.commands.annotation.Syntax;
import co.aikar.commands.contexts.ContextResolver;
+import co.aikar.commands.kotlin.JavaContinuation;
+import kotlin.coroutines.Continuation;
+import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.lang.annotation.Annotation;
@@ -71,6 +74,7 @@ public class RegisteredCommand previousParam = null;
- for (int i = 0; i < parameters.length; i++) {
- CommandParameter parameter = this.parameters[i] = new CommandParameter<>(this, parameters[i], i, i == parameters.length - 1);
+ for (int i = 0; i < parametersLength; i++) {
+ CommandParameter parameter = this.parameters[i] = new CommandParameter<>(this, parameters[i], i, i == parametersLength - 1);
if (previousParam != null) {
previousParam.setNextParam(parameter);
}
@@ -157,7 +171,24 @@ void invoke(CommandIssuer sender, List args, CommandOperationContext con
Map passedArgs = resolveContexts(sender, args);
if (passedArgs == null) return;
- Object obj = method.invoke(scope, passedArgs.values().toArray());
+ Object[] methodArgs = passedArgs.values().toArray();
+ if (isKotlinSuspendingFunction) {
+ Object[] methodArgsCopy = new Object[methodArgs.length + 1];
+ System.arraycopy(methodArgs, 0, methodArgsCopy, 0, methodArgs.length);
+ methodArgs = methodArgsCopy;
+ methodArgs[methodArgs.length - 1] = new JavaContinuation