Class ComponentArgumentType
java.lang.Object
net.kyori.adventure.platform.modcommon.ComponentArgumentType
- All Implemented Interfaces:
com.mojang.brigadier.arguments.ArgumentType<Component>
public final class ComponentArgumentType
extends Object
implements com.mojang.brigadier.arguments.ArgumentType<Component>
An argument that takes JSON-format text.
For this argument type to function, adventure-platform must also be present on the client. In the Fabric environment, clients without adventure-platform will receive fallback argument types with limited functionality, in other environments clients without the mod are expected to error on join.
- Since:
- 6.0.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumSupported text formats for registering components. -
Method Summary
Modifier and TypeMethodDescriptionstatic @NotNull ComponentGet the component from the provided context.static @NotNull ComponentArgumentTypecomponent(@NotNull ComponentArgumentType.Format format) Get an argument type for component arguments.@NotNull ComponentArgumentType.Formatformat()Get the format used for this argument.@NotNull Collection<String> static @NotNull ComponentArgumentTypejson()Get the argument type for component arguments in JSON format.static @NotNull ComponentArgumentTypeGet the argument type for component arguments in MiniMessage format.@NotNull Componentparse(@NotNull com.mojang.brigadier.StringReader reader) Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.mojang.brigadier.arguments.ArgumentType
listSuggestions, parse
-
Method Details
-
component
-
json
Get the argument type for component arguments in JSON format.- Returns:
- argument type instance
- Since:
- 6.0.0
-
miniMessage
Get the argument type for component arguments in MiniMessage format.- Returns:
- argument type instance
- Since:
- 6.0.0
-
component
@NotNull public static @NotNull ComponentArgumentType component(@NotNull @NotNull ComponentArgumentType.Format format) Get an argument type for component arguments.- Parameters:
format- the format to use when parsing component text- Returns:
- an argument type
- Since:
- 6.0.0
-
parse
@NotNull public @NotNull Component parse(@NotNull @NotNull com.mojang.brigadier.StringReader reader) throws com.mojang.brigadier.exceptions.CommandSyntaxException - Specified by:
parsein interfacecom.mojang.brigadier.arguments.ArgumentType<Component>- Throws:
com.mojang.brigadier.exceptions.CommandSyntaxException
-
getExamples
- Specified by:
getExamplesin interfacecom.mojang.brigadier.arguments.ArgumentType<Component>
-
format
Get the format used for this argument.- Returns:
- the format used for this argument
- Since:
- 6.0.0
-