Package org.bukkit
Enum Difficulty
- java.lang.Object
-
- java.lang.Enum<Difficulty>
-
- org.bukkit.Difficulty
-
- All Implemented Interfaces:
Serializable
,Comparable<Difficulty>
public enum Difficulty extends Enum<Difficulty>
Represents the various difficulty levels that are available.
-
-
Enum Constant Summary
Enum Constants Enum Constant Description EASY
Hostile mobs spawn, enemies deal less damage than on normal difficulty, the hunger bar does deplete and starving deals up to 5 hearts of damage.HARD
Hostile mobs spawn, enemies deal greater damage than on normal difficulty, the hunger bar does deplete and starving can kill players.NORMAL
Hostile mobs spawn, enemies deal normal amounts of damage, the hunger bar does deplete and starving deals up to 9.5 hearts of damage.PEACEFUL
Players regain health over time, hostile mobs don't spawn, the hunger bar does not deplete.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static Difficulty
getByValue(int value)
Deprecated.Magic valueint
getValue()
Deprecated.Magic valuestatic Difficulty
valueOf(String name)
Returns the enum constant of this type with the specified name.static Difficulty[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
PEACEFUL
public static final Difficulty PEACEFUL
Players regain health over time, hostile mobs don't spawn, the hunger bar does not deplete.
-
EASY
public static final Difficulty EASY
Hostile mobs spawn, enemies deal less damage than on normal difficulty, the hunger bar does deplete and starving deals up to 5 hearts of damage. (Default value)
-
NORMAL
public static final Difficulty NORMAL
Hostile mobs spawn, enemies deal normal amounts of damage, the hunger bar does deplete and starving deals up to 9.5 hearts of damage.
-
HARD
public static final Difficulty HARD
Hostile mobs spawn, enemies deal greater damage than on normal difficulty, the hunger bar does deplete and starving can kill players.
-
-
Method Detail
-
values
public static Difficulty[] 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 (Difficulty c : Difficulty.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static Difficulty 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
-
getValue
@Deprecated public int getValue()
Deprecated.Magic valueGets the difficulty value associated with this Difficulty.- Returns:
- An integer value of this difficulty
-
getByValue
@Deprecated @Nullable public static Difficulty getByValue(int value)
Deprecated.Magic valueGets the Difficulty represented by the specified value- Parameters:
value
- Value to check- Returns:
- Associative
Difficulty
with the given value, or null if it doesn't exist
-
-