Search in sources :

Example 1 with Room

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

the class EmojiParser method parseFrankerFaceZModBadge.

/**
     * Parse the FrankerFaceZ room data for the optional moderator badge
     * 
     * @param manager
     * @param jsonData
     * @throws IOException
     */
public void parseFrankerFaceZModBadge(EmojiManager manager, String jsonData) throws IOException {
    Gson gson = new Gson();
    Type roomType = new TypeToken<Room>() {
    }.getType();
    JsonObject jsonObject = new JsonParser().parse(jsonData).getAsJsonObject();
    Room room = gson.fromJson(jsonObject.get("room"), roomType);
    final boolean customFfzModBadgeExists = room != null && room.getModerator_badge() != null;
    if (customFfzModBadgeExists) {
        LazyLoadEmoji modLle = new LazyLoadEmoji(UserType.MOD.getKey(), UserType.MOD.getKey(), "https:" + room.getModerator_badge(), ConfigEmoji.MOD_BADGE_COLOR, EmojiType.FRANKERFACEZ_BADGE);
        manager.getEmojiByType(EmojiType.FRANKERFACEZ_BADGE).put(UserType.MOD.getKey(), modLle);
        logBox.log("Loaded the custom FrankerFaceZ moderator badge");
    }
}
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) Gson(com.google.gson.Gson) JsonObject(com.google.gson.JsonObject) Room(com.glitchcog.fontificator.emoji.loader.frankerfacez.Room) 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 Room (com.glitchcog.fontificator.emoji.loader.frankerfacez.Room)1 Gson (com.google.gson.Gson)1 JsonObject (com.google.gson.JsonObject)1 JsonParser (com.google.gson.JsonParser)1 Type (java.lang.reflect.Type)1