PacketPacket icon

PacketPacket -----

Easy and simple packet listening, cancelling & sending for each player



This Library / API is designed for simple and easy listening, cancelling and sending of packets.

Packet listening and cancelling can be done the same simple way as event listening and cancelling which is why this was made for.

PacketPacket contains custom packet classes with the same name as the original packet classes but with an extra " P" in the beginning so the packet you're looking for shouldn't be hard to find.

For example, PacketPlayOutChat is PPacketPlayOutChat, PacketPlayOutBlockChange is PPacketPlayOutBlockChange and so on..

If you have any problems with PacketPacket, please message me.
Make sure to not /reload every so often.

Some Examples of PacketPacket
Code (Java):
package aPackage ;

import dev.pixelmania.packetpacket.packet.PPacketPlayInChat ;
import dev.pixelmania.packetpacket.packet.PacketHandler ;
import dev.pixelmania.packetpacket.packet.PacketListener ;
import dev.pixelmania.packetpacket.packet.PacketPriority ;

public class AClass implements PacketListener {
    @ PacketHandler ( priority = PacketPriority. HIGHEST, ignoreCancelled = false )
    public void aMethod (PPacketPlayInChat packet ) {
        packet. setCancelled ( true ) ;
        System. out. println ( packet. getPlayerName ( ) + " : " + packet. isCancelled ( ) ) ;
    }
}

// Class must implement "dev.pixelmania.packetpacket.packet.PacketListener" as shown above.
// priority and ignoreCancelled is optional for @ PacketHandler.
// all the packet names are the same as Bukkit's but just add an extra "P" to the beginnning.
// ( "PacketPlayInChat" - from Bukkit is "PPacketPlayInChat" - from PacketPacket )

Code (Java):
package aPackage ;

import org.bukkit.plugin.java.JavaPlugin ;

import bPackage.APacketListenerClass ;
import dev.pixelmania.packetpacket.PacketPacket ;

public class AClass extends JavaPlugin {
    @ Override
    public void onEnable ( ) {
        PacketPacket. registerPackets ( new APacketListenerClass ( ), this ) ;
    }
}

// Registering packets is the same as if you were registering Bukkit events as shown above and below.
// Bukkit.getPluginManager().registerEvents( new EventListenerClass(), this ); << Bukkit Event Registering
// ;
// PacketPacket.registerPackets( new PacketsListenerClass(), this); << Packets Registering
// Very simple.

An example plugin using PacketPacket


If you like PacketPacket, then please consider leaving a review!
If your plugin uses PacketPacket, message me and I will add it to the list below.


Plugins using this Library / API ;
- n/a

Make sure to add PacketPacket as depend in your plugin.yml!

You can use priority and ignoreCancelled when using @ PacketHandler above a method just like with an event's EventHandler.
Code (Java):
@ PacketHandler ( priority = PacketPriority. HIGH, ignoreCancelled = true )
Registering a PacketListener class ( The class has to implement PacketListener from PacketPacket )
Code (Java):
PacketPacket. registerPackets ( PacketListener, JavaPlugin ) ;
Sending a packet to a player
Code (Java):
PacketPacket. sendPacket ( Player, Packet ) ;
Default methods of PacketPacket packets
Code (Text):
// Returns a Player object
.getPlayer();

// Returns a String object
.getPlayerName();

// Sets if the packet will be cancelled
.setCancelled( boolean );

// Returns a boolean value
// true = Packet is cancelled
// false = Packet is not cancelled
.isCancelled();
@ PacketHandler parameters
Code (Java):
@ PacketHandler ( priority = PacketPriority. [PRIORITY ], ignoreCancelled = [ boolean ] )

// The parameters of @ PacketHandler are optional.

// PacketPriority is from LOWEST to MONITOR

// If ignoreCancelled = true then the method under @
// PacketHandler will not be called if the packet is cancelled.
Resource Information
Author:
----------
Total Downloads: 350
First Release: Dec 29, 2020
Last Update: Sep 17, 2021
Category: ---------------
All-Time Rating:
0 ratings
Version -----
Released: --------------------
Downloads: ------
Version Rating:
----------------------
-- ratings