Search in sources :

Example 1 with GuildBanAddEvent

use of io.discloader.discloader.common.event.guild.GuildBanAddEvent in project DiscLoader by R3alCl0ud.

the class GuildBanAdd method handle.

@Override
public void handle(SocketPacket packet) {
    String d = gson.toJson(packet.d);
    GuildMemberRemoveJSON data = this.gson.fromJson(d, GuildMemberRemoveJSON.class);
    IGuild guild = EntityRegistry.getGuildByID(data.guild_id);
    IUser user = EntityRegistry.addUser(data.user);
    guild.removeMember(user);
    GuildBanAddEvent event = new GuildBanAddEvent(guild, user);
    loader.emit(DLUtil.Events.GUILD_BAN_ADD, event);
    loader.emit(event);
}
Also used : GuildMemberRemoveJSON(io.discloader.discloader.network.json.GuildMemberRemoveJSON) GuildBanAddEvent(io.discloader.discloader.common.event.guild.GuildBanAddEvent) IUser(io.discloader.discloader.entity.user.IUser) IGuild(io.discloader.discloader.entity.guild.IGuild)

Aggregations

GuildBanAddEvent (io.discloader.discloader.common.event.guild.GuildBanAddEvent)1 IGuild (io.discloader.discloader.entity.guild.IGuild)1 IUser (io.discloader.discloader.entity.user.IUser)1 GuildMemberRemoveJSON (io.discloader.discloader.network.json.GuildMemberRemoveJSON)1