use of io.discloader.discloader.common.event.guild.role.GuildRoleCreateEvent in project DiscLoader by R3alCl0ud.
the class Guild method addRole.
@Override
public IRole addRole(RoleJSON guildRole) {
boolean exists = roles.containsKey(SnowflakeUtil.parse(guildRole.id));
IRole role = new Role(this, guildRole);
roles.put(role.getID(), role);
GuildRoleCreateEvent event = new GuildRoleCreateEvent(role);
if (!exists && this.loader.ready) {
loader.emit(event);
}
return role;
}
use of io.discloader.discloader.common.event.guild.role.GuildRoleCreateEvent in project DiscLoader by R3alCl0ud.
the class RoleCreate method handle.
@Override
public void handle(SocketPacket packet) {
String d = gson.toJson(packet.d);
GuildRoleJSON data = gson.fromJson(d, GuildRoleJSON.class);
IGuild guild = EntityRegistry.getGuildByID(data.guild_id);
IRole role = guild.addRole(gfac.buildRole(guild, data.role));
GuildRoleCreateEvent event = new GuildRoleCreateEvent(role);
loader.emit(DLUtil.Events.GUILD_ROLE_CREATE, event);
loader.emit(event);
}
Aggregations