Search in sources :

Example 1 with Badge

use of com.glitchcog.fontificator.emoji.loader.frankerfacez.Badge in project ChatGameFontificator by GlitchCog.

the class EmojiParser method parseFrankerFaceZBadges.

private void parseFrankerFaceZBadges(EmojiManager manager, String jsonData) throws IOException {
    JsonElement ffzBadgesAndUsersElement = new JsonParser().parse(jsonData);
    Gson gson = new Gson();
    Type emoteType = new TypeToken<FfzBadgesAndUsers>() {
    }.getType();
    FfzBadgesAndUsers badgesAndUsers = gson.fromJson(ffzBadgesAndUsersElement, emoteType);
    for (Badge b : badgesAndUsers.getBadges()) {
        manager.getEmojiByType(EmojiType.FRANKERFACEZ_BADGE).put("" + b.getId(), new LazyLoadEmoji(b.getName(), "moderator".equals(b.getReplaces()) ? UserType.MOD.getKey() : b.getReplaces(), "http:" + b.getImage(), b.getColorParsed(), EmojiType.FRANKERFACEZ_BADGE));
    }
    manager.setFfzBadgeUsers(badgesAndUsers.getUsers());
}
Also used : LazyLoadEmoji(com.glitchcog.fontificator.emoji.LazyLoadEmoji) EmojiType(com.glitchcog.fontificator.emoji.EmojiType) UserType(com.glitchcog.fontificator.bot.UserType) Type(java.lang.reflect.Type) JsonElement(com.google.gson.JsonElement) Gson(com.google.gson.Gson) FfzBadgesAndUsers(com.glitchcog.fontificator.emoji.loader.frankerfacez.FfzBadgesAndUsers) Badge(com.glitchcog.fontificator.emoji.loader.frankerfacez.Badge) JsonParser(com.google.gson.JsonParser)

Aggregations

UserType (com.glitchcog.fontificator.bot.UserType)1 EmojiType (com.glitchcog.fontificator.emoji.EmojiType)1 LazyLoadEmoji (com.glitchcog.fontificator.emoji.LazyLoadEmoji)1 Badge (com.glitchcog.fontificator.emoji.loader.frankerfacez.Badge)1 FfzBadgesAndUsers (com.glitchcog.fontificator.emoji.loader.frankerfacez.FfzBadgesAndUsers)1 Gson (com.google.gson.Gson)1 JsonElement (com.google.gson.JsonElement)1 JsonParser (com.google.gson.JsonParser)1 Type (java.lang.reflect.Type)1