Serializable
, Comparable<MatchType>
public enum MatchType extends Enum<MatchType>
Enum Constant | Description |
---|---|
DUEL |
A 1v1 duel between two players.
|
FREE_FOR_ALL |
A 1v1v1 free-for-all between three players.
|
TEAM |
A 2v2 team match for four players.
|
Modifier and Type | Method | Description |
---|---|---|
static MatchType |
byNumberOfPlayers(int numPlayers) |
Returns the match type that has the given number of players.
|
int |
getNumberOfPlayers() |
Returns the total number of players in matches of this type.
|
int |
getNumberOfTeams() |
Returns the number of teams in matches of this type.
|
String |
toString() |
Returns a human-readable name for this match type, either "Duel",
"Free-for-all", or "Team".
|
static MatchType |
valueOf(String name) |
Returns the enum constant of this type with the specified name.
|
static MatchType[] |
values() |
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final MatchType DUEL
public static final MatchType FREE_FOR_ALL
public static final MatchType TEAM
public static MatchType[] values()
for (MatchType c : MatchType.values()) System.out.println(c);
public static MatchType valueOf(String name)
name
- the name of the enum constant to be returned.IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is nullpublic String toString()
public int getNumberOfTeams()
public int getNumberOfPlayers()
public static MatchType byNumberOfPlayers(int numPlayers)
getNumberOfPlayers()
will return numPlayers for the
returned match type.numPlayers
- the number of players in the desired match typeIllegalArgumentException
- if numPlayers is not 2, 3, or 4