Uses of Class
com.ultikits.ultitools.abstracts.command.CommandContext
Packages that use CommandContext
Package
Description
New command handling framework with improved architecture.
Command validation framework using Chain of Responsibility pattern.
Built-in command validators.
-
Uses of CommandContext in com.ultikits.ultitools.abstracts.command
Methods in com.ultikits.ultitools.abstracts.command that return CommandContextModifier and TypeMethodDescriptionCommandContext.withMatchedMethod(Method method, String format) Creates a new context with a matched method.CommandContext.withParsedParams(Map<String, String[]> params) Creates a new context with additional parsed parameters.Methods in com.ultikits.ultitools.abstracts.command with parameters of type CommandContextModifier and TypeMethodDescriptionprivate voidBaseCommandExecutor.armTimeoutWatcher(CommandContext context, AsyncCommand asyncCommand, AtomicBoolean reported) Arms the delayed watcher that reports a timeout message to the sender if the command body has not already completed by then.protected Object[]BaseCommandExecutor.buildMethodParams(CommandContext context, Method method) Builds the method parameters from the command context.private static voidBaseCommandExecutor.completeAll(CommandContext context, List<CommandValidator> ranValidators, boolean commandSucceeded) Calls every validator'sonCompletein chain order.private voidBaseCommandExecutor.dispatchAsyncCommand(CommandContext context, AsyncCommand asyncCommand, org.bukkit.scheduler.BukkitRunnable runnable, AtomicBoolean reported, List<CommandValidator> ranValidators) Sends the optional "processing" message, dispatchesrunnableasynchronously exactly once, and arms the timeout watcher if configured.private static voidBaseCommandExecutor.dispatchScheduled(CommandContext context, List<CommandValidator> ranValidators, Runnable schedule) Hands a body to the scheduler; if the scheduler refuses it (the plugin is disabling, for example), the body never runs and so never reaches itsonCompletehooks, so the validators that passed are told of the refusal instead (#568) before the exception leaves.protected voidBaseCommandExecutor.executeCommand(CommandContext context, Method method, Object[] params, ValidatorChain.ChainValidationResult validationResult) Executes the command method.private booleanBaseCommandExecutor.handleGatedHelp(CommandContext context) Runs the sender-type and permission validators, then shows help if they pass.private voidBaseCommandExecutor.invokeCommandBody(CommandContext context, Method method, Object[] params, List<CommandValidator> ranValidators, TriggerContext triggerCtx, AtomicBoolean reported) Runs the matched command method plus its surrounding bookkeeping (audit-user context, post-action validator hooks, error reporting, the WIRE-12 completion flag) -- the body of theBukkitRunnableBaseCommandExecutor.executeCommand(com.ultikits.ultitools.abstracts.command.CommandContext, java.lang.reflect.Method, java.lang.Object[], com.ultikits.ultitools.abstracts.command.validation.ValidatorChain.ChainValidationResult)schedules.private static voidBaseCommandExecutor.notifyRefused(CommandContext context, ValidatorChain.ChainValidationResult validationResult) Tells each validator that passed for this dispatch that it was refused before the mapped method ran, in chain order, so a validator that acquired something invalidate--UsageLockValidator's lock -- releases it (#568).private static voidBaseCommandExecutor.notifyRefusedAndRethrow(CommandContext context, ValidatorChain.ChainValidationResult validationResult, RuntimeException cause) BaseCommandExecutor.notifyRefused(com.ultikits.ultitools.abstracts.command.CommandContext, com.ultikits.ultitools.abstracts.command.validation.ValidatorChain.ChainValidationResult)for a dispatch leaving bycause: every hook still runs, and a hook that throws is attached tocauseas suppressed rather than replacing it.private voidBaseCommandExecutor.reportCommandExecutionError(CommandContext context, Method method, Exception e, TriggerContext triggerCtx) Sends the user-facing failure message, logs the exception, and best-effort reports it toErrorReportCollectorfor a command method that threw.private ObjectBaseCommandExecutor.resolveCmdParam(CommandContext context, Parameter parameter, Class<?> paramType) private ObjectBaseCommandExecutor.resolveParameter(CommandContext context, Parameter parameter) private ObjectBaseCommandExecutor.resolveSender(CommandContext context, Class<?> paramType) -
Uses of CommandContext in com.ultikits.ultitools.abstracts.command.validation
Methods in com.ultikits.ultitools.abstracts.command.validation with parameters of type CommandContextModifier and TypeMethodDescriptionstatic booleanValidatorChain.isApplicable(CommandValidator validator, CommandContext context) The single applicability check every caller must use before asking a validator toCommandValidator.validate(com.ultikits.ultitools.abstracts.command.CommandContext).static voidValidatorChain.notifyRefused(CommandContext context, List<CommandValidator> passedValidators) CallsCommandValidator.onRefused(CommandContext)on each ofpassedValidators, in order, for a dispatch refused after they passed and before the mapped method ran (#568).private static RuntimeExceptionValidatorChain.notifyRefused(CommandContext context, List<CommandValidator> passedValidators, RuntimeException pending) Runs every refusal hook; returns the first exception a hook threw, or attaches it topending(an exception already on its way out) and returnsnull.default voidCommandValidator.onComplete(CommandContext context, boolean commandSucceeded) Invoked once, after the mapped command method has returned or thrown, for each validator whoseCommandValidator.validate(CommandContext)succeeded during the chain run that gated this invocation.default voidCommandValidator.onRefused(CommandContext context) Invoked once, instead ofCommandValidator.onComplete(CommandContext, boolean), for each validator whoseCommandValidator.validate(CommandContext)succeeded when the dispatch is then refused before the mapped method runs: by a validator later in the chain, by an exception from a later validator'sCommandValidator.shouldValidate(CommandContext)orCommandValidator.validate(CommandContext), by the argument-count check, or because a parameter could not be parsed.default booleanCommandValidator.shouldValidate(CommandContext context) Checks if this validator should be applied to the given context.CommandValidator.validate(CommandContext context) Validates the command context.ValidatorChain.validate(CommandContext context) Validates the context through all validators in the chain.ValidatorChain.validateAll(CommandContext context) Validates the context through all validators, collecting all failures. -
Uses of CommandContext in com.ultikits.ultitools.abstracts.command.validation.validators
Methods in com.ultikits.ultitools.abstracts.command.validation.validators with parameters of type CommandContextModifier and TypeMethodDescriptionbooleanUsageLockValidator.acquireLock(CommandContext context) Acquires a lock for command execution.voidCooldownValidator.applyCooldown(CommandContext context) Applies cooldown after command execution.private CmdTarget.CmdTargetTypeSenderTypeValidator.determineTargetType(CommandContext context) Determines the effective target type from context or method annotation.private IntegerCooldownValidator.getCooldownSeconds(Method method, CommandContext context) private static booleanCooldownValidator.isBoundMapping(Method method, CommandContext context) voidCooldownValidator.onComplete(CommandContext context, boolean commandSucceeded) Post-action hook that applies the cooldown recorded for this invocation.voidUsageLockValidator.onComplete(CommandContext context, boolean commandSucceeded) Post-action hook that releases the lock acquired byUsageLockValidator.validate(CommandContext)for this invocation.voidUsageLockValidator.onRefused(CommandContext context) Releases the lock this validator acquired for a dispatch that was then refused before the mapped method ran -- by a later validator (such as the cooldown, which runs after this one), the argument-count check, or parameter parsing.voidUsageLockValidator.releaseLock(CommandContext context) Releases a lock after command execution.private static voidCooldownValidator.reportUnresolvedBinding(CommandContext context, IllegalStateException cause) CooldownValidator.unresolvedBinding(CommandContext context, Method method) Fails the command closed for a config-bound@CmdCDthis validator never had resolved -- reachable only when aCooldownValidatoris added after the module loaded, or an executor is registered outside the module loader.CooldownValidator.validate(CommandContext context) PermissionValidator.validate(CommandContext context) SenderTypeValidator.validate(CommandContext context) UsageLockValidator.validate(CommandContext context) Validates -- and, per the acquire-then-execute contract on this class, ATTEMPTS TO ACQUIRE -- the lock for this invocation.