Search in sources :

Example 1 with Channel

use of net.minecraft.util.io.netty.channel.Channel in project packetevents by retrooper.

the class LateChannelInjectorLegacy method sendPacket.

@Override
public void sendPacket(Object rawChannel, Object packet) {
    Channel channel = (Channel) rawChannel;
    channel.pipeline().writeAndFlush(packet);
}
Also used : EpollSocketChannel(io.netty.channel.epoll.EpollSocketChannel) NioSocketChannel(net.minecraft.util.io.netty.channel.socket.nio.NioSocketChannel) Channel(net.minecraft.util.io.netty.channel.Channel)

Example 2 with Channel

use of net.minecraft.util.io.netty.channel.Channel in project packetevents by retrooper.

the class EarlyChannelInjectorLegacy method sendPacket.

@Override
public void sendPacket(Object ch, Object rawNMSPacket) {
    Channel channel = (Channel) ch;
    channel.writeAndFlush(rawNMSPacket);
}
Also used : Channel(net.minecraft.util.io.netty.channel.Channel) EpollSocketChannel(io.netty.channel.epoll.EpollSocketChannel) NioSocketChannel(net.minecraft.util.io.netty.channel.socket.nio.NioSocketChannel)

Example 3 with Channel

use of net.minecraft.util.io.netty.channel.Channel in project packetevents by retrooper.

the class EarlyChannelInjectorLegacy method flushPackets.

@Override
public void flushPackets(Object ch) {
    Channel channel = (Channel) ch;
    channel.flush();
}
Also used : Channel(net.minecraft.util.io.netty.channel.Channel) EpollSocketChannel(io.netty.channel.epoll.EpollSocketChannel) NioSocketChannel(net.minecraft.util.io.netty.channel.socket.nio.NioSocketChannel)

Example 4 with Channel

use of net.minecraft.util.io.netty.channel.Channel in project packetevents by retrooper.

the class EarlyChannelInjectorLegacy method getHandler.

private PlayerChannelHandlerLegacy getHandler(Object rawChannel) {
    Channel channel = (Channel) rawChannel;
    ChannelHandler handler = channel.pipeline().get(PacketEvents.get().getHandlerName());
    if (handler instanceof PlayerChannelHandlerLegacy) {
        return (PlayerChannelHandlerLegacy) handler;
    } else {
        return null;
    }
}
Also used : PlayerChannelHandlerLegacy(io.github.retrooper.packetevents.injector.legacy.PlayerChannelHandlerLegacy) Channel(net.minecraft.util.io.netty.channel.Channel) EpollSocketChannel(io.netty.channel.epoll.EpollSocketChannel) NioSocketChannel(net.minecraft.util.io.netty.channel.socket.nio.NioSocketChannel) ChannelHandler(net.minecraft.util.io.netty.channel.ChannelHandler)

Example 5 with Channel

use of net.minecraft.util.io.netty.channel.Channel in project TheAPI by TheDevTec.

the class PacketHandler_Legacy method get.

public Channel get(Player player) {
    Channel channel = channelLookup.get(player.getName());
    if (channel == null) {
        Object get = BukkitLoader.getNmsProvider().getNetworkChannel(BukkitLoader.getNmsProvider().getConnectionNetwork(BukkitLoader.getNmsProvider().getPlayerConnection(player)));
        if (get == null)
            return null;
        channelLookup.put(player.getName(), channel = (Channel) get);
    }
    return channel;
}
Also used : Channel(net.minecraft.util.io.netty.channel.Channel)

Aggregations

Channel (net.minecraft.util.io.netty.channel.Channel)14 EpollSocketChannel (io.netty.channel.epoll.EpollSocketChannel)10 NioSocketChannel (net.minecraft.util.io.netty.channel.socket.nio.NioSocketChannel)10 PlayerChannelHandlerLegacy (io.github.retrooper.packetevents.injector.legacy.PlayerChannelHandlerLegacy)3 Field (java.lang.reflect.Field)3 ArrayList (java.util.ArrayList)3 ChannelFuture (net.minecraft.util.io.netty.channel.ChannelFuture)3 ListWrapper (io.github.retrooper.packetevents.utils.list.ListWrapper)2 List (java.util.List)2 ChannelHandler (net.minecraft.util.io.netty.channel.ChannelHandler)2 NMSPacket (io.github.retrooper.packetevents.packetwrappers.NMSPacket)1 WrappedPacket (io.github.retrooper.packetevents.packetwrappers.WrappedPacket)1 HashMap (java.util.HashMap)1 ServerListPingEvent (me.devtec.theapi.bukkit.events.ServerListPingEvent)1 PlayerProfile (me.devtec.theapi.bukkit.events.ServerListPingEvent.PlayerProfile)1 EntityPlayer (net.minecraft.server.v1_7_R4.EntityPlayer)1 IChatBaseComponent (net.minecraft.server.v1_7_R4.IChatBaseComponent)1 PacketStatusOutServerInfo (net.minecraft.server.v1_7_R4.PacketStatusOutServerInfo)1 ServerPing (net.minecraft.server.v1_7_R4.ServerPing)1 ServerPingPlayerSample (net.minecraft.server.v1_7_R4.ServerPingPlayerSample)1