Class ComponentParser<C>
java.lang.Object
org.incendo.cloud.minecraft.extras.parser.ComponentParser<C>
- Type Parameters:
C- Command sender type
- All Implemented Interfaces:
ArgumentParser<C,,Component> SuggestionProviderHolder<C>
- Since:
- 2.0.0
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.incendo.cloud.parser.ArgumentParser
ArgumentParser.FutureArgumentParser<C,T> -
Constructor Summary
ConstructorsConstructorDescriptionComponentParser(@NonNull Function<String, ? extends Component> componentDecoder, @NonNull StringParser.StringMode stringMode) Construct a new component parser. -
Method Summary
Modifier and TypeMethodDescriptionstatic <C> @NonNull CommandComponent.Builder<C, Component> componentComponent(@NonNull Function<String, ? extends Component> componentDecoder, @NonNull StringParser.StringMode stringMode) Create a new command component builder for the provided component decoder using the provided string mode.Returns the component decoder used by this parser.static <C> @NonNull ParserDescriptor<C, Component> componentParser(@NonNull Function<String, ? extends Component> componentDecoder) Create a new parser descriptor for the provided component decoder using theStringParser.StringMode.QUOTEDmode.static <C> @NonNull ParserDescriptor<C, Component> componentParser(@NonNull Function<String, ? extends Component> componentDecoder, @NonNull StringParser.StringMode stringMode) Create a new parser descriptor for the provided component decoder using the provided string mode.static <C> @NonNull ParserDescriptor<C, Component> componentParser(@NonNull ComponentSerializer<?, ? extends Component, String> componentSerializer) Create a new parser descriptor for the provided component decoder using theStringParser.StringMode.QUOTEDmode.static <C> @NonNull ParserDescriptor<C, Component> componentParser(@NonNull ComponentSerializer<?, ? extends Component, String> componentSerializer, @NonNull StringParser.StringMode stringMode) Create a new parser descriptor for the provided component decoder using the provided string mode.static <C> @NonNull ParserDescriptor<C, Component> Create a new parser descriptor for the default MiniMessage serializer using theStringParser.StringMode.QUOTEDmode.static <C> @NonNull ParserDescriptor<C, Component> miniMessageParser(@NonNull StringParser.StringMode stringMode) Create a new parser descriptor for the default MiniMessage serializer using the provided string mode.parse(@NonNull CommandContext<@NonNull C> commandContext, @NonNull CommandInput commandInput) Returns the string mode used by this parser.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.incendo.cloud.parser.ArgumentParser
flatMap, flatMapSuccess, mapSuccess, parseFuture, suggestionProvider
-
Constructor Details
-
ComponentParser
@API(status=STABLE, since="2.0.0") public ComponentParser(@NonNull Function<String, ? extends Component> componentDecoder, @NonNull StringParser.StringMode stringMode) Construct a new component parser.- Parameters:
componentDecoder- the component decoder to deserialize the componentstringMode- the string mode to use for the input for the component decoder
-
-
Method Details
-
miniMessageParser
@API(status=STABLE, since="2.0.0") public static <C> @NonNull ParserDescriptor<C,Component> miniMessageParser()Create a new parser descriptor for the default MiniMessage serializer using theStringParser.StringMode.QUOTEDmode.- Type Parameters:
C- Command sender type- Returns:
- the parser descriptor
- Since:
- 2.0.0
-
miniMessageParser
@API(status=STABLE, since="2.0.0") public static <C> @NonNull ParserDescriptor<C,Component> miniMessageParser(@NonNull StringParser.StringMode stringMode) Create a new parser descriptor for the default MiniMessage serializer using the provided string mode.- Type Parameters:
C- Command sender type- Parameters:
stringMode- the string mode to use- Returns:
- the parser descriptor
- Since:
- 2.0.0
-
componentParser
@API(status=STABLE, since="2.0.0") public static <C> @NonNull ParserDescriptor<C,Component> componentParser(@NonNull ComponentSerializer<?, ? extends Component, String> componentSerializer) Create a new parser descriptor for the provided component decoder using theStringParser.StringMode.QUOTEDmode.- Type Parameters:
C- Command sender type- Parameters:
componentSerializer- the component serializer- Returns:
- the parser descriptor
- Since:
- 2.0.0
-
componentParser
@API(status=STABLE, since="2.0.0") public static <C> @NonNull ParserDescriptor<C,Component> componentParser(@NonNull Function<String, ? extends Component> componentDecoder) Create a new parser descriptor for the provided component decoder using theStringParser.StringMode.QUOTEDmode.- Type Parameters:
C- Command sender type- Parameters:
componentDecoder- the component decoder- Returns:
- the parser descriptor
- Since:
- 2.0.0
-
componentParser
@API(status=STABLE, since="2.0.0") public static <C> @NonNull ParserDescriptor<C,Component> componentParser(@NonNull ComponentSerializer<?, ? extends Component, String> componentSerializer, @NonNull StringParser.StringMode stringMode) Create a new parser descriptor for the provided component decoder using the provided string mode.- Type Parameters:
C- Command sender type- Parameters:
componentSerializer- the component decoderstringMode- the string mode to use- Returns:
- the parser descriptor
- Since:
- 2.0.0
-
componentParser
@API(status=STABLE, since="2.0.0") public static <C> @NonNull ParserDescriptor<C,Component> componentParser(@NonNull Function<String, ? extends Component> componentDecoder, @NonNull StringParser.StringMode stringMode) Create a new parser descriptor for the provided component decoder using the provided string mode.- Type Parameters:
C- Command sender type- Parameters:
componentDecoder- the component decoderstringMode- the string mode to use- Returns:
- the parser descriptor
- Since:
- 2.0.0
-
componentComponent
@API(status=STABLE, since="2.0.0") public static <C> @NonNull CommandComponent.Builder<C,Component> componentComponent(@NonNull Function<String, ? extends Component> componentDecoder, @NonNull StringParser.StringMode stringMode) Create a new command component builder for the provided component decoder using the provided string mode.- Type Parameters:
C- Command sender type- Parameters:
componentDecoder- the component decoderstringMode- the string mode to use- Returns:
- the command component builder
- Since:
- 2.0.0
-
parse
public @NonNull ArgumentParseResult<@NonNull Component> parse(@NonNull CommandContext<@NonNull C> commandContext, @NonNull CommandInput commandInput) - Specified by:
parsein interfaceArgumentParser<C,Component>
-
stringMode
Returns the string mode used by this parser.- Returns:
- the string mode
- Since:
- 2.0.0
-
componentDecoder
@API(status=STABLE, since="2.0.0") public @NonNull Function<String,? extends Component> componentDecoder()Returns the component decoder used by this parser.- Returns:
- the component decoder
- Since:
- 2.0.0
-