ProtocolLib

3M Downloads

null in ProtocolLibray#getProtocolManager

deestt opened this issue ยท 4 comments

commented
  • This issue is not solved in a development build

Describe the bug
A clear and concise description of what the bug is.
I have null in ProtocolLibrary#getProtocolManager

To Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

20:10:34 ERROR]: null
org.bukkit.command.CommandException: Unhandled exception executing command 'clan' in plugin BoxPVPCore v1.0-SNAPSHOT
	at org.bukkit.command.PluginCommand.execute(PluginCommand.java:47) ~[paper-api-1.18.2-R0.1-SNAPSHOT.jar:?]
	at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:159) ~[paper-api-1.18.2-R0.1-SNAPSHOT.jar:?]
	at org.bukkit.craftbukkit.v1_18_R2.CraftServer.dispatchCommand(CraftServer.java:906) ~[paper-1.18.2.jar:git-Paper-387]
	at net.minecraft.server.network.ServerGamePacketListenerImpl.handleCommand(ServerGamePacketListenerImpl.java:2307) ~[?:?]
	at net.minecraft.server.network.ServerGamePacketListenerImpl.handleChat(ServerGamePacketListenerImpl.java:2118) ~[?:?]
	at net.minecraft.server.network.ServerGamePacketListenerImpl.handleChat(ServerGamePacketListenerImpl.java:2099) ~[?:?]
	at net.minecraft.network.protocol.game.ServerboundChatPacket.handle(ServerboundChatPacket.java:46) ~[?:?]
	at net.minecraft.network.protocol.game.ServerboundChatPacket.a(ServerboundChatPacket.java:6) ~[?:?]
	at net.minecraft.network.protocol.PacketUtils.lambda$ensureRunningOnSameThread$1(PacketUtils.java:51) ~[?:?]
	at net.minecraft.server.TickTask.run(TickTask.java:18) ~[paper-1.18.2.jar:git-Paper-387]
	at net.minecraft.util.thread.BlockableEventLoop.doRunTask(BlockableEventLoop.java:153) ~[?:?]
	at net.minecraft.util.thread.ReentrantBlockableEventLoop.doRunTask(ReentrantBlockableEventLoop.java:24) ~[?:?]
	at net.minecraft.server.MinecraftServer.doRunTask(MinecraftServer.java:1400) ~[paper-1.18.2.jar:git-Paper-387]
	at net.minecraft.server.MinecraftServer.d(MinecraftServer.java:188) ~[paper-1.18.2.jar:git-Paper-387]
	at net.minecraft.util.thread.BlockableEventLoop.pollTask(BlockableEventLoop.java:126) ~[?:?]
	at net.minecraft.server.MinecraftServer.pollTaskInternal(MinecraftServer.java:1377) ~[paper-1.18.2.jar:git-Paper-387]
	at net.minecraft.server.MinecraftServer.pollTask(MinecraftServer.java:1370) ~[paper-1.18.2.jar:git-Paper-387]
	at net.minecraft.util.thread.BlockableEventLoop.managedBlock(BlockableEventLoop.java:136) ~[?:?]
	at net.minecraft.server.MinecraftServer.waitUntilNextTick(MinecraftServer.java:1348) ~[paper-1.18.2.jar:git-Paper-387]
	at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1230) ~[paper-1.18.2.jar:git-Paper-387]
	at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:316) ~[paper-1.18.2.jar:git-Paper-387]
	at java.lang.Thread.run(Thread.java:833) ~[?:?]
Caused by: java.lang.NullPointerException: Cannot invoke "com.comphenix.protocol.ProtocolManager.createPacket(com.comphenix.protocol.PacketType)" because the return value of "pl.kyumc.boxpvpcore.BoxPVPCore.getProtocolManager()" is null
	at pl.kyumc.boxpvpcore.signgui.SignGUIAPI.open(SignGUIAPI.java:83) ~[boxpvpcore-1.0-SNAPSHOT-all.jar:?]
	at pl.kyumc.boxpvpcore.clan.commands.defaults.subCommands.CreateCommand.execute(CreateCommand.java:23) ~[boxpvpcore-1.0-SNAPSHOT-all.jar:?]
	at pl.kyumc.boxpvpcore.clan.commands.ClanCommandManager.onCommand(ClanCommandManager.java:46) ~[boxpvpcore-1.0-SNAPSHOT-all.jar:?]
	at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45) ~[paper-api-1.18.2-R0.1-SNAPSHOT.jar:?]
	... 21 more

