Skip to content

Releases: retrooper/packetevents

1.8-pre-3

07 Feb 19:05
Compare
Choose a tag to compare
1.8-pre-3 Pre-release
Pre-release

CHANGELOG

BUG FIXES

  • ClientVersion#isPreRelease bug fix by @terrarier2111
  • Before PacketEvents used to kick users, because it "Failed to inject" them. This would usually occur when users join while the server is starting. We have FIXED this. We will schedule a re-injection a bit later(one second), and with our testing, it seems to work! You are now able to configure the action PacketEvents should do when the re-injection fails(should never be the case, unless there are incompatibilities). By default PacketEvents will kick the user.
    Example of how to modify the action: https://github.com/retrooper/packetevents-example/blob/master/src/main/java/Main.java#L35

NEW FEATURES

  • WrappedPacketOutChat(BaseComponent, UUID) constructor added.

  • WrappedPacketOutNamedSoundEffect wrapper finished(NOT sendable yet).

  • WrappedPacketInBlockPlace#getCursorX, WrappedPacketInBlockPlace#getCursorY, WrappedPacketInBlockPlace#getCursorZ added by @Tecnio
    WARNING: These methods are only supported on 1.7.10 up to 1.8.8 versions of minecraft as newer versions no longer give us this data.

  • WrappedPacketOutPosition finished, new methods added. You can now check if the values in the wrapper are relative or absolute.

  • You can now filter out what packets get called in your packet listener.(NOT SUPPORTED ON LEGACY EVENT SYSTEM/legacy packet listener).
    Doing this might noticeably improve performance of your plugin.
    Learn how to use this new feature by viewing this example: https://github.com/retrooper/packetevents-example/blob/master/src/main/java/Main.java#L69

  • PacketListenerDynamic#onPacketEventExternal added. Since the PacketListenerDynamic has a method for every in-built event. You might ask how can I use a custom event created using the PacketEvents event system. You can use the PacketListenerDynamic#onPacketEventExternal. It is only fired for external events, events that aren't built into the PacketEvents API!

OPTIMIZATIONS

  • WrappedPacketInEntityAction optimized and cleaned up.
  • ClientVersion cleaned up by @terrarier2111

CHANGES

  • Direction enum import changed.
    Direction.OTHER is when the face is equal to 255(check wiki.vg/Protocol for more information)
    Direction.INVALID is when the face is not recognized. The user might be cheating or might be a new protocol change? Not sure?
  • PacketListenerDynamic#onPacketEvent used to be a method called for every single event, allowing you to do "instanceof" checks to use your target event, but this feature is useless due to how little events we have. We removed it to help improve performance, we also realized that barely anyone used this feature.

EXAMPLE USAGE

View packetevents-example source code for 1.8-pre-3

1.8-PRE-2

29 Jan 17:25
Compare
Choose a tag to compare
1.8-PRE-2 Pre-release
Pre-release

CHANGELOG

This pre-release mainly focussed on fixing bugs.
Again, this is intentionally marked as a pre-release as it MIGHT not be production-ready. Updating to the pre-releases can help us spot more bugs until the 1.8 release. Help us make 1.8 stable! Till now

BUG FIXES

  • Fixed ping being 0 on extremely laggy players.
  • ServerVersion comparisons falsing on server versions with the same protocol version (for example 1.16.4 and 1.16.5) FIXED.

NEW FEATURES

  • You are now given the control to perform update checks.
    The update check will run on the current thread you are on.
UpdateChecker.UpdateCheckerStatus  status = PacketEvents.get().getUpdateChecker().checkForUpdate(); 
switch (status) {
        //Your build is outdated, an update is available.
        case OUTDATED: 
                break;
        //You are on a dev or pre-released build. Not on the latest release. Your build is newer than the latest release.
        case PRE_RELEASE:
                break;
        //Your build is up to date.
        case UP_TO_DATE:
                break;
        //Failed to check for an update. There might be an issue with your connection. 
        case FAILED:
                break;
}

OPTIMIZATIONS

  • Cleanup to internal packet processor by @terrarier2111
  • We now create a temporary thread for the update check (as the server starts) as we no longer need that thread after the update check.
    We don't perform any updates after that.
  • Cleaned up a few wrappers and sped up load times for a couple of wrappers.

CHANGES

  • Usage of the direction/face in wrappers changed.
    Wrappers now return the face as a byte.
    You can now use the Direction class to find out the face.
    Example:
