Class ChannelInjector
java.lang.Object
io.netty.channel.ChannelHandlerAdapter
io.netty.channel.ChannelInboundHandlerAdapter
io.netty.handler.codec.ByteToMessageDecoder
com.comphenix.protocol.injector.netty.ChannelInjector
- All Implemented Interfaces:
Injector,io.netty.channel.ChannelHandler,io.netty.channel.ChannelInboundHandler
public class ChannelInjector
extends io.netty.handler.codec.ByteToMessageDecoder
implements Injector
Represents a channel injector.
- Author:
- Kristian
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classRepresents a socket injector that foreards to the current channel injector.Nested classes/interfaces inherited from interface io.netty.channel.ChannelHandler
io.netty.channel.ChannelHandler.Sharable -
Method Summary
Modifier and TypeMethodDescriptionvoidchannelActive(io.netty.channel.ChannelHandlerContext ctx)voidclose()Close the current injector.protected voiddecode(io.netty.channel.ChannelHandlerContext ctx, io.netty.buffer.ByteBuf byteBuffer, List<Object> packets)voidexceptionCaught(io.netty.channel.ChannelHandlerContext ctx, Throwable cause)io.netty.channel.ChannelRetrieve the current protocol state.Retrieve the network marker associated with a given packet.org.bukkit.entity.PlayerRetrieve the current player or temporary player associated with the injector.intGet the version of the current protocol.booleaninject()Inject the current channel.booleanisClosed()Determine if this channel has been closed and cleaned up.booleanDetermine if the channel has already been injected.voidrecieveClientPacket(Object packet)Recieve a packet on the server.voidsaveMarker(Object packet, NetworkMarker marker)Associate a given network marker with a specific packet.voidsendServerPacket(Object packet, NetworkMarker marker, boolean filtered)Send a packet to a player's client.voidsetPlayer(org.bukkit.entity.Player player)Set the player instance.voidsetUpdatedPlayer(org.bukkit.entity.Player updated)Set the updated player instance.Methods inherited from class io.netty.handler.codec.ByteToMessageDecoder
actualReadableBytes, callDecode, channelInactive, channelRead, channelReadComplete, decodeLast, handlerRemoved, handlerRemoved0, internalBuffer, isSingleDecode, setSingleDecodeMethods inherited from class io.netty.channel.ChannelInboundHandlerAdapter
channelRegistered, channelUnregistered, channelWritabilityChanged, userEventTriggeredMethods inherited from class io.netty.channel.ChannelHandlerAdapter
handlerAdded, isSharableMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.netty.channel.ChannelHandler
handlerAdded
-
Method Details
-
getProtocolVersion
public int getProtocolVersion()Get the version of the current protocol.- Specified by:
getProtocolVersionin interfaceInjector- Returns:
- The version.
-
inject
public boolean inject()Description copied from interface:InjectorInject the current channel.Note that only active channels can be injected.
-
exceptionCaught
public void exceptionCaught(io.netty.channel.ChannelHandlerContext ctx, Throwable cause) throws Exception- Specified by:
exceptionCaughtin interfaceio.netty.channel.ChannelHandler- Specified by:
exceptionCaughtin interfaceio.netty.channel.ChannelInboundHandler- Overrides:
exceptionCaughtin classio.netty.channel.ChannelInboundHandlerAdapter- Throws:
Exception
-
decode
protected void decode(io.netty.channel.ChannelHandlerContext ctx, io.netty.buffer.ByteBuf byteBuffer, List<Object> packets) throws Exception- Specified by:
decodein classio.netty.handler.codec.ByteToMessageDecoder- Throws:
Exception
-
channelActive
- Specified by:
channelActivein interfaceio.netty.channel.ChannelInboundHandler- Overrides:
channelActivein classio.netty.channel.ChannelInboundHandlerAdapter- Throws:
Exception
-
sendServerPacket
Description copied from interface:InjectorSend a packet to a player's client.- Specified by:
sendServerPacketin interfaceInjector- Parameters:
packet- - the packet to send.marker- - the network marker.filtered- - whether or not the packet is filtered.
-
recieveClientPacket
Description copied from interface:InjectorRecieve a packet on the server.- Specified by:
recieveClientPacketin interfaceInjector- Parameters:
packet- - the (NMS) packet to send.
-
getCurrentProtocol
Description copied from interface:InjectorRetrieve the current protocol state.- Specified by:
getCurrentProtocolin interfaceInjector- Returns:
- The current protocol.
-
getMarker
Description copied from interface:InjectorRetrieve the network marker associated with a given packet. -
saveMarker
Description copied from interface:InjectorAssociate a given network marker with a specific packet.- Specified by:
saveMarkerin interfaceInjector- Parameters:
packet- - the NMS packet.marker- - the associated marker.
-
getPlayer
public org.bukkit.entity.Player getPlayer()Description copied from interface:InjectorRetrieve the current player or temporary player associated with the injector. -
setPlayer
public void setPlayer(org.bukkit.entity.Player player)Set the player instance. -
setUpdatedPlayer
public void setUpdatedPlayer(org.bukkit.entity.Player updated)Set the updated player instance.- Specified by:
setUpdatedPlayerin interfaceInjector- Parameters:
updated- - updated instance.
-
isInjected
public boolean isInjected()Description copied from interface:InjectorDetermine if the channel has already been injected.- Specified by:
isInjectedin interfaceInjector- Returns:
- TRUE if it has, FALSE otherwise.
-
isClosed
public boolean isClosed()Determine if this channel has been closed and cleaned up. -
close
public void close()Description copied from interface:InjectorClose the current injector. -
getChannel
public io.netty.channel.Channel getChannel()
-