Class ComponentArgumentType
java.lang.Object
net.kyori.adventure.platform.fabric.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 fully function, adventure-platform-fabric must also be present on the client. Clients without the mod will receive fallback types existing in the base game.
- Since:
- 4.0.0
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
Supported text formats for registering components. -
Method Summary
Modifier and TypeMethodDescriptionstatic @NotNull ComponentArgumentType
Deprecated, for removal: This API element is subject to removal in a future version.static @NotNull Component
Get the component from the provided context.static @NotNull ComponentArgumentType
component
(@NotNull ComponentArgumentType.Format format) Get an argument type for component arguments.@NotNull ComponentArgumentType.Format
format()
Get the format used for this argument.@NotNull Collection<String>
static @NotNull ComponentArgumentType
json()
Get the argument type for component arguments in JSON format.static @NotNull ComponentArgumentType
Get the argument type for component arguments in MiniMessage format.@NotNull Component
parse
(@NotNull com.mojang.brigadier.StringReader reader) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.mojang.brigadier.arguments.ArgumentType
listSuggestions
-
Method Details
-
component
@Deprecated(forRemoval=true, since="5.1.0") @NotNull public static @NotNull ComponentArgumentType component()Deprecated, for removal: This API element is subject to removal in a future version.usejson()
orminiMessage()
instead.Get the argument type for component arguments.- Returns:
- argument type instance
- Since:
- 4.0.0
-
component
@NotNull public static @NotNull Component component(@NotNull @NotNull com.mojang.brigadier.context.CommandContext<?> ctx, @NotNull @NotNull String key) Get the component from the provided context.- Parameters:
ctx
- Context to get fromkey
- argument key- Returns:
- parsed component
- Since:
- 4.0.0
-
json
Get the argument type for component arguments in JSON format.- Returns:
- argument type instance
- Since:
- 5.1.0
-
miniMessage
Get the argument type for component arguments in MiniMessage format.- Returns:
- argument type instance
- Since:
- 5.1.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:
- 5.1.0
-
parse
@NotNull public @NotNull Component parse(@NotNull @NotNull com.mojang.brigadier.StringReader reader) throws com.mojang.brigadier.exceptions.CommandSyntaxException - Specified by:
parse
in interfacecom.mojang.brigadier.arguments.ArgumentType<Component>
- Throws:
com.mojang.brigadier.exceptions.CommandSyntaxException
-
getExamples
- Specified by:
getExamples
in interfacecom.mojang.brigadier.arguments.ArgumentType<Component>
-
format
Get the format used for this argument.- Returns:
- the format used for this argument
- Since:
- 4.1.0
-
json()
orminiMessage()
instead.