WrappedPacketInBlockPlace blockPlaceWrapper = new WrappedPacketInBlockPlace(event.getNMSPacket());
byte face = blockPlaceWrapper.getDirection();
if (face == Direction.DOWN) {
       //Face is down
}

You can check the Direction class to see what faces exist.

  • ServerVersion#isNewerThan, ServerVersion#isNewerThanOrEquals, ServerVersion#isOlderThan, ServerVersion#isOlderThanOrEquals created, other comparison methods DEPRECATED.
ServerVersion#isHigherThan -> ServerVersion#isNewerThan
ServerVersion#isHigherThanOrEquals -> ServerVersion#isNewerThanOrEquals
ServerVersion#isLowerThan -> ServerVersion#isOlderThan
ServerVersion#isLowerThanOrEquals -> ServerVersion#isOlderThanOrEquals
  • ClientVersion#isNewerThan, ClientVersion#isNewerThanOrEquals, ClientVersion#isOlderThan, ClientVersion#isOlderThanOrEquals created, other comparison methods DEPRECATED.
ClientVersion#isHigherThan -> ClientVersion#isNewerThan
ClientVersion#isHigherThanOrEquals -> ClientVersion#isNewerThanOrEquals
ClientVersion#isLowerThan -> ClientVersion#isOlderThan
ClientVersion#isLowerThanOrEquals -> ClientVersion#isOlderThanOrEquals

EXAMPLE USAGE

View packetevents-example source code for 1.8-PRE-2

v1.8-PRE-1

25 Jan 12:07
Compare
Choose a tag to compare
v1.8-PRE-1 Pre-release
Pre-release

CHANGELOG

The official release of PacketEvents 1.8 is very near. We only need to finish the official guide, finish documenting the API and make sure PacketEvents 1.8 will be as bug-free as possible.
We are doing our best to have 1.8 be stable unlike most previous releases.
This is a pre release, meaning it might NOT be production ready.
Thank you to all users that have been frequently updating to the dev builds to help us fix all the bugs and improve the API.
We would really appreciate if you read this changelog as a lot of effort is put into our changelogs.
A couple of users end up discovering new features and get surprised that they have been added many versions ago.
The changelog is a summary of the changes, we'd like to let you know that this pre release is just under 200 commits ahead of the last release! (1.7.9)

BUG FIXES

  • Cancelling events in the PacketListenerDynamic works again.
  • Internal netty early injector bug fixes.
  • WrappedPacketInAbilities#isFlying fixed for 1.16
  • Couple of ClientVersion resolving bugs fixed.

NEW FEATURES

NEW WRAPPERS / NEW WRAPPER FEATURES

  • WrappedPacketInUseEntity#getHand added.
  • WrappedPacketOutOpenWindow added. (NOT SENDABLE)
  • WrappedPacketInEnchantItem added.
  • WrappedPacketInSpectate added.
  • WrappedPacketInSetCreativeSlot added by @NikV2 .
  • WrappedPacketInTeleportAccept added by @Tecnio .
  • WrappedPacketInItemName added by @Tecnio .
  • WrappedPacketInPickItem added by @Tecnio .
  • WrappedPacketInBeacon added by @Tecnio .
  • WrappedPacketOutChat(BaseComponent, ChatPosition, UUID) created. (support for hoverable messages in the wrapper)

OTHER NEW FEATURES

  • NMSPacket class created.
  • ClientVersion#isPreRelease added.
  • PacketType.Play.Server.NAMED_ENTITY_SPAWN added by @LIWKK

OPTIMIZATIONS

  • Wrapper internal field caching improved.
  • Internal channel caching improved.
  • Internal packet and event processing optimized.
  • Dynamic wrapper loading, PacketEvents won't load every single wrapper.
    As soon as you use a wrapper for the first time, that is when PacketEvents will load that wrapper.
    Leading to faster PacketEvents load times and lower memory usage.
  • Dynamic event system optimized. (WARNING, registering listeners is NOT thread safe)
  • Legacy event system minimally optimized (STILL unrecommended to use)
  • Injection system improved/optimized.
  • WrappedPacketOutAnimation cleaned up and optimized.

CHANGES

  • TinyProtocol removed, wrote my own similar injector (same approach as TinyProtocol).

  • PostPlayerInjectEvent is no longer always called asynchronously. PostPlayerInjectEvent#isAsync will let you know if it has been called on the main thread or not.

  • PacketEvents instance accessor method renamed.
    PacketEvents.getAPI() has been deprecated for now.

