diff --git a/src/main/java/uulm/teamname/marvelous/gamelibrary/entities/StoneType.java b/src/main/java/uulm/teamname/marvelous/gamelibrary/entities/StoneType.java index c2cecca..909f4f0 100644 --- a/src/main/java/uulm/teamname/marvelous/gamelibrary/entities/StoneType.java +++ b/src/main/java/uulm/teamname/marvelous/gamelibrary/entities/StoneType.java @@ -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 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; + } }