What is HamsterAPI? HamsterAPI is a small library for listening to incoming and outgoing packets, reading, modifying and canceling them.
It also allows you to easily send packages to users without the need to use Reflection or NMS in your plugin.
What can i do with HamsterAPI? - Send Title, Subtitle, ActionBar, and Packets to players. - Listen incoming and outgoing packets with events based on priority and cancellation. - Disconnect players safely/instantly. - Communicate with BungeeCord. (Kick, switch server, send message channel, etc)
In the future, HamsterAPI will also have: 1. BossBar API 2. Client <-> server communication with custom channels (For modded clients) 3. Bungeecord Listener
How to use HamsterAPI?
The first step is to get the HamsterAPI instance to access most of the methods of the API with the static method
HamsterAPI.getInstance().
From the HamsterAPI instance you can access the following methods:
getBufferIO() - Util to split/decompress/decode bytebufs into packets.
getBungeeMessenger() - Util to ease CustomPayload communication with BungeeCord.
getReflection() - Optimized util to get NMS and CraftBukkit classes without losing compatibility.
getPacketInjector() - Util to inject/remove HamsterAPI from the pipeline of a player.
You can listen to the following events:
PacketDecodeEvent PacketReceiveEvent PacketSendEvent
Decode is ran after splitter & decompress on the pipeline and lets you access to a bytebuf object. You can decode it with
BufferIO to get a PacketWrapper object. (Perfect for exploit fixing and security stuff)
Receive/Send is ran after decode on the pipeline and lets you access to a PacketWrapper object. (Perfect for cosmetic/common stuff)