aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/thatgravyboat/skyblockhud/dungeons/Classes.java
blob: 1c30045208853d15f7b102f0545b902105e201f3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package com.thatgravyboat.skyblockhud.dungeons;

public enum Classes {
  H("Healer", "H", 154),
  M("Mage", "M", 90),
  B("Berserk", "B", 122),
  A("Archer", "A", 58),
  T("Tank", "T", 186);

  private final String displayName;
  private final String classId;
  private final int textureY;

  Classes(String name, String id, int textureY) {
    this.displayName = name;
    this.classId = id;
    this.textureY = textureY;
  }

  public String getDisplayName() {
    return this.displayName;
  }

  public String getClassId() {
    return this.classId;
  }

  public int getTextureY() {
    return this.textureY;
  }

  public static Classes findClass(String input) {
    if (input.length() == 1) {
      try {
        return Classes.valueOf(input.toUpperCase());
      } catch (IllegalArgumentException ignored) {}
    } else if (input.length() == 3) {
      try {
        return Classes.valueOf(
          input.replace("[", "").replace("]", "").toUpperCase()
        );
      } catch (IllegalArgumentException ignored) {}
    } else {
      for (Classes clazz : Classes.values()) {
        if (clazz.displayName.equalsIgnoreCase(input)) return clazz;
      }
    }
    return B;
  }
}