[2LS] HamsterAPI 0.1.2

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

  1. Sammwy
    Native Minecraft Version:
    Legacy (< 1.13)
    Tested Minecraft Versions:
    • 1.8
    • 1.9
    • 1.10
    • 1.11
    • 1.12
    • 1.13
    • 1.14
    • 1.15
    • 1.16
    Contributors:
    LinsaFTW
    [​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
    iPabszito, Lirito, ANDREI923 and 2 others like this.

Recent Reviews

  1. HotDoctor
    HotDoctor
    3/5,
    Version: 0.1.2
    nice api but for some reason it's making my server have lag in tps, I just made a timings report and this plugin is top 1 at avg (168.58 ms), would be perfect if you can fix this, thank you
  2. __Vekster007__
    __Vekster007__
    5/5,
    Version: 0.1.2
    Good plugin! Good plugin! Good plugin! Good plugin! Good plugin! Good plugin! Good plugin!
  3. Rodaviva
    Rodaviva
    5/5,
    Version: 0.1.2
    YEAHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH
    ---------------------------------------------------------------------------------------------------
  4. XxEnriquexX
    XxEnriquexX
    4/5,
    Version: 0.1.1
    > [19:17:34 ERROR]: Error occurred while enabling ExploitFixer v1.4.7 (Is it up to date?)
    java.lang.NoClassDefFoundError: io/netty/channel/ChannelHandlerContext
    at java.lang.Class.getDeclaredMethods0(Native Method) ~[?:1.8.0_262]
    at java.lang.Class.privateGetDeclaredMethods(Class.java:2701) ~[?:1.8.0_262]
    at java.lang.Class.getDeclaredMethod(Class.java:2128) ~[?:1.8.0_262]
    at org.bukkit.plugin.SimplePluginManager.getRegistrationClass(SimplePluginManager.java:585) ~[server.jar:git-PaperSpigot-ea452ce]
    at org.bukkit.plugin.SimplePluginManager.registerEvents(SimplePluginManager.java:535) ~[server.jar:git-PaperSpigot-ea452ce]
    at dev._2lstudios.exploitfixer.bukkit.listener.ListenerInitializer.register(ListenerInitializer.java:26) ~[?:?]
    at dev._2lstudios.exploitfixer.bukkit.ExploitFixer.register(ExploitFixer.java:112) ~[?:?]
    at dev._2lstudios.exploitfixer.bukkit.ExploitFixer.onEnable(ExploitFixer.java:51) ~[?:?]
    at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:316) ~[server.jar:git-PaperSpigot-ea452ce]
    at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:332) [server.jar:git-PaperSpigot-ea452ce]
    at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:412) [server.jar:git-PaperSpigot-ea452ce]
    at org.bukkit.craftbukkit.v1_7_R4.CraftServer.loadPlugin(CraftServer.java:476) [server.jar:git-PaperSpigot-ea452ce]
    at org.bukkit.craftbukkit.v1_7_R4.CraftServer.enablePlugins(CraftServer.java:394) [server.jar:git-PaperSpigot-ea452ce]
    at net.minecraft.server.v1_7_R4.MinecraftServer.n(MinecraftServer.java:356) [server.jar:git-PaperSpigot-ea452ce]
    at net.minecraft.server.v1_7_R4.MinecraftServer.g(MinecraftServer.java:330) [server.jar:git-PaperSpigot-ea452ce]
    at net.minecraft.server.v1_7_R4.MinecraftServer.a(MinecraftServer.java:286) [server.jar:git-PaperSpigot-ea452ce]
    at net.minecraft.server.v1_7_R4.DedicatedServer.init(DedicatedServer.java:227) [server.jar:git-PaperSpigot-ea452ce]
    at net.minecraft.server.v1_7_R4.MinecraftServer.run(MinecraftServer.java:496) [server.jar:git-PaperSpigot-ea452ce]
    at net.minecraft.server.v1_7_R4.ThreadServerApplication.run(SourceFile:628) [server.jar:git-PaperSpigot-ea452ce]
    Caused by: java.lang.ClassNotFoundException: io.netty.channel.ChannelHandlerContext
    at java.net.URLClassLoader.findClass(URLClassLoader.java:382) ~[?:1.8.0_262]
    at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:101) ~[server.jar:git-PaperSpigot-ea452ce]
    at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:86) ~[server.jar:git-PaperSpigot-ea452ce]
    at java.lang.ClassLoader.loadClass(ClassLoader.java:418) ~[?:1.8.0_262]
    at java.lang.ClassLoader.loadClass(ClassLoader.java:351) ~[?:1.8.0_262]
    ... 19 more
    1. Sammwy
      Author's Response
      this plugin is not compatible with 1.7
  5. brs73
    brs73
    5/5,
    Version: 0.1.1
    -Le guta a lo kirking nasty aunque sea fancy-
    -Se pone cranky si lo hago romantic-
    -Le gusta el ceqso en exceso y en el proceso me pide un beso-
  6. Pabloalba16
    Pabloalba16
    5/5,
    Version: 0.1.1
    Excelente API para usar los plugins de Linsa y tener mi servidor siempre protegido, gratis y con muy buen soporte!
  7. zmKem
    zmKem
    5/5,
    Version: 0.0.9
    15.07 10:50:05 [Server] WARN Ignoring plugin channel in outgoing REGISTER: WECUI
    15.07 10:50:05 [Server] WARN java.lang.NoSuchFieldException: channel
    15.07 10:50:05 [Server] WARN at java.lang.Class.getField(Class.java:1703)
    15.07 10:50:05 [Server] WARN at dev._2lstudios.hamsterapi.hamsterplayer.HamsterPlayer.<init>(HamsterPlayer.java:46)
    15.07 10:50:05 [Server] WARN at dev._2lstudios.hamsterapi.hamsterplayer.HamsterPlayerManager.add(HamsterPlayerManager.java:13)
    15.07 10:50:05 [Server] WARN at dev._2lstudios.hamsterapi.hamsterplayer.HamsterPlayerManager.get(HamsterPlayerManager.java:34)
    15.07 10:50:05 [Server] WARN at dev._2lstudios.hamsterapi.listeners.PlayerJoinListener.onPlayerJoin(PlayerJoinListener.java:15)
    15.07 10:50:05 [Server] WARN at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    15.07 10:50:05 [Server] WARN at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    15.07 10:50:05 [Server] WARN at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    15.07 10:50:05 [Server] WARN at java.lang.reflect.Method.invoke(Method.java:498)
    15.07 10:50:05 [Server] WARN at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:301)
    15.07 10:50:05 [Server] WARN at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62)
    15.07 10:50:05 [Server] WARN at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:502)
    15.07 10:50:05 [Server] WARN at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:487)
    15.07 10:50:05 [Server] WARN at net.minecraft.server.v1_8_R1.PlayerList.onPlayerJoin(PlayerList.java:272)
    15.07 10:50:05 [Server] WARN at net.minecraft.server.v1_8_R1.PlayerList.a(PlayerList.java:156)
    15.07 10:50:05 [Server] WARN at net.minecraft.server.v1_8_R1.LoginListener.b(LoginListener.java:109)
    15.07 10:50:05 [Server] WARN at net.minecraft.server.v1_8_R1.LoginListener.c(LoginListener.java:41)
    15.07 10:50:05 [Server] WARN at net.minecraft.server.v1_8_R1.NetworkManager.a(NetworkManager.java:159)
    15.07 10:50:05 [Server] WARN at net.minecraft.server.v1_8_R1.ServerConnection.c(ServerConnection.java:82)
    15.07 10:50:05 [Server] WARN at net.minecraft.server.v1_8_R1.MinecraftServer.z(MinecraftServer.java:800)
    15.07 10:50:05 [Server] WARN at net.minecraft.server.v1_8_R1.DedicatedServer.z(DedicatedServer.java:316)
    15.07 10:50:05 [Server] WARN at net.minecraft.server.v1_8_R1.MinecraftServer.y(MinecraftServer.java:634)
    15.07 10:50:05 [Server] WARN at net.minecraft.server.v1_8_R1.MinecraftServer.run(MinecraftServer.java:537)
    15.07 10:50:05 [Server] WARN at java.lang.Thread.run(Thread.java:748)
    15.07 10:50:05 [Server] WARN java.lang.NullPointerException
    15.07 10:50:05 [Server] WARN at dev._2lstudios.hamsterapi.utils.PacketInjector.addPlayer(PacketInjector.java:30)
    15.07 10:50:05 [Server] WARN at dev._2lstudios.hamsterapi.listeners.PlayerJoinListener.onPlayerJoin(PlayerJoinListener.java:17)
    1. Sammwy
      Author's Response
  8. tienthanh23423
    tienthanh23423
    5/5,
    Version: 0.0.9
    okkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk guddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
  9. YouHaveTrouble
    YouHaveTrouble
    3/5,
    Version: 0.0.8
    Please add maven repo.
    It's a pain in the butt to add this manually for every single project that needs it
    1. Sammwy
      Author's Response
      excellent idea! We will do it soon.
  10. kite
    kite
    4/5,
    Version: 0.0.8
    [04:32:11 WARN]: [HamsterAPI] LibsDisguises has been detected and it's reported
    to cause issues with connections, please disable it or find an alternative if yo
    u run into issues with HamsterAPI!

    But I can't replace LibsDisguises , because Gadgetsmenu requries that and there are no alternative