Version Info
Provide your ProtocolLib install info with /protocol dump through pastebin.

ProtocolLib Dump
Timestamp: 08/27/22 20:12:16

ProtocolLib Version: ProtocolLib v5.0.0-SNAPSHOT-b598
Bukkit Version: 1.18.2-R0.1-SNAPSHOT
Server Version: git-Paper-387 (MC: 1.18.2)
Java Version: 17.0.4

ProtocolLib: com.comphenix.protocol.ProtocolLib@3a1f61f[
  statistics=com.comphenix.protocol.metrics.Statistics@38cfdbd
  packetTask=7
  tickCounter=7041
  configExpectedMod=1
  updater=com.comphenix.protocol.updater.SpigotUpdater@26f5d1cf
  redirectHandler=com.comphenix.protocol.ProtocolLib$2@219897d9
  commandProtocol=com.comphenix.protocol.CommandProtocol@2d859cfb
  commandPacket=com.comphenix.protocol.CommandPacket@4900fde3
  commandFilter=com.comphenix.protocol.CommandFilter@417326a5
  packetLogging=com.comphenix.protocol.PacketLogging@2430570d
  skipDisable=false
  isEnabled=true
  loader=org.bukkit.plugin.java.JavaPluginLoader@25d37534
  server=CraftServer{serverName=Paper,serverVersion=git-Paper-387,minecraftVersion=1.18.2}
  file=plugins/ProtocolLib (3).jar
  description=org.bukkit.plugin.PluginDescriptionFile@33ec3e4d
  dataFolder=plugins/ProtocolLib
  classLoader=PluginClassLoader{plugin=ProtocolLib v5.0.0-SNAPSHOT-b598, pluginEnabled=true, url=plugins/ProtocolLib (3).jar}
  naggable=true
  newConfig=YamlConfiguration[path='', root='YamlConfiguration']
  configFile=plugins/ProtocolLib/config.yml
  logger=com.destroystokyo.paper.utils.PaperPluginLogger@2b86325b
]
Manager: com.comphenix.protocol.injector.PacketFilterManager@53d02288[
  plugin=ProtocolLib v5.0.0-SNAPSHOT-b598
  server=CraftServer{serverName=Paper,serverVersion=git-Paper-387,minecraftVersion=1.18.2}
  reporter=com.comphenix.protocol.ProtocolLib$1@19c70e9
  minecraftVersion=(MC: 1.18.2)
  asyncFilterManager=com.comphenix.protocol.async.AsyncFilterManager@a74547
  pluginVerifier=com.comphenix.protocol.injector.PluginVerifier@1a29bbe2
  inboundListeners=com.comphenix.protocol.injector.SortedPacketListenerList@48bf0e4d
  outboundListeners=com.comphenix.protocol.injector.SortedPacketListenerList@2ac6348b
  registeredListeners=[]
  packetInjector=com.comphenix.protocol.injector.netty.manager.NetworkManagerPacketInjector@1071d1e9
  playerInjectionHandler=com.comphenix.protocol.injector.netty.manager.NetworkManagerPlayerInjector@47509eae
  networkManagerInjector=com.comphenix.protocol.injector.netty.manager.NetworkManagerInjector@77ad3d6f
  debug=false
  closed=false
  injected=true
]

No listeners

Additional context

commented

Seems like you're storing a reference to the protocol manager / accessing it before it was initialized.

commented

Seems like you're storing a reference to the protocol manager / accessing it before it was initialized.

Same to this issue, how do I fix it?

I tried to call ProtocolLibrary#getProtocolManager in onEnable method but it not works same as onLoad, so when should I access it?

I found that there's a property called boolean initialized in class ProtocolLibrary, but it's a private property so I can't access it.

commented

Seems like you're storing a reference to the protocol manager / accessing it before it was initialized.

Same to this issue, how do I fix it?

I tried to call ProtocolLibrary#getProtocolManager in onEnable method but it not works same as onLoad, so when should I access it?

