use of io.discloader.discloader.network.json.GuildMembersChunkJSON in project DiscLoader by R3alCl0ud.
the class GuildMembersChunk method handle.
@Override
public void handle(SocketPacket packet) {
String d = this.gson.toJson(packet.d);
GuildMembersChunkJSON data = this.gson.fromJson(d, GuildMembersChunkJSON.class);
IGuild guild = EntityRegistry.getGuildByID(data.guild_id);
if (guild == null)
return;
Map<Long, IGuildMember> members = new HashMap<>();
for (MemberJSON m : data.members) {
IGuildMember member = EntityBuilder.getGuildFactory().buildMember(guild, EntityRegistry.addUser(m.user), new String[] {}, false, false, null);
guild.addMember(member);
members.put(member.getID(), member);
}
GuildMembersChunkEvent event = new GuildMembersChunkEvent(guild, members);
loader.emit(event);
}
Aggregations