Search in sources :

Example 1 with GuildRoleDeleteEvent

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

the class RoleDelete method handle.

@Override
public void handle(SocketPacket packet) {
    String d = this.gson.toJson(packet.d);
    GuildRoleJSON data = this.gson.fromJson(d, GuildRoleJSON.class);
    IGuild guild = EntityRegistry.getGuildByID(data.guild_id);
    IRole role = guild.removeRole(data.role_id);
    if (role == null)
        return;
    GuildRoleDeleteEvent event = new GuildRoleDeleteEvent(role);
    loader.emit(DLUtil.Events.GUILD_ROLE_DELETE, event);
    loader.emit(event);
}
Also used : IRole(io.discloader.discloader.entity.guild.IRole) IGuild(io.discloader.discloader.entity.guild.IGuild) GuildRoleJSON(io.discloader.discloader.network.json.GuildRoleJSON) GuildRoleDeleteEvent(io.discloader.discloader.common.event.guild.role.GuildRoleDeleteEvent)

Aggregations

GuildRoleDeleteEvent (io.discloader.discloader.common.event.guild.role.GuildRoleDeleteEvent)1 IGuild (io.discloader.discloader.entity.guild.IGuild)1 IRole (io.discloader.discloader.entity.guild.IRole)1 GuildRoleJSON (io.discloader.discloader.network.json.GuildRoleJSON)1