I found that there's a property called boolean initialized in class ProtocolLibrary, but it's a private property so I can't access it.

I'd already add ProtocolLib as a depend in plugin.yml and maven. Besides, I add it as a plugin in server, and it not works too.

My plugin is OnWorldPost load, and I found that ProtocolLib is OnServerLoad plugin, so there's no way to prove ProtocolLib was not loaded after my plugin loading.

When I started server, I saw Enabling ProtocolLib and never an error occurred. But when my plugin loaded and tried to call ProtocolLibrary#getProtocolManager, it throwed NullPointerException.

commented
  • This issue is not solved in a development build

Describe the bug A clear and concise description of what the bug is. I have null in ProtocolLibrary#getProtocolManager

To Reproduce Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior A clear and concise description of what you expected to happen.

Screenshots If applicable, add screenshots to help explain your problem.

20:10:34 ERROR]: null
org.bukkit.command.CommandException: Unhandled exception executing command 'clan' in plugin BoxPVPCore v1.0-SNAPSHOT
	at org.bukkit.command.PluginCommand.execute(PluginCommand.java:47) ~[paper-api-1.18.2-R0.1-SNAPSHOT.jar:?]
	at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:159) ~[paper-api-1.18.2-R0.1-SNAPSHOT.jar:?]
	at org.bukkit.craftbukkit.v1_18_R2.CraftServer.dispatchCommand(CraftServer.java:906) ~[paper-1.18.2.jar:git-Paper-387]
	at net.minecraft.server.network.ServerGamePacketListenerImpl.handleCommand(ServerGamePacketListenerImpl.java:2307) ~[?:?]
	at net.minecraft.server.network.ServerGamePacketListenerImpl.handleChat(ServerGamePacketListenerImpl.java:2118) ~[?:?]
	at net.minecraft.server.network.ServerGamePacketListenerImpl.handleChat(ServerGamePacketListenerImpl.java:2099) ~[?:?]
	at net.minecraft.network.protocol.game.ServerboundChatPacket.handle(ServerboundChatPacket.java:46) ~[?:?]
	at net.minecraft.network.protocol.game.ServerboundChatPacket.a(ServerboundChatPacket.java:6) ~[?:?]
	at net.minecraft.network.protocol.PacketUtils.lambda$ensureRunningOnSameThread$1(PacketUtils.java:51) ~[?:?]
	at net.minecraft.server.TickTask.run(TickTask.java:18) ~[paper-1.18.2.jar:git-Paper-387]
	at net.minecraft.util.thread.BlockableEventLoop.doRunTask(BlockableEventLoop.java:153) ~[?:?]
	at net.minecraft.util.thread.ReentrantBlockableEventLoop.doRunTask(ReentrantBlockableEventLoop.java:24) ~[?:?]
	at net.minecraft.server.MinecraftServer.doRunTask(MinecraftServer.java:1400) ~[paper-1.18.2.jar:git-Paper-387]
	at net.minecraft.server.MinecraftServer.d(MinecraftServer.java:188) ~[paper-1.18.2.jar:git-Paper-387]
	at net.minecraft.util.thread.BlockableEventLoop.pollTask(BlockableEventLoop.java:126) ~[?:?]
	at net.minecraft.server.MinecraftServer.pollTaskInternal(MinecraftServer.java:1377) ~[paper-1.18.2.jar:git-Paper-387]
	at net.minecraft.server.MinecraftServer.pollTask(MinecraftServer.java:1370) ~[paper-1.18.2.jar:git-Paper-387]
	at net.minecraft.util.thread.BlockableEventLoop.managedBlock(BlockableEventLoop.java:136) ~[?:?]
	at net.minecraft.server.MinecraftServer.waitUntilNextTick(MinecraftServer.java:1348) ~[paper-1.18.2.jar:git-Paper-387]
	at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1230) ~[paper-1.18.2.jar:git-Paper-387]
	at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:316) ~[paper-1.18.2.jar:git-Paper-387]
	at java.lang.Thread.run(Thread.java:833) ~[?:?]
