[2LS] HamsterAPI icon

[2LS] HamsterAPI -----

Simple and easy to use API to read and write Packets.



[​IMG]

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)

To know how to listen to Events please read the following guide: https://www.spigotmc.org/wiki/using-the-event-api/

Code (Java):

HamsterAPI. getInstance ( ). getHamsterPlayerManager ( ). get (player ). sendTitle ( String title, String subtitle, int fadeInTime, int showTime, int fadeOutTime ) ;
 
Code (Java):

HamsterAPI. getInstance ( ). getHamsterPlayerManager ( ). get (player )
. sendActionbar ( String message ) ;
 
Code (Java):

HamsterAPI. getInstance ( ). getHamsterPlayerManager ( ). get (player ). disconnect ( String reason ) ;
 
Code (Java):

HamsterAPI. getInstance ( ). getHamsterPlayerManager ( ). get (player ). closeChannel ( ) ;
 
Code (Java):

HamsterAPI. getInstance ( ). getHamsterPlayerManager ( ). get (player ). sendServer ( String serverName ) ;
 

[Developers] Don't forget to place HamsterAPI as a dependency in your "plugin.yml" file
Resource Information
Author:
----------
Total Downloads: 45,778
First Release: May 14, 2020
Last Update: Oct 3, 2024
Category: ---------------
All-Time Rating:
49 ratings
Find more info at discord.gg...
Version -----
Released: --------------------
Downloads: ------
Version Rating:
----------------------
-- ratings