The API has been completely rewritten. It is now more coincise and doesn't require fastutil.
Also, it now uses an
updated version of TinyProtocol to inject into minecraft and listen to packets. This means that now it is possible to listen to handshake, login, and status packets like PacketLoginInStart.
This is how to create a PacketListener with the new API:
Code (Java):
PacketInjectorPlugin.
getInstance
(
).
getPacketInjectorAPI
(
).
getEventManager
(
).
registerPacketListener
(plugin,
new PacketListener
(
)
{
@Override
public
void onSend
(PacketSendEvent event
)
{
// code
}
@Override
public
void onReceive
(PacketReceiveEvent event
)
{
// code
}
}
)
;
Please note that now event.getPlayer() can return null in case the player object is not available yet. For example, packet events fired when a player is joining but before PlayerJoinEvent does not provide a Player instance.