use of io.discloader.discloader.common.event.guild.member.GuildMemberRemoveEvent in project DiscLoader by R3alCl0ud.
the class GuildMemberRemove method handle.
@Override
public void handle(SocketPacket packet) {
String d = this.gson.toJson(packet.d);
GuildMemberRemoveJSON data = this.gson.fromJson(d, GuildMemberRemoveJSON.class);
IGuild guild = EntityRegistry.getGuildByID(data.guild_id);
IGuildMember member = guild.getMember(data.user.id);
if (member == null)
member = EntityBuilder.getGuildFactory().buildMember(guild, EntityRegistry.addUser(data.user), new String[] {}, false, false, null);
guild.removeMember(member);
if (shouldEmit()) {
GuildMemberRemoveEvent event = new GuildMemberRemoveEvent(member);
loader.emit(event);
}
}
Aggregations