Interface CustomArgumentType.Converted<T,N>
- Type Parameters:
T
- custom typeN
- type with an argument native to vanilla Minecraft (fromArgumentTypes
)
- All Superinterfaces:
com.mojang.brigadier.arguments.ArgumentType<T>
,CustomArgumentType<T,
N>
- Enclosing interface:
CustomArgumentType<T,
N>
@Experimental
public static interface CustomArgumentType.Converted<T,N>
extends CustomArgumentType<T,N>
An argument type that wraps around a native-to-vanilla argument type.
This argument receives special handling in that the native argument type will
be sent to the client for possible client-side completions and syntax validation.
The parsed native type will be converted via convert(Object)
.
Implement CustomArgumentType
if you want to handle parsing the type manually.
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.papermc.paper.command.brigadier.argument.CustomArgumentType
CustomArgumentType.Converted<T,
N> -
Method Summary
Methods inherited from interface io.papermc.paper.command.brigadier.argument.CustomArgumentType
getExamples, getNativeType, listSuggestions
-
Method Details
-
parse
@NonExtendable default T parse(com.mojang.brigadier.StringReader reader) throws com.mojang.brigadier.exceptions.CommandSyntaxException Description copied from interface:CustomArgumentType
Parses the argument into the custom type (T
). Keep in mind that this parsing will be done on the server. This means that if you throw aCommandSyntaxException
during parsing, this will only show up to the user after the user has executed the command not while they are still entering it.- Specified by:
parse
in interfacecom.mojang.brigadier.arguments.ArgumentType<T>
- Specified by:
parse
in interfaceCustomArgumentType<T,
N> - Parameters:
reader
- string reader input- Returns:
- parsed value
- Throws:
com.mojang.brigadier.exceptions.CommandSyntaxException
- if an error occurs while parsing
-
convert
Converts the value from the native type to the custom argument type.- Parameters:
nativeType
- native argument provided value- Returns:
- converted value
- Throws:
com.mojang.brigadier.exceptions.CommandSyntaxException
- if an exception occurs while parsing
-