Enum CommandContextTransformer.Phase
- java.lang.Object
-
- java.lang.Enum<CommandContextTransformer.Phase>
-
- net.kautler.command.api.CommandContextTransformer.Phase
-
- All Implemented Interfaces:
Serializable
,Comparable<CommandContextTransformer.Phase>
- Enclosing interface:
- CommandContextTransformer<M>
public static enum CommandContextTransformer.Phase extends Enum<CommandContextTransformer.Phase>
The phases during which a command context transformer is called if one is provided for the given phase. The phases can be skipped if a former phase already provides the result of a later phase, or a phase causes a command not found event being fired which will stop processing completely.The five main phases that are handled are in order initialization, prefix computation, alias and parameter string computation, command computation, and command execution. For all but the first and last, there is a before and an after sub phase each during which the command context transformer is called.
If at the end of the initialization phase, or any before / after sub phases the command is set in the context, processing is fast forwarded immediately to the command execution phase and all other inbetween phases and sub phases are skipped.
If at the end of the initialization phase, or any before / after sub phases before the
BEFORE_COMMAND_COMPUTATION
sub phase, the alias is set in the context, processing is fast forwarded immediately to the before command computation sub phase and all other inbetween phases and sub phases are skipped.If at the end of the initialization phase, or any before / after sub phases before the
BEFORE_ALIAS_AND_PARAMETER_STRING_COMPUTATION
sub phase, the prefix is set in the context, processing is fast forwarded immediately to the before alias and parameter string computation sub phase and all other inbetween phases and sub phases are skipped.
-
-
Enum Constant Summary
Enum Constants Enum Constant Description AFTER_ALIAS_AND_PARAMETER_STRING_COMPUTATION
At the start of this phase, usually only the message, message content, prefix, alias, and parameter string are set.AFTER_COMMAND_COMPUTATION
At the start of this phase, usually the command context is fully populated.AFTER_PREFIX_COMPUTATION
At the start of this phase, usually only the message, message content, and prefix are set.BEFORE_ALIAS_AND_PARAMETER_STRING_COMPUTATION
At the start of this phase, usually only the message, message content, and prefix are set.BEFORE_COMMAND_COMPUTATION
At the start of this phase, usually only the message, message content, prefix, alias, and parameter string are set.BEFORE_PREFIX_COMPUTATION
At the start of this phase, usually only the message, and message content are set.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static CommandContextTransformer.Phase
valueOf(String name)
Returns the enum constant of this type with the specified name.static CommandContextTransformer.Phase[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
BEFORE_PREFIX_COMPUTATION
public static final CommandContextTransformer.Phase BEFORE_PREFIX_COMPUTATION
At the start of this phase, usually only the message, and message content are set.
-
AFTER_PREFIX_COMPUTATION
public static final CommandContextTransformer.Phase AFTER_PREFIX_COMPUTATION
At the start of this phase, usually only the message, message content, and prefix are set.If at the end of this phase no fast forward was done and no prefix is set, a command not found event is being fired and processing stops completely.
-
BEFORE_ALIAS_AND_PARAMETER_STRING_COMPUTATION
public static final CommandContextTransformer.Phase BEFORE_ALIAS_AND_PARAMETER_STRING_COMPUTATION
At the start of this phase, usually only the message, message content, and prefix are set.If at the end of this phase no fast forward was done and no prefix is set, a command not found event is being fired and processing stops completely.
If at the end of this phase a prefix is set and it does not match the start of the message content, the message is ignored and processing stops completely. This is the only way to stop processing cleanly without getting a command not found event fired. This can also be achieved by fast forwarding to this phase by setting the prefix in an earlier phase and not doing anything in this phase actually, or not even registering for it.
-
AFTER_ALIAS_AND_PARAMETER_STRING_COMPUTATION
public static final CommandContextTransformer.Phase AFTER_ALIAS_AND_PARAMETER_STRING_COMPUTATION
At the start of this phase, usually only the message, message content, prefix, alias, and parameter string are set.If at the end of this phase no fast forward was done and no alias is set, a command not found event is being fired and processing stops completely.
-
BEFORE_COMMAND_COMPUTATION
public static final CommandContextTransformer.Phase BEFORE_COMMAND_COMPUTATION
At the start of this phase, usually only the message, message content, prefix, alias, and parameter string are set.If at the end of this phase no fast forward was done and no alias is set, a command not found event is being fired and processing stops completely.
-
AFTER_COMMAND_COMPUTATION
public static final CommandContextTransformer.Phase AFTER_COMMAND_COMPUTATION
At the start of this phase, usually the command context is fully populated.If at the end of this phase no command is set, a command not found event is being fired and processing stops completely.
-
-
Method Detail
-
values
public static CommandContextTransformer.Phase[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (CommandContextTransformer.Phase c : CommandContextTransformer.Phase.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static CommandContextTransformer.Phase valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is null
-
-