Package org.incendo.cloud.bukkit.parser
Class ItemStackParser<C>
java.lang.Object
org.incendo.cloud.bukkit.parser.ItemStackParser<C>
- Type Parameters:
C- Command sender type
- All Implemented Interfaces:
ArgumentParser<C,,ProtoItemStack> ArgumentParser.FutureArgumentParser<C,,ProtoItemStack> SuggestionProviderHolder<C>
public class ItemStackParser<C>
extends Object
implements ArgumentParser.FutureArgumentParser<C,ProtoItemStack>
Parser for a
Material and optional extra NBT data into a ProtoItemStack.
This parser only provides basic suggestions by default. On Minecraft 1.13 and newer, enabling Brigadier
compatibility through BukkitCommandManager.registerBrigadier() will allow client side validation and
suggestions to be utilized.
- Since:
- 1.5.0
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.incendo.cloud.parser.ArgumentParser
ArgumentParser.FutureArgumentParser<C,T> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <C> @NonNull CommandComponent.Builder<C, ProtoItemStack> Returns aCommandComponent.BuilderusingitemStackParser()as the parser.static <C> @NonNull ParserDescriptor<C, ProtoItemStack> Creates a new item stack parser.parseFuture(@NonNull CommandContext<C> commandContext, @NonNull CommandInput commandInput) final @NonNull SuggestionProvider<C> 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, mapSuccessMethods inherited from interface org.incendo.cloud.parser.ArgumentParser.FutureArgumentParser
parse
-
Constructor Details
-
ItemStackParser
public ItemStackParser()Create a newItemStackParser.- Since:
- 1.5.0
-
-
Method Details
-
itemStackParser
@API(status=STABLE, since="2.0.0") public static <C> @NonNull ParserDescriptor<C,ProtoItemStack> itemStackParser()Creates a new item stack parser.- Type Parameters:
C- command sender type- Returns:
- the created parser
- Since:
- 2.0.0
-
itemStackComponent
@API(status=STABLE, since="2.0.0") public static <C> @NonNull CommandComponent.Builder<C,ProtoItemStack> itemStackComponent()Returns aCommandComponent.BuilderusingitemStackParser()as the parser.- Type Parameters:
C- the command sender type- Returns:
- the component builder
- Since:
- 2.0.0
-
parseFuture
public final @NonNull CompletableFuture<@NonNull ArgumentParseResult<ProtoItemStack>> parseFuture(@NonNull CommandContext<C> commandContext, @NonNull CommandInput commandInput) - Specified by:
parseFuturein interfaceArgumentParser<C,ProtoItemStack> - Specified by:
parseFuturein interfaceArgumentParser.FutureArgumentParser<C,ProtoItemStack>
-
suggestionProvider
- Specified by:
suggestionProviderin interfaceArgumentParser<C,ProtoItemStack> - Specified by:
suggestionProviderin interfaceSuggestionProviderHolder<C>
-