Class ArrayExecutionSource

java.lang.Object
io.github.projectunified.craftcommand.processor.ArrayExecutionSource
All Implemented Interfaces:
ExecutionSource

public class ArrayExecutionSource extends Object implements ExecutionSource
Array-based implementation of ExecutionSource for Bukkit/Standalone command execution.
  • Constructor Details

    • ArrayExecutionSource

      public ArrayExecutionSource(BaseCommandProcessor processor, String argsVar, boolean hasDynamic, String argIdxVar)
      Constructs an ArrayExecutionSource.
      Parameters:
      processor - the base command processor instance
      argsVar - the variable name of the arguments array
      hasDynamic - whether dynamic (global resolver) parameter resolution is required
      argIdxVar - 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: ExecutionSource
      Generates code to resolve and cast the command sender.
      Specified by:
      generateSenderResolution in interface ExecutionSource
      Parameters:
      methodSpec - the target method builder
      classModel - the command class model
      method - the command method model
      rootModel - the root command model
      senderVarName - the variable name to assign the sender to
      senderParam - the sender parameter model
      senderParamTypeName - 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: ExecutionSource
      Generates code for platform-specific execution setup or static checks (e.g. checking command length).
      Specified by:
      generateExecutionSetup in interface ExecutionSource
      Parameters:
      methodSpec - the target method builder
      classModel - the command class model
      method - the command method model
      rootModel - 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: ExecutionSource
      Generates code to parse and resolve a specific command parameter.
      Specified by:
      generateParameterResolution in interface ExecutionSource
      Parameters:
      methodSpec - the target method builder
      classModel - the command class model
      method - the command method model
      rootModel - the root command model
      p - the parameter model to resolve
      varName - the variable name to assign the resolved parameter to
      senderVarName - the variable name of the resolved sender
      paramIndex - the index of the parameter in the command method (excluding sender)