PacketEvents.getAPI() -> PacketEvents.get()
  • Added jetbrains annotations dependency with scope "compile" to use the Nullable and NotNull annotation.
  • Renaming/Refactoring...
PacketType.Client -> PacketType.Play.Client
PacketType.Server -> PacketType.Play.Server
-
PacketType.Login split up into:
PacketType.Login.Client
PacketType.Login.Server
-
PacketType.Status split up into:
PacketType.Status.Client
PacketType.Status.Server

PacketReceiveEvent -> PacketPlayReceiveEvent
PacketSendEvent -> PacketPlaySendEvent

PacketLoginEvent -> PacketLoginReceiveEvent & PacketLoginSendEvent

PacketStatusEvent -> PacketStatusReceiveEvent & PacketStatusSendEvent

PacketListenerDynamic#onPacketReceive -> PacketListenerDynamic#onPacketPlayReceive
PacketListenerDynamic#onPacketSend -> PacketListenerDynamic#onPacketPlaySend

PacketListenerDynamic#onPacketLogin -> PacketListenerDynamic#onPacketLoginReceive & PacketListenerDynamic#onPacketLoginSend

PacketListenerDynamic#onPacketStatus -> PacketListenerDynamic#onPacketStatusReceive & PacketListenerDynamic#onPacketStatusSend

PacketListenerDynamic#onPostPacketReceive -> PacketListenerDynamic#onPostPacketPlayReceive
PacketListenerDynamic#onPostPacketSend -> PacketListenerDynamic#onPostPacketPlaySend

Please check the example repository linked at the very bottom, I have not listed all renames/refactors. Hopefully the example will help you, otherwise make an issue on the GitHub repository or ask in the discord server.

  • Cleaned up the built-in events with better abstraction.
    All events relating to packets extend NMSPacketEvent or CancellableNMSPacketEvent (depends if they support cancelling)
  • PacketEvents supporting multiple plugins shading the same API under ONE condition. The PacketEvents version of the plugins must be the SAME for them to be compatible and for you to avoid ClassLoader issues.
  • PacketEventPriority is now an enum and contains enum constants instead of byte constants.
    The legacy event system still uses bytes. To access the byte value of an enum constant in the PacketEventPriority enum use the getPriorityValue method.
  • NMS Entity cache accessing fixed for mSpigot and its forks by @LIWKK .

EXAMPLE USAGE

View packetevents-example source code for 1.8-PRE-1

v1.7.9

23 Nov 12:13
bd1e4e7
Compare
Choose a tag to compare

CHANGELOG

I tried to prioritize bug fixes rather than new features to prevent the creation of new bugs in this update.
I tested everything and everything should be working fine!

BUG FIXES
  • Cached Entity Not Found when accessed in wrappers FIXED
  • ClientVersion was unresolvable for 1.16.3 and 1.16.4 clients FIXED
  • PacketEvents failing to inject you and doesn't call any events for your player (RARE BUG) fixed.
    This bug could only happened if you had injectEarly set to true.
  • PacketEvents' version lookup utilities now prioritizes ViaVersion, then ProtocolLib and then lastly ProtocolSupport.
    There was a bug where ProtocolSupport errored if PacketEvents used it for the protocol version lookup.
  • UpdateChecker not working FIXED
NEW FEATURES
  • PostPlayerInjectEvent created, this event is fired after the ClientVersion gets resolved.
    The event contains the client version and the netty channel object.
    The event is always called synchronously and it is recommended to register all your player data in this event.

v1.7.8

17 Nov 14:41
c9d58e0
Compare
Choose a tag to compare

CHANGELOG

INFO
  • The PacketEvents.getSettings().useProtocolLibIfAvailable(boolean) setting is most likely not be coming back.
  • Recommended to have ViaVersion, ProtocolSupport or ProtocolLib on your spigot server, as PacketEvents makes use of them to resolve client version ONLY if they are available.
NEW FEATURES
  • Official 1.16.4 support
    ClientVersion.v_1_16_4, ServerVersion.v_1_16_4 created
BUG FIXES
  • Bungee client version resolving bug fixed
    One of the recommended dependencies(ViaVersion, ProtocolSupport, ProtocolLib) are only required on the spigot server if you have a bungee network.
  • Interruption of PacketEvents.stop() protected(Two plugins calling the method will no longer break PacketEvents)

v1.7.7

16 Nov 17:00
38c4f32
Compare
Choose a tag to compare

Changelog

