Search in sources :

Example 1 with GenericRoleEvent

use of net.dv8tion.jda.core.events.role.GenericRoleEvent in project FlareBot by FlareBot.

the class ModlogEvents method onEvent.

@Override
public void onEvent(Event event) {
    if (!(event instanceof GenericGuildEvent) && !(event instanceof GenericRoleEvent) && !(event instanceof GenericTextChannelEvent) && !(event instanceof GenericVoiceChannelEvent) && !(event instanceof GenericMessageEvent))
        return;
    Guild g = null;
    if (event instanceof GenericGuildEvent && ((GenericGuildEvent) event).getGuild() != null)
        g = ((GenericGuildEvent) event).getGuild();
    else if (event instanceof GenericRoleEvent && ((GenericRoleEvent) event).getGuild() != null)
        g = ((GenericRoleEvent) event).getGuild();
    else if (event instanceof GenericTextChannelEvent && ((GenericTextChannelEvent) event).getGuild() != null)
        g = ((GenericTextChannelEvent) event).getGuild();
    else if (event instanceof GenericVoiceChannelEvent && ((GenericVoiceChannelEvent) event).getGuild() != null)
        g = ((GenericVoiceChannelEvent) event).getGuild();
    else if (event instanceof GenericMessageEvent && ((GenericMessageEvent) event).getGuild() != null)
        g = ((GenericMessageEvent) event).getGuild();
    if (g == null)
        return;
    GuildWrapper guildWrapper = FlareBotManager.instance().getGuild(g.getId());
    if (guildWrapper == null)
        return;
    // GUILD
    if (event instanceof GuildBanEvent)
        onGuildBan((GuildBanEvent) event, guildWrapper);
    else if (event instanceof GuildMemberJoinEvent)
        onGuildMemberJoin((GuildMemberJoinEvent) event, guildWrapper);
    else if (event instanceof GuildMemberLeaveEvent)
        onGuildMemberLeave((GuildMemberLeaveEvent) event, guildWrapper);
    else if (event instanceof GuildVoiceJoinEvent)
        onGuildVoiceJoin((GuildVoiceJoinEvent) event, guildWrapper);
    else if (event instanceof GuildVoiceLeaveEvent)
        onGuildVoiceLeave((GuildVoiceLeaveEvent) event, guildWrapper);
    else // ROLES
    if (event instanceof RoleCreateEvent)
        onRoleCreate((RoleCreateEvent) event, guildWrapper);
    else if (event instanceof RoleDeleteEvent)
        onRoleDelete((RoleDeleteEvent) event, guildWrapper);
    else if (event instanceof GenericRoleUpdateEvent)
        onGenericRoleUpdate((GenericRoleUpdateEvent) event, guildWrapper);
    else if (event instanceof GuildMemberRoleAddEvent)
        onGuildMemberRoleAdd((GuildMemberRoleAddEvent) event, guildWrapper);
    else if (event instanceof GuildMemberRoleRemoveEvent)
        onGuildMemberRoleRemove((GuildMemberRoleRemoveEvent) event, guildWrapper);
    else // CHANNEL
    if (event instanceof TextChannelCreateEvent)
        onTextChannelCreate((TextChannelCreateEvent) event, guildWrapper);
    else if (event instanceof VoiceChannelCreateEvent)
        onVoiceChannelCreate((VoiceChannelCreateEvent) event, guildWrapper);
    else if (event instanceof TextChannelDeleteEvent)
        onTextChannelDelete((TextChannelDeleteEvent) event, guildWrapper);
    else if (event instanceof VoiceChannelDeleteEvent)
        onVoiceChannelDelete((VoiceChannelDeleteEvent) event, guildWrapper);
    else /*else if (event instanceof GuildMessageReceivedEvent)
            onGuildMessageReceived((GuildMessageReceivedEvent) event, guildWrapper);*/
    if (event instanceof MessageUpdateEvent)
        onMessageUpdate((MessageUpdateEvent) event, guildWrapper);
    else if (event instanceof MessageDeleteEvent)
        onMessageDelete((MessageDeleteEvent) event, guildWrapper);
    else // GUILD
    if (event instanceof GuildUpdateExplicitContentLevelEvent)
        onGuildUpdateExplicitContentLevel((GuildUpdateExplicitContentLevelEvent) event, guildWrapper);
    else if (event instanceof GuildMemberNickChangeEvent)
        onGuildMemberNickChange((GuildMemberNickChangeEvent) event, guildWrapper);
    else if (event instanceof GenericGuildUpdateEvent)
        onGenericGuildUpdate((GenericGuildUpdateEvent) event, guildWrapper);
    else if (event instanceof GuildVoiceMoveEvent)
        onGuildVoiceMove((GuildVoiceMoveEvent) event, guildWrapper);
}
Also used : GuildVoiceLeaveEvent(net.dv8tion.jda.core.events.guild.voice.GuildVoiceLeaveEvent) VoiceChannelCreateEvent(net.dv8tion.jda.core.events.channel.voice.VoiceChannelCreateEvent) GenericVoiceChannelEvent(net.dv8tion.jda.core.events.channel.voice.GenericVoiceChannelEvent) MessageUpdateEvent(net.dv8tion.jda.core.events.message.MessageUpdateEvent) Guild(net.dv8tion.jda.core.entities.Guild) GenericMessageEvent(net.dv8tion.jda.core.events.message.GenericMessageEvent) TextChannelDeleteEvent(net.dv8tion.jda.core.events.channel.text.TextChannelDeleteEvent) GuildVoiceMoveEvent(net.dv8tion.jda.core.events.guild.voice.GuildVoiceMoveEvent) GuildWrapper(stream.flarebot.flarebot.objects.GuildWrapper) GenericRoleEvent(net.dv8tion.jda.core.events.role.GenericRoleEvent) RoleDeleteEvent(net.dv8tion.jda.core.events.role.RoleDeleteEvent) GenericGuildEvent(net.dv8tion.jda.core.events.guild.GenericGuildEvent) GenericRoleUpdateEvent(net.dv8tion.jda.core.events.role.update.GenericRoleUpdateEvent) GenericGuildUpdateEvent(net.dv8tion.jda.core.events.guild.update.GenericGuildUpdateEvent) TextChannelCreateEvent(net.dv8tion.jda.core.events.channel.text.TextChannelCreateEvent) GuildUpdateExplicitContentLevelEvent(net.dv8tion.jda.core.events.guild.update.GuildUpdateExplicitContentLevelEvent) VoiceChannelDeleteEvent(net.dv8tion.jda.core.events.channel.voice.VoiceChannelDeleteEvent) RoleCreateEvent(net.dv8tion.jda.core.events.role.RoleCreateEvent) GuildBanEvent(net.dv8tion.jda.core.events.guild.GuildBanEvent) GuildVoiceJoinEvent(net.dv8tion.jda.core.events.guild.voice.GuildVoiceJoinEvent) GenericTextChannelEvent(net.dv8tion.jda.core.events.channel.text.GenericTextChannelEvent) MessageDeleteEvent(net.dv8tion.jda.core.events.message.MessageDeleteEvent)

