java.lang.NullPointerException: Cannot invoke
SufkopGamer opened this issue ยท 7 comments
This is my code:
private void registerPacketListeners() { ProtocolLibrary.getProtocolManager().addPacketListener((PacketListener)new ClientMoveHandler.PacketListening((Plugin)this)); ProtocolLibrary.getProtocolManager().addPacketListener((PacketListener)new ClientEntityUnmountListener((Plugin)this)); ProtocolLibrary.getProtocolManager().addPacketListener((PacketListener)new MountListener(this)); }
This is my error:
java.lang.NullPointerException: Cannot invoke "com.comphenix.protocol.ProtocolManager.addPacketListener(com.comphenix.protocol.events.PacketListener)" because the return value of "com.comphenix.protocol.ProtocolLibrary.getProtocolManager()" is null
Hi,
you're either not depending on ProtocolLib or you accidentally shaded ProtocolLib into your plugin.
Just make sure that (if you are using maven) the ProtocolLib dependency scope is provided
(if you are using gradle use compileOnly
over implementation
or api
)