Package org.quiltmc.qkl.wrapper.minecraft.brigadier

Types

Link copied to clipboard
typealias ArgumentAccessor<S, D> = CommandContext<S>.() -> ArgumentReader<S, D>
Link copied to clipboard
class ArgumentConstructor<S, B : ArgumentBuilder<S, *>, D : ArgumentDescriptor<*>>(    val builder: B,     val name: String,     val descriptor: D)

Class containing all data necessary to construct an optional or required argument.

Link copied to clipboard
interface ArgumentDescriptor<A : ArgumentType<*>>

A marker interface for any object or class that describes a subtype of the argument type A. The descriptor is used to find the ArgumentReader extensions applicable to the argument being described, and possibly to provide additional data for those extensions.

Link copied to clipboard
class ArgumentReader<S, out D : ArgumentDescriptor<*>>(    val context: CommandContext<S>,     val name: String,     val argumentDescriptor: D)

Argument readers are a general access point for obtaining argument values from the command context.

Link copied to clipboard
annotation class BrigadierDsl

Marks functions as part of QKL's Brigadier DSL.

Link copied to clipboard
typealias CommandAction<S> = CommandContext<S>.() -> Unit
Link copied to clipboard
typealias CommandActionWithResult<S> = CommandContext<S>.() -> CommandResult
Link copied to clipboard
sealed class CommandArgument<S, out B : ArgumentBuilder<S, *>, out D : ArgumentDescriptor<*>, out A>

An argument ready to be registered into a command. Can be either optional or required.

Link copied to clipboard
sealed class CommandResult

Representation of possible results of running a command.

Link copied to clipboard
Link copied to clipboard
class DefaultArgumentDescriptor<T : ArgumentType<*>> : ArgumentDescriptor<T>

Default ArgumentDescriptor, used for argument types such as IntegerArgumentType and many others that do only provide a single argument type with no extra data needed to resolve it.

Link copied to clipboard
typealias DefaultArgumentReader<T> = ArgumentReader<*, DefaultArgumentDescriptor<T>>
Link copied to clipboard
typealias RequiredArgumentConstructor<S, D> = ArgumentConstructor<S, RequiredArgumentBuilder<S, *>, D>

Functions

Link copied to clipboard
fun <S, AT, A : ArgumentType<AT>> argument(name: String, argumentType: A): RequiredArgumentConstructor<S, DefaultArgumentDescriptor<A>>

Creates an argument of the specified argumentType with the specified parameter name and a DefaultArgumentDescriptor for the argument type used.

fun <S, D : ArgumentDescriptor<A>, AT, A : ArgumentType<AT>> argument(    name: String,     argumentType: A,     argumentDescriptor: D): RequiredArgumentConstructor<S, D>

Creates an argument of the specified argumentType with the specified parameter name and argumentDescriptor.

Link copied to clipboard
fun commandBuildContext(dynamicRegistryManager: DynamicRegistryManager, action: CommandBuildContext.() -> Unit): CommandBuildContext

Creates and returns a CommandBuildContext with the given dynamicRegistryManager and configured with action.

Link copied to clipboard
fun <S> ArgumentBuilder<S, *>.execute(command: CommandAction<S>)

Sets the action the command will take when executed.

Link copied to clipboard
fun <S> ArgumentBuilder<S, *>.executeWithResult(command: CommandActionWithResult<S>)

Sets the action the command will take when executed.

Link copied to clipboard
@JvmName(name = "getRequired")
operator fun <S, D : ArgumentDescriptor<*>> CommandContext<S>.get(accessor: ArgumentAccessor<S, D>): ArgumentReader<S, D>
@JvmName(name = "getOptional")
operator fun <S, D : ArgumentDescriptor<*>> CommandContext<S>.get(accessor: ArgumentAccessor<S, D>?): ArgumentReader<S, D>?

Applies the accessor to the receiver CommandContext.

Link copied to clipboard
inline fun <S, D : ArgumentDescriptor<*>> ArgumentBuilder<S, *>.optional(constructor: ArgumentConstructor<S, *, D>, action: ArgumentBuilder<S, *>.(ArgumentAccessor<S, D>?) -> Unit)

Registers the argument specified by the constructor as an optional argument and further configures the resulting subcommands with the given action.

Link copied to clipboard
fun <S> CommandDispatcher<S>.register(command: String, action: LiteralArgumentBuilder<S>.() -> Unit)

Registers a command under command as the name.

Link copied to clipboard
inline fun <S, B : ArgumentBuilder<S, *>, D : ArgumentDescriptor<*>> ArgumentBuilder<S, *>.required(constructor: ArgumentConstructor<S, B, D>, action: B.(ArgumentAccessor<S, D>) -> Unit)

Registers the argument specified by the constructor as a required argument and further configures the resulting subcommand with the given action.