BungeePackets 1.6

An in-depth easy to use packet library for BungeeCord.

  1. Spawl

    An in depth packet library for BungeeCord. This library allows developers to create plugins that allow for inventories across server networks, play sounds, particle effects, and soon to be lots more!

    I've seen a few packet libraries for BungeeCord on Spigot. But none that I found easy to use, or expandable.

    This plugin does NOT provide extra features for your network. It is an API for developers to use to make it easier for them to create cross-network plugins.

    Simply drop the BungeePackets.jar into your plugins directory of your BungeeCord server. Restart the Bungee and it will be loaded!

    As far as I am aware, this plugin works with all builds greater than minecraft version 1.6.4.

    BungeePackets adds in one simple event to manage packets. PacketEvent. The packet event is used to manage all incoming and outgoing packets. With ever incoming and outgoing packet there is a player assigned with it somewhere in the pipe. Using this system we can differentiate whether a server is sending a packet to Bungee, or a player is, vice-versa.

    In the example below, we are listening for an incoming packet coming from the client to the BungeeCord. We can check who is sending/receiving packets by checking if they are an instance of a commection. To check if the sender is a palyer, check if the sender is an instanceof a ProxiedPlayer. To check if the sender is Bungee, check if the sender is an instance of a BungeeConnection. To check if the sender is a server, check if the sender is an instanceof a ServerConnection.
    Code (Text):
    public void onPacket(PacketEvent event) {
        if(event.getSender() instanceof ProxiedPlayer && event.getReciever() instanceof BungeeConnection) {
            if(event.getPacket() instanceof InFlying) {
                InFlying packet = (InFlying) event.getPacket();
    Some packets are already implemented. But for the ones that are not, you will have to create a packet for it. To create a custom packet, simply extend the org.spawl.bungeepackets.Packet class. This is an abstract class so you will get 3 methods. Read, write, and handle. Read is called when the BungeeCord recieves the packet. Write is called when the Bungee is writing the packet to a pipe, and handle is called after the packet is read. Even if you register custom packets, they will still be called through the PacketEvent.
    Code (Text):
    BungeePackets.registerPacket(Protocol.DirectionData.TO_SERVER, <ID>, <CLASS EXTENDING PACKET>);
    Creating inventories are made easy with a custom ItemStack API along with a custom inventory API. If you need any features added, please feel free to message me!
    Code (Text):
    ProxiedPlayer p = null; /* Make this not null when you do it ;) */
    Inventory inventory = new Inventory("Test!", 54);
    inventory.setItem(0, new ItemStack(Material.APPLE));
    Sound effects can be played to clients just as they normally are. The packet added is called OutNamedSoundEffect. Below you can see how to play a sound effect to any player!
    Code (Text):
    ProxiedPlayer player = null; /* Make this not null when you do it ;)*/
    String soundEffect = SoundEffect.<YOUR SOUND>;
    float volume = 1F;
    float pitch = 1F;

    BungeePackets.playSound(player, soundEffect, volume, pitch);
    Particle effects can be displayed to clients just as they normally are. The packet added is called OutWorldParticles. Below you can see how to display a particle effect for any player.

    There are 2 methods do play particle effects. One uses the players base position. The other uses coordinates.
    Code (Text):
    ProxiedPlayer player = null; /* Make this not null when you do it ;)*/
    ParticleEffect effect = ParticleEffect.CLOUD;

    //The method playEffect has the following structure:
    //playEffect(<player>, <particle effect>, <offsetX>, <offsetY>, <offsetZ>, <speed>, <amount>);
    //playEffect(<player>, <particle effect>, <x>, <y>, <z>,<offsetX>, <offsetY>, <offsetZ>, <speed>, <amount>);
    playEffect(player, effect, 0.1F, 0.1F, 0.1F, 1F, 10);
    Player positions are sent to the BungeeCord from the InFlying packet. This means the client is broadcasting its own coordinates. This is possible to exploit if the client has a custom mod. This is the most reliable way to get the clients coordinates though. Using this method, even if the server dies (not the BungeeCord) particle effects and sounds will still play properly.
    Code (Text):
    ProxiedPlayer player = null; /* Make this not null when you do it ;)*/
    Position position = BungeePackets.getPlayerPosition(player.getUniqueId());

    double x = position.getX();
    double y = position.getY();
    double z = position.getZ();

    Source Code
    You can find the source code, and in depth usage for the API on the GitHub.

    Leave a Review
    If you use the plugin, or find it useful in any way (or not useful :(), please leave your feedback below.

Recent Reviews

  1. RoxasX_X
    Version: 1.6
    Doesn't work with the latest Bungeecord version.
    Just returns null or didn't do the methode.
  2. syntax.
    Version: 1.6
    Nice one, but why does this result into null?
    The player uniqueId is not null and the player online

  3. ItsDesox
    Version: 1.6
    Please update! Not working with latest version of bungeecord. it says
    Cannot get ID for packet class org.spawl.bungeepackets.packet.server.OutOpenWindow in state GAME
    when i try to open a inventory
  4. Rack
    Version: 1.6
    Amazing Plugin, could we get better docs tho? Thanks, Cant figure out some stuff due to it's not explained well.
  5. Dr_Crazy
    Version: 1.6
    it is a nice plugin

    i have one question

    is it have InventoryClickEvent Or Not ?

    Sorry My English Too Bad
  6. augesrob.com
    Version: 1.6
    doesn't support 1.9 this sucks hardcore dude. Please update soon this is horrible. Ill edit once we can finally use it.
  7. Th3Tr0LLeR
    Version: 1.6
    Awesome resource! I tried to make Player Info Packet(PacketPlayOutPlayerInfo) and Respawn packet(PacketPlayOutRespawn), but i can't :/.

    Can you add them please ?

  8. Serverplayer
    Version: 1.5
    Thats very nice, I searched for a similar like this because I need this for a Plugin :D
    Please keep it updated!
  9. miaomiaojiang
    Version: 1.3
    but i can;t use it.
  10. SancLovin
    Version: 1.3
    Thanks for made this plugin, keep update!