From bb630b9e69f6c701d48b3790a090ec88cefcbac7 Mon Sep 17 00:00:00 2001 From: MattMXX Date: Tue, 21 Nov 2023 02:19:08 +0000 Subject: [PATCH] Typo fix and changing builder --- .../kotlin/com/mattmx/ktgui/commands/DummyCommand.kt | 2 +- .../com/mattmx/ktgui/commands/DummyCommandExecutor.kt | 2 +- .../com/mattmx/ktgui/commands/SimpleCommandBuilder.kt | 10 +++++----- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/api/src/main/kotlin/com/mattmx/ktgui/commands/DummyCommand.kt b/api/src/main/kotlin/com/mattmx/ktgui/commands/DummyCommand.kt index fb3faa1..4d3f68b 100644 --- a/api/src/main/kotlin/com/mattmx/ktgui/commands/DummyCommand.kt +++ b/api/src/main/kotlin/com/mattmx/ktgui/commands/DummyCommand.kt @@ -34,7 +34,7 @@ class DummyCommand( var argss = args.toMutableList() argss = if (argss.size - 1 < 0) mutableListOf("") else argss.subList(0, argss.size - 1) cmd.getCommand(argss)?.let { - return it.getSuggetions(CommandInvocation(sender, args.toList(), current, alias)).toMutableList() + return it.getSuggestions(CommandInvocation(sender, args.toList(), current, alias)).toMutableList() } return mutableListOf() } diff --git a/api/src/main/kotlin/com/mattmx/ktgui/commands/DummyCommandExecutor.kt b/api/src/main/kotlin/com/mattmx/ktgui/commands/DummyCommandExecutor.kt index 0b7da88..b7d98af 100644 --- a/api/src/main/kotlin/com/mattmx/ktgui/commands/DummyCommandExecutor.kt +++ b/api/src/main/kotlin/com/mattmx/ktgui/commands/DummyCommandExecutor.kt @@ -62,7 +62,7 @@ class DummyCommandExecutor( var argss = args.toMutableList() argss = if (argss.size - 1 < 0) mutableListOf("") else argss.subList(0, argss.size - 1) cmd.getCommand(argss)?.let { - return it.getSuggetions(CommandInvocation(sender, args.toList(), current, alias)).toMutableList() + return it.getSuggestions(CommandInvocation(sender, args.toList(), current, alias)).toMutableList() } return mutableListOf() } diff --git a/api/src/main/kotlin/com/mattmx/ktgui/commands/SimpleCommandBuilder.kt b/api/src/main/kotlin/com/mattmx/ktgui/commands/SimpleCommandBuilder.kt index 0fdb4f9..7ed0c9d 100644 --- a/api/src/main/kotlin/com/mattmx/ktgui/commands/SimpleCommandBuilder.kt +++ b/api/src/main/kotlin/com/mattmx/ktgui/commands/SimpleCommandBuilder.kt @@ -42,7 +42,7 @@ open class SimpleCommandBuilder( return this } - fun noPermissions(cb: (CommandInvocation) -> Unit) : SimpleCommandBuilder { + fun noPermissions(cb: CommandInvocation.() -> Unit) : SimpleCommandBuilder { noPermissions = cb return this } @@ -57,7 +57,7 @@ open class SimpleCommandBuilder( return permission == null || executor.hasPermission(permission!!) } - fun onCooldown(executes: (CommandInvocation) -> Unit) : SimpleCommandBuilder { + fun onCooldown(executes: CommandInvocation.() -> Unit) : SimpleCommandBuilder { this.cooldownCallback = executes return this } @@ -66,12 +66,12 @@ open class SimpleCommandBuilder( this.cooldownCallback?.invoke(invocation) } - fun executes(execute: (CommandInvocation) -> Unit) : SimpleCommandBuilder { + fun executes(execute: CommandInvocation.() -> Unit) : SimpleCommandBuilder { this.execute = execute return this } - fun unknownSubcommand(unknown: (CommandInvocation) -> Unit) : SimpleCommandBuilder { + fun unknownSubcommand(unknown: CommandInvocation.() -> Unit) : SimpleCommandBuilder { this.unknown = unknown return this } @@ -92,7 +92,7 @@ open class SimpleCommandBuilder( return aliases.toMutableList() + name } - fun getSuggetions(invocation: CommandInvocation) : List { + fun getSuggestions(invocation: CommandInvocation) : List { suggests?.also { return it(invocation) ?: listOf() } ?: run {