PacketEvents is emerging as a strong contender in the realm of Minecraft packet processing libraries. Designed to simplify packet manipulation while delivering high performance, this powerful tool aims to demystify the complexities of projects utilizing packets.
GPL-3.0 License
Bot releases are hidden (Show)
Published by retrooper almost 4 years ago
• PacketSendEvent accidentally called on a server list ping resulting Player to be null, corrected to be a PacketStatusEvent.
It is a good practice to check if the packet ID in the PacketReceiveEvent and PacketSendEvent isn't -1, and THEN start processing and access the player to be as error free as possible.
• WrappedPacketInVehicleMove wrapper created(packet only exists on 1.9+)
Published by retrooper almost 4 years ago
• Early player login bug fixed.
If you would join while the server was still starting, PacketEvents would spam errors, if you had early inject mode enabled. This has been fixed and you will be kicked and asked to rejoin in the kick reason.
Published by retrooper almost 4 years ago
This changelog displays all changes since the last release(1.6.9).
These changes are listed from the oldest to the most recently added features/bug fixes.
I have not had the time to test every single feature, but I am very certain that a lot of things will work.
Make sure to report bugs as soon as you find them, so they can be fixed in a patch update.
• All deprecated methods since 1.6.9 have been cut off.
• The wrappers cache the fields efficiently for an even better performance experience. (Thanks to @terrarier2111)
• Usage of PacketEventsSettings changed.
Doing this is now possible:
PacketEvents.getSettings().injectAsync(true).ejectAsync(true).
useProtocolLibIfAvailable(true);
• Bug in WrappedPacketInWindowClick fixed.
• Cleaner errors, a few custom exceptions created(for example WrapperFieldNotFoundException) to help us spot bugs easier.
• WrappedPacketInArmAnimation removed as it was just a redundant wrapper, nothing to read.
• WrappedPacketOutGameStateChange "value" field accidentally returned the "reason" field.
• Finding entities by their ID optimized to use less reflection calls than necessary.
• WrappedPacketOutEntityMetadata created, for now only provides entity ID(so unfinished).
• WrappedPacketOutEntityTeleport wrapper created, performs best on 1.7-1.8.x.
Not recommended to use wrappers if it is possible with the Bukkit API as we will most likely be slower due to our reflection calls.
It is common that the required reflection calls of a field in a wrapper unfortunately increases every 3rd/4th minecraft update.
So wrappers perform best on 1.7.10 and 1.8.
• WrappedPacket now supports a nice util to write to fields.
Use this if a sendable wrapper you want to use does not exist yet.
• All wrappers optimized to only read the fields you access with its getter method.
For example, in the flying packet, if you only need access the xyz coordinates and nothing else, PacketEvents will not use reflection calls to redundantly read the other fields.
• Optimized ServerVersion enum, isHigherThan, isLowerThan.. with the ServerVersion have been optimized and are now not heavy at all, you no longer need to cache these things. (Thanks to @terrarier2111)
• Netty channel accessing (even when cached) optimized. (Thanks to @terrarier2111)
• Lots and lots of code cleanup. (Thanks to @terrarier2111)
• PacketEvents now calculates player ping independently with Keep Alive packets(we don't send any ourselves).
If you would still like to access NMS' calculated ping, now use:
PacketEvents.getAPI().getPlayerUtils().getNMSPing(Player);
The NMS ping is smoothed, so if you want a value close to NMS' calculations use:
PacketEvents.getAPI().getPlayerUtils().getSmoothedPing(Player);
• PostPacketReceiveEvent and PostPacketSendEvent created. (Not cancellable, they events assure you the relating event wasn't cancelled)
• Update checking uses the same thread pool that is used to inject players, eject players, and process events.
• WrappedPacketOutEntity can now be sent to players.
• BungeeCord support added(Check out the Bungee version)
• Vector3i utility class created
• PacketEvents auto resolve client version setting removed as it may cause falses and is now unneeded.
• PacketEvents now has a setting to use TinyProtocol and basically inject players earlier, so you won't need a dependency to resolve client versions.
• PacketLoginEvent created
• PacketStatusEvent created
• WrappedGameProfile utility class created
• Setting to inject earlier created(Basically if TinyProtocol should be used)
TinyProtocol allegedly has bugs when users join while the server is still starting, I will double check and test.
• New Setting to activate/deactivate TinyProtocol. If ViaVersion, ProtocolSupport or ProtocolLib is found, we will use their APIs to access their already resolved client version, so we don't have to. :)
This setting is enabled by default btw.
PacketEvents.getSettings().injectEarly(boolean);
• PacketType.Login.x and PacketType.Status.x Packet IDs created.
• All new login wrappers created:
WrappedPacketLoginDisconnect, WrappedPacketLoginHandshake, WrappedPacketLoginInCustomPayload(roughly since 1.13.2), WrappedPacketLoginInStart, WrappedPacketLoginOutEncryptionBegin, WrappedPacketLoginInEncryptionBegin, WrappedPacketLoginOutSetCompression(roughly since 1.8), WrappedPacketLoginOutSuccess
• All new status wrappers:
WrappedPacketStatusPing, WrappedPacketStatusPong
• The login and status event will only be triggered if you toggle on the early inject setting, as we need to inject early to listen to them.
• WrappedPacketOutExplosion created and can be sent to players.
• WrappedPacketOutEntityStatus created and can be sent to players.
• WrappedPacketOutExperience created and supports being sent to players.
Published by retrooper about 4 years ago
Sadly no changelog for now, I might later edit this and post the changes.
Published by retrooper about 4 years ago
boolean value = true;
PacketEvents.getAPI().getSettings().setShouldCheckForUpdates(value);
value = PacketEvents.getAPI().getSettings().shouldCheckForUpdates();
Published by retrooper about 4 years ago
The changelog might be small, but a lot of work has been added to each change.
• Official 1.16.3 support(not everything has been tested)
• PacketType has been moved from io.github.retrooper.packetevents.packet.PacketType to io.github.retrooper.packetevents.packettype.PacketType
• Reflection usage optimized, packet wrappers are overall faster now, memory usage should be much lower now. (Thanks to @funkemunky)
• WrappedPacketOutGameStateChange wrapper created(supports sending to players)
• WrappedPacketInUpdateSign wrapper created
• Sending packets to players has been optimized, I no longer use reflection(Suggested by @funkemunky)
• New functions appended to WrappedPacketReader interface and implemented in WrappedPacket.
WrappedPacket wrapper = new WrappedPacket(object);
byte[] bArray = wrapper.readByteArray(0);
short[] sArray = wrapper.readShortArray(0);
int[] iArray = wrapper.readIntArray(0);
...
String[] strArray = wrapper.readStringArray(0);
Object[] array = wrapper.readObjectArray(0, MyClass.class);
• Setting to prevent PacketEvents from interacting with ProtocolLib if ProtocolLib is available added, some people experience issues with ProtocolLib.
PacketEvents.getAPI().getSettings().setUseProtocolLibIfAvailable(boolean)
• Update Checker in PacketEvents letting you know if a new version of PacketEvents has been released
• WrappedPacketOutCustomPayload wrapper
• WrappedPacketOutEntityMetadata wrapper
Published by retrooper about 4 years ago
• Creating wrappers is much easier, cleaner and shorter.
• Thread safety issues with the new event priority system fixed(didn't let users connect to the server)
• You can make your own mini wrappers, example:
@PacketHandler
public void onReceive(PacketReceiveEvent event) {
if(event.getPacketId() == PacketType.Client.FLYING) {
WrappedPacket miniWrapper = new WrappedPacket(event.getNMSPacket());
double x = miniWrapper.readDouble(0);
double y = miniWrapper.readDouble(1);
double z = miniWrapper.readDouble(2);
boolean onGround = miniWrapper.readBoolean(0);
}
}
All current packet wrappers use these new functions ('readDouble', ect...).
So if a wrapper doesn't already exist, you can use these functions.
• Code cleanup in ALL wrappers
• WrappedPacketOutAbilities#getWalkSpeed() accidentally returned the value of WrappedPacketOutAbilities#getFlySpeed()
• WrappedPacketOutChat.fromStringToJSON() debug removed
• WrappedPacketOutKickDisconnect constructor now requires a json string, and doesn't convert for you
• WrappedPacketOutUpdateHealth#getFoodSaturation() accidentally returned the value of WrappedPacketOutUpdateHealth#getHealth()
• WrappedPacketOutEntity has subclasses, like rel entity move, ect...
• WrappedPacketInFlying subclasses no longer extend the WrappedPacketInFlying, they are now just static classes inside it, this will mean they won't contain all functions like WrappedPacketInFlying does, this was done just to avoid confusion.
Published by retrooper about 4 years ago
• PacketEvents not enabling if ProtocolLib isn't present BUG FIX!
Published by retrooper about 4 years ago
• Event priority system added(Passed onto ProtocolLib if ProtocolLib is present)
• PacketEvents uses ProtocolLib API to listen to packets if it is available.
This update should help making your plugins compatible with other plugins using the ProtocolLib API.
It is recommended to add 'ProtocolLib' as a soft dependency to your plugin now
What to expect in the next update?
• Better wrapper creation API, to make creating wrappers easier, especially for the contributors.
• Cleanup code, PacketEvents might not be too clean at the moment
• Test if sending packets breaks with ProtocolLib
• Create WrappedPacketOutCustomPayload wrapper
• Create WrappedPacketOutEntityMetadata wrapper
Published by retrooper about 4 years ago
PacketEvents.getAPI().getPlayerUtils().getClientVersion(Player) always ClientVersion.INVALID fix
A lot more ServerVersion enum constants added
BukkitMoveEvent deprecated and will most likely be removed
Performance issues with PacketEvents causing players to have high ping FIXED(just make sure you have async injection setting on) - Thanks to @LIWKK for reporting and helping out a bit
PacketEvents FULLY documented, good for the JavaDoc
PacketEvents license and copyright notice added in each file, when distributing closed source versions of your products, make sure you don’t obfuscate my files
Accessing server version failure fixed
PacketEvents.start(Plugin) deprecated, use PacketEvents.init(Plugin)
PacketType.Server packet IDs are now final(constant), you can now use them in switch statements - @undersquire
PacketEvents API Guide is in the process of a reqrite, almost finished
Published by retrooper about 4 years ago
Published by retrooper about 4 years ago
Published by retrooper about 4 years ago
Published by retrooper about 4 years ago
public Entity getEntity();
Published by retrooper about 4 years ago
Published by retrooper about 4 years ago
Published by retrooper about 4 years ago
• Code cleanup
• PacketReceiveEvent#getNMSPacketClass() deprecated
• PacketReceiveEvent#getPacketName() deprecated
• PacketSendEvent#getNMSPacketClass() deprecated
• PacketSendEvent#getPacketName() deprecated
• PlayerUninjectEvent#PlayerUninjectEvent(Player player, boolean sync) deprecated, use PlayerUninjectEvent#PlayerUninjectEvent(Player player)
• PlayerUninjectEvent#isSync deprecated, do not use this function at all anymore, useless function
• WrappedPacketInBlockDig null pointers fixed for 1.7.10, just Direction field will be Direction.NULL, I will fix later
Published by retrooper about 4 years ago
Published by retrooper about 4 years ago
Published by retrooper about 4 years ago