use of cc.hyperium.utils.staff.StaffSettings in project Hyperium by HyperiumClient.
the class StaffUtils method getBoosters.
private static HashMap<UUID, StaffSettings> getBoosters() throws IOException {
HashMap<UUID, StaffSettings> boosters = new HashMap<>();
String raw = HttpUtil.get(new URL("https://api.github.com/gists/b070e7f75a9083d2e211caffa0c772cc"));
String content = new JsonHolder(raw).optJSONObject("files").optJSONObject("boosters.json").optString("content");
JsonParser parser = new JsonParser();
JsonArray array = parser.parse(content).getAsJsonArray();
int bound = array.size();
for (int i = 0; i < bound; i++) {
JsonObject item = array.get(i).getAsJsonObject();
UUID uuid = UUID.fromString(item.get("uuid").getAsString());
String colourStr = item.get("color").getAsString().toUpperCase();
DotColour colour = colourStr.equals("CHROMA") ? new DotColour(true, ChatColor.WHITE) : new DotColour(false, ChatColor.valueOf(colourStr));
boosters.put(uuid, new StaffSettings(colour));
}
return boosters;
}
use of cc.hyperium.utils.staff.StaffSettings in project Hyperium by HyperiumClient.
the class StaffUtils method getStaff.
private static HashMap<UUID, StaffSettings> getStaff() throws IOException {
HashMap<UUID, StaffSettings> staff = new HashMap<>();
String content = HttpUtil.get(new URL("https://raw.githubusercontent.com/HyperiumClient/Hyperium-Repo/master/files/staff.json"));
JsonParser parser = new JsonParser();
JsonArray array = parser.parse(content).getAsJsonArray();
int bound = array.size();
for (int i = 0; i < bound; i++) {
JsonObject item = array.get(i).getAsJsonObject();
UUID uuid = UUID.fromString(item.get("uuid").getAsString());
String colourStr = item.get("color").getAsString().toUpperCase();
DotColour colour = colourStr.equals("CHROMA") ? new DotColour(true, ChatColor.WHITE) : new DotColour(false, ChatColor.valueOf(colourStr));
staff.put(uuid, new StaffSettings(colour));
}
return staff;
}
Aggregations