Class ArrayExecutionSource
java.lang.Object
io.github.projectunified.craftcommand.processor.ArrayExecutionSource
- All Implemented Interfaces:
ExecutionSource
Array-based implementation of
ExecutionSource for Bukkit/Standalone command execution.-
Constructor Summary
ConstructorsConstructorDescriptionArrayExecutionSource(BaseCommandProcessor processor, String argsVar, boolean hasDynamic, String argIdxVar) Constructs an ArrayExecutionSource. -
Method Summary
Modifier and TypeMethodDescriptionvoidgenerateExecutionSetup(com.palantir.javapoet.MethodSpec.Builder methodSpec, CommandModel classModel, MethodModel method, CommandModel rootModel) Generates code for platform-specific execution setup or static checks (e.g. checking command length).voidgenerateParameterResolution(com.palantir.javapoet.MethodSpec.Builder methodSpec, CommandModel classModel, MethodModel method, CommandModel rootModel, ParameterModel p, String varName, String senderVarName, int paramIndex) Generates code to parse and resolve a specific command parameter.voidgenerateSenderResolution(com.palantir.javapoet.MethodSpec.Builder methodSpec, CommandModel classModel, MethodModel method, CommandModel rootModel, String senderVarName, ParameterModel senderParam, com.palantir.javapoet.TypeName senderParamTypeName) Generates code to resolve and cast the command sender.
-
Constructor Details
-
ArrayExecutionSource
public ArrayExecutionSource(BaseCommandProcessor processor, String argsVar, boolean hasDynamic, String argIdxVar) Constructs an ArrayExecutionSource.- Parameters:
processor- the base command processor instanceargsVar- the variable name of the arguments arrayhasDynamic- whether dynamic (global resolver) parameter resolution is requiredargIdxVar- the index pointer variable name
-
-
Method Details
-
generateSenderResolution
public void generateSenderResolution(com.palantir.javapoet.MethodSpec.Builder methodSpec, CommandModel classModel, MethodModel method, CommandModel rootModel, String senderVarName, ParameterModel senderParam, com.palantir.javapoet.TypeName senderParamTypeName) Description copied from interface:ExecutionSourceGenerates code to resolve and cast the command sender.- Specified by:
generateSenderResolutionin interfaceExecutionSource- Parameters:
methodSpec- the target method builderclassModel- the command class modelmethod- the command method modelrootModel- the root command modelsenderVarName- the variable name to assign the sender tosenderParam- the sender parameter modelsenderParamTypeName- the JavaPoet TypeName of the sender
-
generateExecutionSetup
public void generateExecutionSetup(com.palantir.javapoet.MethodSpec.Builder methodSpec, CommandModel classModel, MethodModel method, CommandModel rootModel) Description copied from interface:ExecutionSourceGenerates code for platform-specific execution setup or static checks (e.g. checking command length).- Specified by:
generateExecutionSetupin interfaceExecutionSource- Parameters:
methodSpec- the target method builderclassModel- the command class modelmethod- the command method modelrootModel- the root command model
-
generateParameterResolution
public void generateParameterResolution(com.palantir.javapoet.MethodSpec.Builder methodSpec, CommandModel classModel, MethodModel method, CommandModel rootModel, ParameterModel p, String varName, String senderVarName, int paramIndex) Description copied from interface:ExecutionSourceGenerates code to parse and resolve a specific command parameter.- Specified by:
generateParameterResolutionin interfaceExecutionSource- Parameters:
methodSpec- the target method builderclassModel- the command class modelmethod- the command method modelrootModel- the root command modelp- the parameter model to resolvevarName- the variable name to assign the resolved parameter tosenderVarName- the variable name of the resolved senderparamIndex- the index of the parameter in the command method (excluding sender)
-