Class CustomArgument<T,B>
java.lang.Object
dev.jorel.commandapi.AbstractArgumentTree<dev.jorel.commandapi.arguments.Argument<T>, dev.jorel.commandapi.arguments.Argument<?>, org.bukkit.command.CommandSender>
dev.jorel.commandapi.arguments.AbstractArgument<T, dev.jorel.commandapi.arguments.Argument<T>, dev.jorel.commandapi.arguments.Argument<?>, org.bukkit.command.CommandSender>
dev.jorel.commandapi.arguments.Argument<T>
dev.jorel.commandapi.arguments.CustomArgument<T,B>
- Type Parameters:
T- the return type of this custom argument when it is usedB- the return type of the underlying base argumentbase. For example, this would beIntegerfor anIntegerArgument
- All Implemented Interfaces:
dev.jorel.commandapi.BukkitExecutable<dev.jorel.commandapi.arguments.Argument<T>>, dev.jorel.commandapi.ChainableBuilder<dev.jorel.commandapi.arguments.Argument<T>>, dev.jorel.commandapi.PlatformExecutable<dev.jorel.commandapi.arguments.Argument<T>, org.bukkit.command.CommandSender>
public class CustomArgument<T,B>
extends dev.jorel.commandapi.arguments.Argument<T>
An argument that represents any custom object
- Since:
- 2.0
- API Note:
- Returns a
Tobject
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classAn exception used to create command-related errors for the CustomArgumentstatic final recordA record which contains information which can be passed to the custom argument's parser.static interfaceA FunctionalInterface that takes in aCustomArgument.CustomArgumentInfo, returns T and can throw aCustomArgument.CustomArgumentExceptionstatic classMessageBuilder is used to create error messages for invalid argument inputs -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected dev.jorel.commandapi.CommandAPIExecutor<org.bukkit.command.CommandSender, dev.jorel.commandapi.commandsenders.AbstractCommandSender<? extends org.bukkit.command.CommandSender>> -
Constructor Summary
ConstructorsConstructorDescriptionCustomArgument(dev.jorel.commandapi.arguments.Argument<B> base, CustomArgument.CustomArgumentInfoParser<T, B> parser) Creates a CustomArgument with a valid parser, with an underlying base argument as its parsing implementation. -
Method Summary
Modifier and TypeMethodDescriptiondev.jorel.commandapi.arguments.Argument<T> dev.jorel.commandapi.arguments.CommandAPIArgumentTypedev.jorel.commandapi.CommandAPIExecutor<org.bukkit.command.CommandSender, dev.jorel.commandapi.commandsenders.AbstractCommandSender<? extends org.bukkit.command.CommandSender>> <CommandSourceStack>
TparseArgument(com.mojang.brigadier.context.CommandContext<CommandSourceStack> cmdCtx, String key, dev.jorel.commandapi.executors.CommandArguments previousArgs) voidsetExecutor(dev.jorel.commandapi.CommandAPIExecutor<org.bukkit.command.CommandSender, dev.jorel.commandapi.commandsenders.AbstractCommandSender<? extends org.bukkit.command.CommandSender>> arg0) Methods inherited from class dev.jorel.commandapi.arguments.Argument
instanceMethods inherited from class dev.jorel.commandapi.arguments.AbstractArgument
combineWith, copyPermissionsAndRequirements, getArgumentPermission, getCombinedArguments, getEntityNames, getHelpString, getIncludedSuggestions, getNodeName, getOverriddenSuggestions, getRawType, getRawTypeSupplier, getRequirements, hasCombinedArguments, includeSuggestions, isListed, isOptional, replaceSuggestions, setListed, setOptional, toString, withPermission, withPermission, withRequirementMethods inherited from class dev.jorel.commandapi.AbstractArgumentTree
then, thenNested, thenNestedMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface dev.jorel.commandapi.BukkitExecutable
executes, executes, executes, executes, executesCommandBlock, executesCommandBlock, executesCommandBlock, executesCommandBlock, executesConsole, executesConsole, executesConsole, executesConsole, executesEntity, executesEntity, executesEntity, executesEntity, executesFeedbackForwarding, executesFeedbackForwarding, executesFeedbackForwarding, executesFeedbackForwarding, executesNative, executesNative, executesNative, executesNative, executesPlayer, executesPlayer, executesPlayer, executesPlayer, executesProxy, executesProxy, executesProxy, executesProxy, executesRemoteConsole, executesRemoteConsole, executesRemoteConsole, executesRemoteConsoleMethods inherited from interface dev.jorel.commandapi.PlatformExecutable
getExecutor
-
Field Details
-
executor
protected dev.jorel.commandapi.CommandAPIExecutor<org.bukkit.command.CommandSender, dev.jorel.commandapi.commandsenders.AbstractCommandSender<? extends org.bukkit.command.CommandSender>> executor
-
-
Constructor Details
-
CustomArgument
public CustomArgument(dev.jorel.commandapi.arguments.Argument<B> base, CustomArgument.CustomArgumentInfoParser<T, B> parser) Creates a CustomArgument with a valid parser, with an underlying base argument as its parsing implementation.- Parameters:
base- the base argument to use for this custom argument. This base argument will represent the parsing implementation for client side and server side parsing. This base argument cannot be aLiteralArgumentorMultiLiteralArgumentparser- ACustomArgument.CustomArgumentInfoparser object which includes information such as the command sender, previously declared arguments and current input. This parser should return an object of your choice.<T>the return type of this custom argument when it is used
<B>the return type of the underlying base argumentbase. For example, this would beIntegerfor anIntegerArgument
-
-
Method Details
-
getPrimitiveType
-
getArgumentType
-
parseArgument
-
getExecutor
public dev.jorel.commandapi.CommandAPIExecutor<org.bukkit.command.CommandSender, dev.jorel.commandapi.commandsenders.AbstractCommandSender<? extends org.bukkit.command.CommandSender>> getExecutor() -
setExecutor
public void setExecutor(dev.jorel.commandapi.CommandAPIExecutor<org.bukkit.command.CommandSender, dev.jorel.commandapi.commandsenders.AbstractCommandSender<? extends org.bukkit.command.CommandSender>> arg0) -
clearExecutors
-