Skip to content

Commit

Permalink
Typo fix and changing builder
Browse files Browse the repository at this point in the history
  • Loading branch information
Matt-MX committed Nov 21, 2023
1 parent 968d160 commit bb630b9
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand All @@ -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
}
Expand All @@ -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
}
Expand All @@ -92,7 +92,7 @@ open class SimpleCommandBuilder(
return aliases.toMutableList() + name
}

fun getSuggetions(invocation: CommandInvocation) : List<String> {
fun getSuggestions(invocation: CommandInvocation) : List<String> {
suggests?.also {
return it(invocation) ?: listOf()
} ?: run {
Expand Down

0 comments on commit bb630b9

Please sign in to comment.