Expected behavior
If using CustomArgumentType<T, N> and also overriding the parse(reader, source) function, it should default to it instead of using the less advanced parse(reader) function.
This should make it possible to access the source and adapt the parsed content to it.
Observed/Actual behavior
Override the parse(reader, source) function does effectively nothing. There is no way to parse based on source/context, and it always only uses the parse(reader) function instead.
In code documentation (and the online Paper Docs) there is no word about this behavior, or how to deal with it, of the CustomArgumentType, so it looks like it is just not working as intended / thought.
Steps/models to reproduce
- Implement
CustomArgumentType<*, *>
- Override
parse(reader, source) as well
- Try to use it
Plugin and Datapack List
/
Paper version
This server is running Paper version 1.21.4-177-main@e5a8ee8 (2025-02-21T11:12:22Z) (Implementing API version 1.21.4-R0.1-SNAPSHOT)
You are running the latest version
Previous version: 1.21.4-175-ab984a0 (MC: 1.21.4)
Other
My class, rewritten for only the necessary parts
@Suppress("UnstableApiUsage")
object DemoArgumentType : CustomArgumentType<String, String> {
override fun parse(reader: StringReader): String {
return "wrong"
}
override fun <S : Any> parse(reader: StringReader, source: S): String {
return "right"
}
override fun getNativeType(): StringArgumentType =
StringArgumentType.word()
override fun <S : Any> listSuggestions(
context: CommandContext<S>,
builder: SuggestionsBuilder
) = CompletableFuture.supplyAsync {
builder.suggest("wrong").suggest("right").build()
}
}
Expected behavior
If using
CustomArgumentType<T, N>and also overriding theparse(reader, source)function, it should default to it instead of using the less advancedparse(reader)function.This should make it possible to access the source and adapt the parsed content to it.
Observed/Actual behavior
Override the
parse(reader, source)function does effectively nothing. There is no way to parse based on source/context, and it always only uses theparse(reader)function instead.In code documentation (and the online Paper Docs) there is no word about this behavior, or how to deal with it, of the
CustomArgumentType, so it looks like it is just not working as intended / thought.Steps/models to reproduce
CustomArgumentType<*, *>parse(reader, source)as wellPlugin and Datapack List
/
Paper version
This server is running Paper version 1.21.4-177-main@e5a8ee8 (2025-02-21T11:12:22Z) (Implementing API version 1.21.4-R0.1-SNAPSHOT)
You are running the latest version
Previous version: 1.21.4-175-ab984a0 (MC: 1.21.4)
Other
My class, rewritten for only the necessary parts