Home›Java›Mods›[2LS] HamsterAPI
[2LS] HamsterAPI
ModsJava

[2LS] HamsterAPI

Java mod listed for Minecraft 1.8–1.19. Download on the author's site.

⬇ Download on Spigot
[​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?
Spoiler: Get started
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/

Spoiler: Send Title and subtitle
Code (Java):

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

HamsterAPI. getInstance ( ). getHamsterPlayerManager ( ). get (player )
. sendActionbar ( String message ) ;
 
Spoiler: Safe Disconnect (Packet Kick)
Code (Java):

HamsterAPI. getInstance ( ). getHamsterPlayerManager ( ). get (player ). disconnect ( String reason ) ;
 
Spoiler: Close Connection (Instant)
Code (Java):

HamsterAPI. getInstance ( ). getHamsterPlayerManager ( ). get (player ). closeChannel ( ) ;
 
Spoiler: Send to bungee server
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
Quick facts

Install steps are the general flow for this file type — How to install Minecraft Java mods & modpacks walks through it step by step.

[2LS] HamsterAPI is a free Minecraft Java mod. Compatible with Minecraft 1.8, 1.9, 1.10, 1.11 and newer. Downloaded 57,354 times (via Spigot). Download it and open it directly in the game.

Explore more