Search in sources :

Example 1 with GuildRoleUpdateEvent

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

the class RoleUpdate method handle.

@Override
public void handle(SocketPacket packet) {
    String d = this.gson.toJson(packet.d);
    Packet data = this.gson.fromJson(d, Packet.class);
    IGuild guild = EntityRegistry.getGuildByID(data.guild_id);
    IRole oldRole = guild.getRoleByID(data.role.id);
    IRole role = guild.addRole(data.role);
    GuildRoleUpdateEvent event = new GuildRoleUpdateEvent(role, oldRole);
    loader.emit(DLUtil.Events.GUILD_ROLE_UPDATE, event);
    loader.emit(event);
}
Also used : GuildRoleUpdateEvent(io.discloader.discloader.common.event.guild.role.GuildRoleUpdateEvent) IRole(io.discloader.discloader.entity.guild.IRole) IGuild(io.discloader.discloader.entity.guild.IGuild)

Aggregations

GuildRoleUpdateEvent (io.discloader.discloader.common.event.guild.role.GuildRoleUpdateEvent)1 IGuild (io.discloader.discloader.entity.guild.IGuild)1 IRole (io.discloader.discloader.entity.guild.IRole)1