feat: add handling and checking for MindStone

This commit is contained in:
2021-05-18 13:21:36 +02:00
parent 4b69cca440
commit 729a1d4a71
2 changed files with 26 additions and 7 deletions

View File

@ -13,20 +13,19 @@ public enum StoneType {
SoulStone(5);
private final int id;
private final static HashMap<Integer, StoneType> map;
private final static HashMap<Integer, StoneType> map = new HashMap<>();
private StoneType(int id) {
StoneType(int id) {
this.id = id;
}
static {
map = new HashMap<>();
for (StoneType stoneType : StoneType.values()) {
for (StoneType stoneType: StoneType.values()) {
map.put(stoneType.id, stoneType);
}
}
public static StoneType valueOf (int stoneType) {
public static StoneType valueOf(int stoneType) {
return map.get(stoneType);
}