Search in sources :

Example 1 with ChannelCreateEvent

use of io.discloader.discloader.common.event.channel.ChannelCreateEvent in project DiscLoader by R3alCl0ud.

the class ChannelCreate method handle.

@Override
public void handle(SocketPacket packet) {
    String d = gson.toJson(packet.d);
    ChannelJSON data = gson.fromJson(d, ChannelJSON.class);
    IGuild guild = EntityRegistry.getGuildByID(data.guild_id);
    IChannel channel = EntityRegistry.addChannel(data, loader, guild);
    ChannelCreateEvent event = new ChannelCreateEvent(channel);
    loader.emit(Events.CHANNEL_CREATE, event);
    loader.emit(event);
}
Also used : ChannelJSON(io.discloader.discloader.network.json.ChannelJSON) IChannel(io.discloader.discloader.entity.channel.IChannel) ChannelCreateEvent(io.discloader.discloader.common.event.channel.ChannelCreateEvent) IGuild(io.discloader.discloader.entity.guild.IGuild)

Aggregations

ChannelCreateEvent (io.discloader.discloader.common.event.channel.ChannelCreateEvent)1 IChannel (io.discloader.discloader.entity.channel.IChannel)1 IGuild (io.discloader.discloader.entity.guild.IGuild)1 ChannelJSON (io.discloader.discloader.network.json.ChannelJSON)1