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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
|
package eu.olli.cowmoonication.data;
import eu.olli.cowmoonication.util.Utils;
import org.apache.commons.lang3.StringUtils;
public class HyStalkingData {
private boolean success;
private String cause;
private HySession session;
/**
* No-args constructor for GSON
*/
private HyStalkingData() {
}
public boolean isSuccess() {
return success;
}
public String getCause() {
return cause;
}
public HySession getSession() {
return session;
}
public static class HySession {
private boolean online;
private String gameType;
private String mode;
private String map;
/**
* No-args constructor for GSON
*/
private HySession() {
}
public boolean isOnline() {
return online;
}
public String getGameType() {
String cleanGameType;
try {
cleanGameType = GameType.valueOf(gameType).getCleanName();
} catch (IllegalArgumentException e) {
// no matching game type found
cleanGameType = Utils.fancyCase(gameType);
}
return cleanGameType;
}
public String getMode() {
// modes partially taken from https://api.hypixel.net/gameCounts?key=MOO
if (mode == null) {
return null;
}
String gameType = getGameType();
if (GameType.BEDWARS.cleanName.equals(gameType)) {
// BedWars related
String playerMode;
String specialMode;
int specialModeStart = StringUtils.ordinalIndexOf(mode, "_", 2);
if (specialModeStart > -1) {
playerMode = mode.substring(0, specialModeStart);
specialMode = mode.substring(specialModeStart + 1) + " ";
} else {
playerMode = mode;
specialMode = "";
}
String playerModeClean;
switch (playerMode) {
case "EIGHT_ONE":
playerModeClean = "Solo";
break;
case "EIGHT_TWO":
playerModeClean = "Doubles";
break;
case "FOUR_THREE":
playerModeClean = "3v3v3v3";
break;
case "FOUR_FOUR":
playerModeClean = "4v4v4v4";
break;
case "TWO_FOUR":
playerModeClean = "4v4";
break;
default:
playerModeClean = playerMode;
}
return Utils.fancyCase(specialMode + playerModeClean);
} else if (GameType.SKYBLOCK.cleanName.equals(gameType)) {
// SkyBlock related
switch (mode) {
case "dynamic":
return "Private Island";
case "hub":
return "Hub";
case "combat_1":
return "Spider's Den";
case "combat_2":
return "Blazing Fortress";
case "combat_3":
return "The End";
case "farming_1":
return "The Barn";
case "farming_2":
return "Mushroom Desert";
case "foraging_1":
return "The Park";
case "mining_1":
return "Gold Mine";
case "mining_2":
return "Deep Caverns";
}
}
return Utils.fancyCase(mode);
}
public String getMap() {
return map;
}
// TODO replace with api request: https://github.com/HypixelDev/PublicAPI/blob/master/Documentation/misc/GameType.md
public enum GameType {
QUAKECRAFT("Quakecraft"),
WALLS("Walls"),
PAINTBALL("Paintball"),
SURVIVAL_GAMES("Blitz Survival Games"),
TNTGAMES("The TNT Games"),
VAMPIREZ("VampireZ"),
WALLS3("Mega Walls"),
ARCADE("Arcade"),
ARENA("Arena Brawl"),
UHC("UHC Champions"),
MCGO("Cops and Crims"),
BATTLEGROUND("Warlords"),
SUPER_SMASH("Smash Heroes"),
GINGERBREAD("Turbo Kart Racers"),
HOUSING("Housing"),
SKYWARS("SkyWars"),
TRUE_COMBAT("Crazy Walls"),
SPEED_UHC("Speed UHC"),
SKYCLASH("SkyClash"),
LEGACY("Classic Games"),
PROTOTYPE("Prototype"),
BEDWARS("Bed Wars"),
MURDER_MYSTERY("Murder Mystery"),
BUILD_BATTLE("Build Battle"),
DUELS("Duels"),
SKYBLOCK("SkyBlock"),
PIT("Pit");
private final String cleanName;
GameType(String cleanName) {
this.cleanName = cleanName;
}
public String getCleanName() {
return cleanName;
}
}
}
}
|