feat: added integer conversion to StoneType enum
This commit is contained in:
parent
f4123481bc
commit
1cb2c145d1
@ -1,11 +1,36 @@
|
||||
package uulm.teamname.marvelous.gamelibrary.entities;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/** Specifies the type of an {@link InfinityStone}. */
|
||||
public enum StoneType {
|
||||
SpaceStone,
|
||||
MindStone,
|
||||
RealityStone,
|
||||
PowerStone,
|
||||
TimeStone,
|
||||
SoulStone
|
||||
SpaceStone(0),
|
||||
MindStone(1),
|
||||
RealityStone(2),
|
||||
PowerStone(3),
|
||||
TimeStone(4),
|
||||
SoulStone(5);
|
||||
|
||||
private final int id;
|
||||
private final static HashMap<Integer, StoneType> map;
|
||||
|
||||
private StoneType(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
static {
|
||||
map = new HashMap<>();
|
||||
for (StoneType stoneType : StoneType.values()) {
|
||||
map.put(stoneType.id, stoneType);
|
||||
}
|
||||
}
|
||||
|
||||
public static StoneType valueOf (int stoneType) {
|
||||
return map.get(stoneType);
|
||||
}
|
||||
|
||||
public int getID() {
|
||||
return id;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user