v1.7.6
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.