use of com.glitchcog.fontificator.emoji.loader.twitch.TwitchEmoteV2 in project ChatGameFontificator by GlitchCog.
the class EmojiParser method parseTwitchEmoteJsonV2.
/**
* Parse emotes loaded using Twitch's emote API version 2
*
* Twitch V2 API retired on February 14, 2017
*
* @param manager
* @param jsonData
* @param jsonMapData
* @throws IOException
*/
@Deprecated
private void parseTwitchEmoteJsonV2(EmojiManager manager, String jsonData, String jsonMapData) throws IOException {
TypedEmojiMap emoji = manager.getEmojiByType(EmojiType.TWITCH_V2);
JsonElement emoteElement = new JsonParser().parse(jsonData).getAsJsonObject().get("emoticons");
Gson gson = new Gson();
Type emoteType = new TypeToken<TwitchEmoteV2[]>() {
}.getType();
TwitchEmoteV2[] jsonEmoteObjects = gson.fromJson(emoteElement, emoteType);
for (TwitchEmoteV2 e : jsonEmoteObjects) {
// For Twitch emotes V2, there are no multi-image emotes, I think, based on the JSON structure
LazyLoadEmoji lle = new LazyLoadEmoji(e.getRegex(), e.getUrl(), e.getWidth(), e.getHeight(), EmojiType.TWITCH_V2);
lle.setSubscriber(e.isSubscriber_only());
lle.setState(e.getState());
emoji.put(e.getRegex(), lle);
}
logBox.log(jsonEmoteObjects.length + " Twitch emote" + (jsonEmoteObjects.length == 1 ? "" : "s") + " loaded");
}
Aggregations