Aggregations

Guild (net.dv8tion.jda.core.entities.Guild)1 GenericTextChannelEvent (net.dv8tion.jda.core.events.channel.text.GenericTextChannelEvent)1 TextChannelCreateEvent (net.dv8tion.jda.core.events.channel.text.TextChannelCreateEvent)1 TextChannelDeleteEvent (net.dv8tion.jda.core.events.channel.text.TextChannelDeleteEvent)1 GenericVoiceChannelEvent (net.dv8tion.jda.core.events.channel.voice.GenericVoiceChannelEvent)1 VoiceChannelCreateEvent (net.dv8tion.jda.core.events.channel.voice.VoiceChannelCreateEvent)1 VoiceChannelDeleteEvent (net.dv8tion.jda.core.events.channel.voice.VoiceChannelDeleteEvent)1 GenericGuildEvent (net.dv8tion.jda.core.events.guild.GenericGuildEvent)1 GuildBanEvent (net.dv8tion.jda.core.events.guild.GuildBanEvent)1 GenericGuildUpdateEvent (net.dv8tion.jda.core.events.guild.update.GenericGuildUpdateEvent)1 GuildUpdateExplicitContentLevelEvent (net.dv8tion.jda.core.events.guild.update.GuildUpdateExplicitContentLevelEvent)1 GuildVoiceJoinEvent (net.dv8tion.jda.core.events.guild.voice.GuildVoiceJoinEvent)1 GuildVoiceLeaveEvent (net.dv8tion.jda.core.events.guild.voice.GuildVoiceLeaveEvent)1 GuildVoiceMoveEvent (net.dv8tion.jda.core.events.guild.voice.GuildVoiceMoveEvent)1 GenericMessageEvent (net.dv8tion.jda.core.events.message.GenericMessageEvent)1 MessageDeleteEvent (net.dv8tion.jda.core.events.message.MessageDeleteEvent)1 MessageUpdateEvent (net.dv8tion.jda.core.events.message.MessageUpdateEvent)1 GenericRoleEvent (net.dv8tion.jda.core.events.role.GenericRoleEvent)1 RoleCreateEvent (net.dv8tion.jda.core.events.role.RoleCreateEvent)1 RoleDeleteEvent (net.dv8tion.jda.core.events.role.RoleDeleteEvent)1