| Modifier and Type | Class and Description |
|---|---|
static class |
ChannelInjector.ChannelSocketInjector
Represents a socket injector that foreards to the current channel injector.
|
| Modifier and Type | Field and Description |
|---|---|
static ReportType |
REPORT_CANNOT_EXECUTE_IN_CHANNEL_THREAD |
static ReportType |
REPORT_CANNOT_FIND_GET_VERSION |
static ReportType |
REPORT_CANNOT_INTERCEPT_CLIENT_PACKET |
static ReportType |
REPORT_CANNOT_INTERCEPT_SERVER_PACKET |
static ReportType |
REPORT_CANNOT_SEND_PACKET |
| Constructor and Description |
|---|
ChannelInjector(org.bukkit.entity.Player player,
Object networkManager,
io.netty.channel.Channel channel,
ChannelListener channelListener,
InjectionFactory factory)
Construct a new channel injector.
|
| Modifier and Type | Method and Description |
|---|---|
void |
channelActive(io.netty.channel.ChannelHandlerContext ctx) |
void |
close()
Close the current injector.
|
protected void |
decode(io.netty.channel.ChannelHandlerContext ctx,
io.netty.buffer.ByteBuf byteBuffer,
List<Object> packets) |
protected void |
encode(io.netty.channel.ChannelHandlerContext ctx,
Object packet,
io.netty.buffer.ByteBuf output)
Encode a packet to a byte buffer, taking over for the standard Minecraft encoder.
|
protected void |
encodeWirePacket(WirePacket packet,
io.netty.buffer.ByteBuf output) |
void |
exceptionCaught(io.netty.channel.ChannelHandlerContext ctx,
Throwable cause) |
protected void |
finalWrite(io.netty.channel.ChannelHandlerContext ctx,
Object packet,
io.netty.channel.ChannelPromise promise)
Invoked when a packet has been written to the channel.
|
static io.netty.channel.ChannelHandler |
findChannelHandler(io.netty.channel.Channel channel,
Class<?> clazz)
Find the first channel handler that is assignable to a given type.
|
protected void |
finishRead(io.netty.channel.ChannelHandlerContext ctx,
Object msg)
Invoked after our decoder.
|
io.netty.channel.Channel |
getChannel() |
PacketType.Protocol |
getCurrentProtocol()
Retrieve the current protocol state.
|
NetworkMarker |
getMarker(Object packet)
Retrieve the network marker associated with a given packet.
|
org.bukkit.entity.Player |
getPlayer()
Retrieve the current player or temporary player associated with the injector.
|
int |
getProtocolVersion()
Get the version of the current protocol.
|
protected void |
handleLogin(Class<?> packetClass,
Object packet)
Invoked when we may need to handle the login packet.
|
boolean |
inject()
Inject the current channel.
|
boolean |
isClosed()
Determine if this channel has been closed and cleaned up.
|
boolean |
isInjected()
Determine if the channel has already been injected.
|
void |
recieveClientPacket(Object packet)
Recieve a packet on the server.
|
void |
saveMarker(Object packet,
NetworkMarker marker)
Associate a given network marker with a specific packet.
|
void |
sendServerPacket(Object packet,
NetworkMarker marker,
boolean filtered)
Send a packet to a player's client.
|
void |
setPlayer(org.bukkit.entity.Player player)
Set the player instance.
|
void |
setUpdatedPlayer(org.bukkit.entity.Player updated)
Set the updated player instance.
|
actualReadableBytes, callDecode, channelInactive, channelRead, channelReadComplete, decodeLast, discardSomeReadBytes, handlerRemoved, handlerRemoved0, internalBuffer, isSingleDecode, setCumulator, setDiscardAfterReads, setSingleDecode, userEventTriggeredchannelRegistered, channelUnregistered, channelWritabilityChangedensureNotSharable, handlerAdded, isSharablepublic static final ReportType REPORT_CANNOT_INTERCEPT_SERVER_PACKET
public static final ReportType REPORT_CANNOT_INTERCEPT_CLIENT_PACKET
public static final ReportType REPORT_CANNOT_EXECUTE_IN_CHANNEL_THREAD
public static final ReportType REPORT_CANNOT_FIND_GET_VERSION
public static final ReportType REPORT_CANNOT_SEND_PACKET
public ChannelInjector(org.bukkit.entity.Player player,
Object networkManager,
io.netty.channel.Channel channel,
ChannelListener channelListener,
InjectionFactory factory)
player - - the current player, or temporary player.networkManager - - its network manager.channel - - its channel.channelListener - - a listener.factory - - the factory that created this injectorpublic int getProtocolVersion()
getProtocolVersion in interface Injectorpublic boolean inject()
InjectorNote that only active channels can be injected.
public void exceptionCaught(io.netty.channel.ChannelHandlerContext ctx,
Throwable cause)
throws Exception
exceptionCaught in interface io.netty.channel.ChannelHandlerexceptionCaught in interface io.netty.channel.ChannelInboundHandlerexceptionCaught in class io.netty.channel.ChannelInboundHandlerAdapterExceptionprotected void encodeWirePacket(WirePacket packet, io.netty.buffer.ByteBuf output) throws Exception
Exceptionprotected void encode(io.netty.channel.ChannelHandlerContext ctx,
Object packet,
io.netty.buffer.ByteBuf output)
throws Exception
ctx - - the current context.packet - - the packet to encode to a byte array.output - - the output byte array.Exception - If anything went wrong.protected void finalWrite(io.netty.channel.ChannelHandlerContext ctx,
Object packet,
io.netty.channel.ChannelPromise promise)
ctx - - current context.packet - - the packet that has been written.promise - - a promise.protected void decode(io.netty.channel.ChannelHandlerContext ctx,
io.netty.buffer.ByteBuf byteBuffer,
List<Object> packets)
throws Exception
decode in class io.netty.handler.codec.ByteToMessageDecoderExceptionprotected void finishRead(io.netty.channel.ChannelHandlerContext ctx,
Object msg)
ctx - - current context.msg - - the current packet.protected void handleLogin(Class<?> packetClass, Object packet)
packetClass - - the packet class.packet - - the packet.public void channelActive(io.netty.channel.ChannelHandlerContext ctx)
throws Exception
channelActive in interface io.netty.channel.ChannelInboundHandlerchannelActive in class io.netty.channel.ChannelInboundHandlerAdapterExceptionpublic void sendServerPacket(Object packet, NetworkMarker marker, boolean filtered)
InjectorsendServerPacket in interface Injectorpacket - - the packet to send.marker - - the network marker.filtered - - whether or not the packet is filtered.public void recieveClientPacket(Object packet)
InjectorrecieveClientPacket in interface Injectorpacket - - the (NMS) packet to send.public PacketType.Protocol getCurrentProtocol()
InjectorgetCurrentProtocol in interface Injectorpublic NetworkMarker getMarker(Object packet)
Injectorpublic void saveMarker(Object packet, NetworkMarker marker)
InjectorsaveMarker in interface Injectorpacket - - the NMS packet.marker - - the associated marker.public org.bukkit.entity.Player getPlayer()
Injectorpublic void setPlayer(org.bukkit.entity.Player player)
public void setUpdatedPlayer(org.bukkit.entity.Player updated)
setUpdatedPlayer in interface Injectorupdated - - updated instance.public boolean isInjected()
InjectorisInjected in interface Injectorpublic boolean isClosed()
public void close()
Injectorpublic static io.netty.channel.ChannelHandler findChannelHandler(io.netty.channel.Channel channel,
Class<?> clazz)
channel - - the channel.clazz - - the type.public io.netty.channel.Channel getChannel()
Copyright © 2012–2017 Comphenix and dmulloy2. Licensed under the GNU GPL v2.