BUG FIXES

  • Accessing Entity by ID on servers with more than one world ERROR FIX
  • Possibly cleared console error spam on player injection failures, by handling the exception and kicking the player instead.(Fix only for developers with the "earlyInject" setting disabled)

CHANGES/FEATURES

  • In the WrappedPacketOutChat(String, ChatPosition, UUID) constructor, the String(=message) shouldn't be passed in JSON string format, it can be passed in as an ordinary string message!
    Example:
WrappedPacketOutChat packet = new WrappedPacketOutChat("Hello", ChatPosition.CHAT, uuid);

v1.7.6

15 Nov 12:03
85dab8e
Compare
Choose a tag to compare

Changelog

Bug fixes

  • Resolving ClientVersion on BungeeCord servers fixed.

New Custom Exceptions

  • PacketEventsLoadFailureException exception thrown if PacketEvents fails to load.
  • PacketEventsMethodAccessException exception thrown if PacketEvents fails to access a method of a PacketListener for invoking.
  • PacketEventsMethodInvokeException exception thrown if an exception is thrown from the invoked method in the PacketListener.
  • PacketEventsNMSCachedEntityNotFoundException exception created and is thrown when the cached entity in an “Entity By ID” lookup isn’t found.
    Can be thrown when accessing entity in multiple different wrappers, like the WrappedPacketInUseEntity#getEntity().

New Features

  • PacketListenerDynamic, you can now register listeners differently and more dynamically.
PacketListenerDynamic listener= new PacketListenerDynamic(PacketEventPriority.NORMAL) {
            @Override
            public void onPacketReceive(PacketReceiveEvent event) {
                if(event.getPacketId() == PacketType.Client.CHAT) {
                    event.getPlayer().sendMessage("You sent a message!");
                }
            }
        };
        PacketEvents.getAPI().getEventManager().registerListener(listener);

Why should you switch?
The previous system is much slower than this new system as we are forced to use reflection to cal your methods.
The previous system didn’t call the event methods in any order, this new system calls the lowest priorities first and the highest priorities last.

Deprecations

  • The previous packet listening system, it is recommended to slowly start switching to the new system.
    The new system performs much faster, is cleaner, overall better.

Removed

  • PacketEvents.getSettings().useProtocolLibIfAvailable(boolean) temporarily removed, currently unsupported, so has been removed.
    Expect it to be back in the next update.
  • ViaVersion and ProtocolSupport ClientVersion lookup utils removed.

v1.7.5

09 Nov 06:23
a88e95e
Compare
Choose a tag to compare

Changelog

  • WrappedPacketInBlockPlace#getX,Y,Z returning -1 on 1.8 servers FIXED.

v1.7.4

08 Nov 14:25
a1c591a
Compare
Choose a tag to compare

Changelog

  • Direction enum cleaned up, unneeded enum constant values removed.
  • NullPointerException with the Player in PacketSendEvent FIXED.
  • WrappedPacketInBlockDig getX(), getY(), getZ() not working FIXED.
  • WrappedPacketInBlockDig.getDirection() optimized and now works on 1.7.10.
    FYI the direction is also known as the block face.
  • WrappedPacketInBlockPlace#getX(), getY(), getZ() not working FIXED.
  • WrappedPacketInBlockPlace#getItemStack() removed as the itemstack field doesn't exist in newer versions.
    Legacy packetevents was lazily coded and actually used a block iterator to find the block you are looking at.
    I now removed the field as we cannot have full cross version compatibility with the method.
    If you don't want to be supporting the newer versions, use my wrapper creation utilities to access it yourself.
  • WrappedPacketInBlockPlace#getDirection() added
  • WrappedPacketInUpdateSign#getX(), getY(), getZ() not working FIXED.
  • WrappedPacketInUpdateSign#getTextLines() errors FIXED.
  • WrappedPacketOutHeldItemSlot wrapper created.(Basically change player's current selected slot)
  • Incompatibility and errors with paper(1.16.x) fixed.
  • PacketEvents.getSettings().packetHandlingThreadCount(int) setting added.
    It lets you decide how many threads PacketEventsshould use when asynchronously injecting/ejecting players, processing packets(PacketEvents' end) and event calling(processing on your end).
    PacketEvents' current default settings are the most recommended settings.
    Having more than one thread doing all that processing might cause you (or PacketEvents, as that feature hasn't been tested that much) some concurrency issues where multiple threads are accessing/modifying the same data at the same time!

v1.7.3

03 Nov 08:55
552f63a
Compare
Choose a tag to compare

Changelog

  • Performance improvement when players leave
  • Fixed error when you leave the server