Enum CommandResult
- java.lang.Object
-
- java.lang.Enum<CommandResult>
-
- com.github.siroshun09.mccommand.common.CommandResult
-
- All Implemented Interfaces:
Serializable
,Comparable<CommandResult>
public enum CommandResult extends Enum<CommandResult>
Enumeration class of command execution results.
-
-
Enum Constant Summary
Enum Constants Enum Constant Description EXCEPTION_OCCURRED
If an exception is thrown while executing the command.INVALID_ARGUMENTS
If the argument is invalid.NO_ARGUMENT
If there are no arguments.NO_PERMISSION
If the sender does not have the permission to execute command.NOT_PLAYER
If the sender is not the player.STATE_ERROR
If the state is wrong.SUCCESS
If the command is successfully executed.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static CommandResult
valueOf(String name)
Returns the enum constant of this type with the specified name.static CommandResult[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.boolean
wasFailure()
Checks if it indicates failure.boolean
wasSuccessful()
Checks if it isSUCCESS
, indicating success.
-
-
-
Enum Constant Detail
-
EXCEPTION_OCCURRED
public static final CommandResult EXCEPTION_OCCURRED
If an exception is thrown while executing the command.
-
INVALID_ARGUMENTS
public static final CommandResult INVALID_ARGUMENTS
If the argument is invalid.
-
NOT_PLAYER
public static final CommandResult NOT_PLAYER
If the sender is not the player.
-
NO_ARGUMENT
public static final CommandResult NO_ARGUMENT
If there are no arguments.
-
NO_PERMISSION
public static final CommandResult NO_PERMISSION
If the sender does not have the permission to execute command.
-
STATE_ERROR
public static final CommandResult STATE_ERROR
If the state is wrong.
-
SUCCESS
public static final CommandResult SUCCESS
If the command is successfully executed.
-
-
Method Detail
-
values
public static CommandResult[] 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 (CommandResult c : CommandResult.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static CommandResult 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
-
wasSuccessful
public boolean wasSuccessful()
Checks if it isSUCCESS
, indicating success.- Returns:
true
if the enumeration value isSUCCESS
,false
otherwise.
-
wasFailure
public boolean wasFailure()
Checks if it indicates failure.- Returns:
false
if the enumeration value isSUCCESS
,true
otherwise.
-
-