aadnk / ProtocolLib

Provides read and write access to the Minecraft protocol with Bukkit.
GNU General Public License v2.0
287 stars 92 forks source link

java.nio.channels.ClosedChannelException #132

Closed molor closed 7 years ago

molor commented 7 years ago

Hello. Code below causes java.nio.channels.ClosedChannelException in the console if the player tries to connect to the server using the wrong version (e. g. server 1.11.2, client 1.12-pre6):

ProtocolLibrary.getProtocolManager().addPacketListener(new PacketAdapter(plugin, ListenerPriority.MONITOR, PacketType.Login.Server.DISCONNECT) {
    public void onPacketSending(PacketEvent packetEvent) {
        // ..
    }
});

Full error:

[2017-06-05 23:41:35 | Netty Server IO #1] An exceptionCaught() event was fired, and it reached at the tail of the pipeline. It usually means the last handler in the pipeline did not handle the exception.
java.nio.channels.ClosedChannelException: null
    at io.netty.channel.AbstractChannel$AbstractUnsafe.write(...)(Unknown Source) ~[server.jar:git-Spigot-ac83d69-fe3ca95]

Java 1.8 x64, Spigot 1.11.2 (also happens on 1.12-pre6), ProtocolLib v4.3.0-SNAPSHOT-b370