enum

inline fun <E : Enum<E>> VelocityLiteralNode.enum(name: String, values: Iterable<E> = enumValues<E>().asList(), noinline block: VelocityArgumentNode<String>.() -> Unit)

Adds an enum-backed "choice" argument to this command.

Each enum constant is mapped to a lowercase token (e.g. FOO_BAR ->foo_bar). The argument will suggest those tokens for tab-completion.

Since Velocity has no custom argument type adapter, this uses a native StringArgumentType.word() with server-side suggestions. Invalid values are rejected when VelocityContext.enum is called during command execution.

See also


inline fun <E : Enum<E>> VelocityContext.enum(name: String): E

Returns the parsed enum value of an enum argument.

See also

Throws

CommandSyntaxException

if the input does not match any enum constant