Caused by: java.lang.NullPointerException: Cannot invoke "com.comphenix.protocol.ProtocolManager.createPacket(com.comphenix.protocol.PacketType)" because the return value of "pl.kyumc.boxpvpcore.BoxPVPCore.getProtocolManager()" is null
	at pl.kyumc.boxpvpcore.signgui.SignGUIAPI.open(SignGUIAPI.java:83) ~[boxpvpcore-1.0-SNAPSHOT-all.jar:?]
	at pl.kyumc.boxpvpcore.clan.commands.defaults.subCommands.CreateCommand.execute(CreateCommand.java:23) ~[boxpvpcore-1.0-SNAPSHOT-all.jar:?]
	at pl.kyumc.boxpvpcore.clan.commands.ClanCommandManager.onCommand(ClanCommandManager.java:46) ~[boxpvpcore-1.0-SNAPSHOT-all.jar:?]
	at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45) ~[paper-api-1.18.2-R0.1-SNAPSHOT.jar:?]
	... 21 more

Version Info Provide your ProtocolLib install info with /protocol dump through pastebin.

ProtocolLib Dump
Timestamp: 08/27/22 20:12:16

ProtocolLib Version: ProtocolLib v5.0.0-SNAPSHOT-b598
Bukkit Version: 1.18.2-R0.1-SNAPSHOT
Server Version: git-Paper-387 (MC: 1.18.2)
Java Version: 17.0.4

ProtocolLib: com.comphenix.protocol.ProtocolLib@3a1f61f[
  statistics=com.comphenix.protocol.metrics.Statistics@38cfdbd
  packetTask=7
  tickCounter=7041
  configExpectedMod=1
  updater=com.comphenix.protocol.updater.SpigotUpdater@26f5d1cf
  redirectHandler=com.comphenix.protocol.ProtocolLib$2@219897d9
  commandProtocol=com.comphenix.protocol.CommandProtocol@2d859cfb
  commandPacket=com.comphenix.protocol.CommandPacket@4900fde3
  commandFilter=com.comphenix.protocol.CommandFilter@417326a5
  packetLogging=com.comphenix.protocol.PacketLogging@2430570d
  skipDisable=false
  isEnabled=true
  loader=org.bukkit.plugin.java.JavaPluginLoader@25d37534
  server=CraftServer{serverName=Paper,serverVersion=git-Paper-387,minecraftVersion=1.18.2}
  file=plugins/ProtocolLib (3).jar
  description=org.bukkit.plugin.PluginDescriptionFile@33ec3e4d
  dataFolder=plugins/ProtocolLib
  classLoader=PluginClassLoader{plugin=ProtocolLib v5.0.0-SNAPSHOT-b598, pluginEnabled=true, url=plugins/ProtocolLib (3).jar}
  naggable=true
  newConfig=YamlConfiguration[path='', root='YamlConfiguration']
  configFile=plugins/ProtocolLib/config.yml
  logger=com.destroystokyo.paper.utils.PaperPluginLogger@2b86325b
]
Manager: com.comphenix.protocol.injector.PacketFilterManager@53d02288[
  plugin=ProtocolLib v5.0.0-SNAPSHOT-b598
  server=CraftServer{serverName=Paper,serverVersion=git-Paper-387,minecraftVersion=1.18.2}
  reporter=com.comphenix.protocol.ProtocolLib$1@19c70e9
  minecraftVersion=(MC: 1.18.2)
  asyncFilterManager=com.comphenix.protocol.async.AsyncFilterManager@a74547
  pluginVerifier=com.comphenix.protocol.injector.PluginVerifier@1a29bbe2
  inboundListeners=com.comphenix.protocol.injector.SortedPacketListenerList@48bf0e4d
  outboundListeners=com.comphenix.protocol.injector.SortedPacketListenerList@2ac6348b
  registeredListeners=[]
  packetInjector=com.comphenix.protocol.injector.netty.manager.NetworkManagerPacketInjector@1071d1e9
  playerInjectionHandler=com.comphenix.protocol.injector.netty.manager.NetworkManagerPlayerInjector@47509eae
  networkManagerInjector=com.comphenix.protocol.injector.netty.manager.NetworkManagerInjector@77ad3d6f
  debug=false
  closed=false
  injected=true
]

No listeners

Additional context

having the same issue - did you solve it?