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 visible (Hide)
Published by retrooper over 3 years ago
Please remember this is only a summary of the changes, I won't list every single change to keep this readable.
Make sure you set load in your plugin.yml to POSTWORLD!
Setting load to STARTUP will cause users with late-bind enabled to run into issues.
...
load: POSTWORLD
...
None available
Published by retrooper over 3 years ago
Please remember this is only a summary of the changes, I won't list every single change to keep this readable. I only specify the most important changes.
Make sure you set load in your plugin.yml to POSTWORLD!!! Or just don't specify anything as its default value is POSTWORLD.
Not doing this will break late-bind support.
...
load: POSTWORLD
...
Published by retrooper over 3 years ago
Please remember this is only a summary of the changes, I won't list every single change to keep this readable. I only specify the most important changes.
Published by retrooper over 3 years ago
Please remember this is only a summary of the changes, I won't list every single change to keep this readable. I only specify the most important changes.
Published by retrooper over 3 years ago
Please remember this is only a summary of the changes, I won't list every single change to keep this readable. I only specify the most important changes.
name: myplugin
version: 1.0.0
main: me.opdeveloper.myplugin.MainClass
load: STARTUP
author: myname
softdepend:
- ProtocolLib
- ProtocolSupport
- ViaVersion
Published by retrooper over 3 years ago
Please remember this is only a summary of the changes, I won't list every single change to keep this readable. I only specify the most important changes.
name: plugin-name
version: 1.0.0
main: package.MainClass
load: STARTUP
author: username
softdepend:
- ProtocolLib
- ProtocolSupport
- ViaVersion
Published by retrooper over 3 years ago
Please remember this is only a summary of the changes, I won't list every single change to keep this readable. I only specify the most important changes.
name: plugin-name
version: 1.0.0
main: package.MainClass
load: STARTUP
author: username
softdepend:
- ProtocolLib
- ProtocolSupport
- ViaVersion
PacketEvents#loadAsync(ExecutorService)
or
PacketEvents#loadAsyncNewThread()
@Override
public void onPacketPlayReceive(PacketPlayReceiveEvent event) {
Player player = event.getPlayer();
byte packetID = event.getPacketId();
if (packetID == PacketType.Play.Client.USE_ENTITY) {
WrappedPacketInUseEntity useEntity = new WrappedPacketInUseEntity(event.getNMSPacket());
Entity entity = useEntity.getEntity(player.getWorld());
}
}
Published by retrooper over 3 years ago
Please remember this is only a summary of the changes, I won't list every single change to keep this readable. I only specify the most important changes.
Published by retrooper over 3 years ago
Please remember this is only a summary of the changes, I won't list every single change to keep this readable. I only specify the most important changes.
Published by retrooper over 3 years ago
Published by retrooper over 3 years ago
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!
Published by retrooper over 3 years ago
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
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;
}
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#isHigherThan -> ServerVersion#isNewerThan
ServerVersion#isHigherThanOrEquals -> ServerVersion#isNewerThanOrEquals
ServerVersion#isLowerThan -> ServerVersion#isOlderThan
ServerVersion#isLowerThanOrEquals -> ServerVersion#isOlderThanOrEquals
ClientVersion#isHigherThan -> ClientVersion#isNewerThan
ClientVersion#isHigherThanOrEquals -> ClientVersion#isNewerThanOrEquals
ClientVersion#isLowerThan -> ClientVersion#isOlderThan
ClientVersion#isLowerThanOrEquals -> ClientVersion#isOlderThanOrEquals
Published by retrooper over 3 years ago
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)
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()
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.
Published by retrooper almost 4 years ago
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!
Published by retrooper almost 4 years ago
Published by retrooper almost 4 years ago
WrappedPacketOutChat packet = new WrappedPacketOutChat("Hello", ChatPosition.CHAT, uuid);
Published by retrooper almost 4 years ago
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.
Published by retrooper almost 4 years ago
Published by retrooper almost 4 years ago
Published by retrooper almost 4 years ago