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
|
package cc.polyfrost.oneconfig.utils.hypixel;
import com.google.gson.annotations.SerializedName;
import java.util.Objects;
/**
* Represents the location of the player in Hypixel.
* <p>
* Locraw utilities taken from Seraph by Scherso under LGPL-2.1
* <a href="https://github.com/Scherso/Seraph/blob/master/LICENSE">https://github.com/Scherso/Seraph/blob/master/LICENSE</a>
* </p>
*
* @see HypixelUtils
*/
public class LocrawInfo {
@SerializedName("server")
private String serverId;
@SerializedName("mode")
private String gameMode = "lobby";
@SerializedName("map")
private String mapName;
@SerializedName("gametype")
private String rawGameType;
private GameType gameType;
/**
* @return The serverID of the server you are currently on, ex: mini121
*/
public String getServerId() {
return serverId;
}
/**
* @return The GameType of the server as a String.
*/
public String getRawGameType() {
return rawGameType;
}
/**
* @return The GameMode of the server, ex: solo_insane
*/
public String getGameMode() {
return gameMode;
}
/**
* @return The GameType of the server as an Enum.
*/
public GameType getGameType() {
return gameType;
}
/**
* @param gameType The GameType to set it to.
*/
public void setGameType(GameType gameType) {
this.gameType = gameType;
}
/**
* @return The map of the server, ex: Shire.
*/
public String getMapName() {
return mapName;
}
@Override
public String toString() {
return "LocrawInfo{" + "serverId='" + serverId + '\'' + ", gameMode='" + gameMode + '\'' + ", mapName='" + mapName + '\'' + ", rawGameType='" + rawGameType + '\'' + '}';
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
LocrawInfo that = (LocrawInfo) o;
return Objects.equals(serverId, that.serverId) && Objects.equals(gameMode, that.gameMode) && Objects.equals(mapName, that.mapName) && Objects.equals(rawGameType, that.rawGameType);
}
@Override
public int hashCode() {
return Objects.hash(serverId, gameMode, mapName, rawGameType);
}
public enum GameType {
UNKNOWN(""), LIMBO("LIMBO"), BEDWARS("BEDWARS"), SKYWARS("SKYWARS"), PROTOTYPE("PROTOTYPE"), SKYBLOCK("SKYBLOCK"), MAIN("MAIN"), MURDER_MYSTERY("MURDER_MYSTERY"), HOUSING("HOUSING"), ARCADE_GAMES("ARCADE"), BUILD_BATTLE("BUILD_BATTLE"), DUELS("DUELS"), PIT("PIT"), UHC_CHAMPIONS("UHC"), SPEED_UHC("SPEED_UHC"), TNT_GAMES("TNTGAMES"), CLASSIC_GAMES("LEGACY"), COPS_AND_CRIMS("MCGO"), BLITZ_SG("SURVIVAL_GAMES"), MEGA_WALLS("WALLS3"), SMASH_HEROES("SUPER_SMASH"), WARLORDS("BATTLEGROUND");
private final String serverName;
GameType(String serverName) {
this.serverName = serverName;
}
public static GameType getFromLocraw(String gameType) {
for (GameType value : values()) {
if (value.serverName.equals(gameType)) {
return value;
}
}
return UNKNOWN;
}
public String getServerName() {
return serverName;
}
}
}
|