Package org.incendo.cloud.paper.parser
Class RegistryEntryParser<C,E extends Keyed>
java.lang.Object
org.incendo.cloud.paper.parser.RegistryEntryParser<C,E>
- Type Parameters:
C- command sender typeE- registry element type
- All Implemented Interfaces:
ArgumentParser<C,,RegistryEntryParser.RegistryEntry<E>> MappedArgumentParser<C,,NamespacedKey, RegistryEntryParser.RegistryEntry<E>> SuggestionProvider<C>,SuggestionProviderHolder<C>
@API(status=EXPERIMENTAL)
public final class RegistryEntryParser<C,E extends Keyed>
extends Object
implements ArgumentParser<C,RegistryEntryParser.RegistryEntry<E>>, SuggestionProvider<C>, MappedArgumentParser<C,NamespacedKey,RegistryEntryParser.RegistryEntry<E>>
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classException when there is no registry entry for the provided key.static interfaceHolds a registry value and it's key.Nested classes/interfaces inherited from interface org.incendo.cloud.parser.ArgumentParser
ArgumentParser.FutureArgumentParser<C,T> Nested classes/interfaces inherited from interface org.incendo.cloud.parser.MappedArgumentParser
MappedArgumentParser.Mapper<C,I, O> -
Constructor Summary
ConstructorsConstructorDescriptionRegistryEntryParser(RegistryKey<E> registryKey) Create a newRegistryEntryParser. -
Method Summary
Modifier and TypeMethodDescriptionparse(@NonNull CommandContext<@NonNull C> commandContext, @NonNull CommandInput commandInput) static <C,E extends Keyed>
@NonNull ParserDescriptor<C, RegistryEntryParser.RegistryEntry<E>> registryEntryParser(RegistryKey<E> registryKey, TypeToken<E> elementType) Creates aRegistryEntryParser.@NonNull CompletableFuture<? extends @NonNull Iterable<? extends @NonNull Suggestion>> suggestionsFuture(@NonNull CommandContext<C> commandContext, @NonNull CommandInput input) 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
-
RegistryEntryParser
Create a newRegistryEntryParser.- Parameters:
registryKey- registry key
-
-
Method Details
-
registryEntryParser
@API(status=STABLE, since="2.0.0") public static <C,E extends Keyed> @NonNull ParserDescriptor<C,RegistryEntryParser.RegistryEntry<E>> registryEntryParser(RegistryKey<E> registryKey, TypeToken<E> elementType) Creates aRegistryEntryParser.- Type Parameters:
C- command sender typeE- registry element type- Parameters:
registryKey- registry keyelementType- registry element type- Returns:
- the created parser
- Since:
- 2.0.0
-
parse
public @NonNull ArgumentParseResult<RegistryEntryParser.RegistryEntry<@NonNull E>> parse(@NonNull CommandContext<@NonNull C> commandContext, @NonNull CommandInput commandInput) - Specified by:
parsein interfaceArgumentParser<C,E extends Keyed>
-
baseParser
- Specified by:
baseParserin interfaceMappedArgumentParser<C,NamespacedKey, RegistryEntryParser.RegistryEntry<E extends Keyed>>
-
suggestionsFuture
public @NonNull CompletableFuture<? extends @NonNull Iterable<? extends @NonNull Suggestion>> suggestionsFuture(@NonNull CommandContext<C> commandContext, @NonNull CommandInput input) - Specified by:
suggestionsFuturein interfaceSuggestionProvider<C>
-