use of com.glitchcog.fontificator.emoji.loader.twitch.TwitchBadges in project ChatGameFontificator by GlitchCog.
the class EmojiParser method parseTwitchBadges.
private void parseTwitchBadges(TypedEmojiMap badgeMap, String jsonData) throws IOException {
JsonElement jsonElement = new JsonParser().parse(jsonData);
Gson gson = new Gson();
Type emoteType = new TypeToken<Map<String, TwitchBadges>>() {
}.getType();
Map<String, TwitchBadges> jsonMap = gson.fromJson(jsonElement, emoteType);
int badgeCount = 0;
for (Entry<String, TwitchBadges> badge : jsonMap.entrySet()) {
if (badge.getValue() != null && badge.getValue().getImage() != null) {
badgeCount++;
LazyLoadEmoji llBadge = new LazyLoadEmoji(badge.getKey(), badge.getValue().getImage(), TWITCH_BADGE_PIXEL_SIZE, TWITCH_BADGE_PIXEL_SIZE, EmojiType.TWITCH_BADGE);
badgeMap.put(badge.getKey(), llBadge);
}
}
logBox.log(badgeCount + " Twitch badge" + (badgeCount == 1 ? "" : "s") + " loaded");
}
Aggregations