ProtocolLib

3M Downloads

ProtocolManager#getProtocolVersion returns wrong number

molor opened this issue ยท 2 comments

commented

Describe the bug
Now it returns (probably) server port number instead of player protocol version.

To Reproduce

public DisconnectPacketHandler(TestPlugin thePlugin) {
	super(new AdapterParameteters().plugin(thePlugin).listenerPriority(ListenerPriority.MONITOR).types(PacketType.Login.Server.DISCONNECT).optionAsync());
}

@Override
public void onPacketSending(PacketEvent theEvent) {
	System.out.println("v: " + ProtocolLibrary.getProtocolManager().getProtocolVersion(theEvent.getPlayer()));
}

Expected behavior

v: 757

Version Info

ProtocolLib Dump
Timestamp: 12/27/21 21:25:54

ProtocolLib Version: ProtocolLib v4.8.0-SNAPSHOT-b539
Bukkit Version: 1.18.1-R0.1-SNAPSHOT
Server Version: git-Paper-101 (MC: 1.18.1)
Java Version: 17.0.1

ProtocolLib: com.comphenix.protocol.ProtocolLib@1d062eec[
  statistics=<null>
  backgroundCompiler=com.comphenix.protocol.reflect.compiler.BackgroundCompiler@97b57da
  packetTask=2
  tickCounter=56
  unhookTask=com.comphenix.protocol.injector.DelayedSingleTask@25a66957
  configExpectedMod=1
  updater=com.comphenix.protocol.updater.SpigotUpdater@676a98b0
  redirectHandler=com.comphenix.protocol.ProtocolLib$2@1d29200
  commandProtocol=com.comphenix.protocol.CommandProtocol@52c4c067
  commandPacket=com.comphenix.protocol.CommandPacket@44bef7b9
  commandFilter=com.comphenix.protocol.CommandFilter@77a25886
  packetLogging=com.comphenix.protocol.PacketLogging@62f586e0
  skipDisable=false
  isEnabled=true
  loader=org.bukkit.plugin.java.JavaPluginLoader@1646b521
  server=CraftServer{serverName=Paper,serverVersion=git-Paper-101,minecraftVersion=1.18.1}
  file=plugins\ProtocolLib.jar
  description=org.bukkit.plugin.PluginDescriptionFile@4075812f
  dataFolder=plugins\ProtocolLib
  classLoader=PluginClassLoader{plugin=ProtocolLib v4.8.0-SNAPSHOT-b539, pluginEnabled=true, url=plugins\ProtocolLib.jar}
  naggable=true
  newConfig=YamlConfiguration[path='', root='YamlConfiguration']
  configFile=plugins\ProtocolLib\config.yml
  logger=com.destroystokyo.paper.utils.PaperPluginLogger@2db58e14
]
Manager: com.comphenix.protocol.injector.PacketFilterManager@3c09453e[
  unhookTask=com.comphenix.protocol.injector.DelayedSingleTask@25a66957
  packetListeners=[PacketAdapter[plugin=Ping, sending=ListeningWhitelist[priority=LOW, packets=[SERVER_INFO[class=PacketStatusOutServerInfo, id=0], SET_PROTOCOL[class=PacketHandshakingInSetProtocol, id=0]], gamephase=PLAYING, options=[]], receiving=ListeningWhitelist[priority=LOW, packets=[SERVER_INFO[class=PacketStatusOutServerInfo, id=0], SET_PROTOCOL[class=PacketHandshakingInSetProtocol, id=0]], gamephase=PLAYING, options=[]]], PacketAdapter[plugin=Ping, sending=ListeningWhitelist[priority=HIGHEST, packets=[CUSTOM_PAYLOAD[class=PacketPlayOutCustomPayload, id=24]], gamephase=PLAYING, options=[]], receiving=EMPTY_WHITELIST], PacketAdapter[plugin=Ping, sending=ListeningWhitelist[priority=MONITOR, packets=[DISCONNECT[class=PacketLoginOutDisconnect, id=0]], gamephase=PLAYING, options=[ASYNC]], receiving=EMPTY_WHITELIST]]
  packetInjector=com.comphenix.protocol.injector.netty.ProtocolInjector$5@5099c769
  playerInjection=com.comphenix.protocol.injector.netty.ProtocolInjector$4@10ca3bc8
  inputBufferedPackets=[]
  recievedListeners=com.comphenix.protocol.injector.SortedPacketListenerList@110ec2eb
  sendingListeners=com.comphenix.protocol.injector.SortedPacketListenerList@67584541
  hasClosed=false
  classLoader=PluginClassLoader{plugin=ProtocolLib v4.8.0-SNAPSHOT-b539, pluginEnabled=true, url=plugins\ProtocolLib.jar}
  reporter=com.comphenix.protocol.ProtocolLib$1@383104c3
  server=CraftServer{serverName=Paper,serverVersion=git-Paper-101,minecraftVersion=1.18.1}
  library=ProtocolLib v4.8.0-SNAPSHOT-b539
  asyncFilterManager=com.comphenix.protocol.async.AsyncFilterManager@5fcf80b4
  knowsServerPackets=true
  knowsClientPackets=true
  phaseLoginCount=3
  phasePlayingCount=4
  packetCreation=false
  nettyInjector=com.comphenix.protocol.injector.netty.ProtocolInjector@33ca1e15
  pluginVerifier=com.comphenix.protocol.injector.PluginVerifier@c4f0e81
  hasRecycleDistance=true
  minecraftVersion=(MC: 1.18.1)
  debug=false
]

Listeners:
molor.plugin.ping.listeners.PingPacketHandler@3d642fb4[
  thePlugin=Ping v4.21
  theLogger=com.destroystokyo.paper.utils.PaperPluginLogger@b06f8fb
  theSettings=molor.plugin.ping.Settings@41e2040
  theMessenger=molor.plugin.ping.Messenger@6747bc60
  theAddresses=molor.plugin.ping.KnownAddresses@13089d0f
  theNames=molor.plugin.ping.KnownNames@2ff56eb5
  theMessages=molor.plugin.ping.Messages@5a9c472b
  lockerMap={}
  hostMap={}
  serverVersion=1.18.1
  addressPattern=((\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3}))(?::(\d{1,5}))?
  pingBackThreads=0
  plugin=Ping v4.21
  connectionSide=BOTH
  receivingWhitelist=ListeningWhitelist[priority=LOW, packets=[SERVER_INFO[class=PacketStatusOutServerInfo, id=0], SET_PROTOCOL[class=PacketHandshakingInSetProtocol, id=0]], gamephase=PLAYING, options=[]]
  sendingWhitelist=ListeningWhitelist[priority=LOW, packets=[SERVER_INFO[class=PacketStatusOutServerInfo, id=0], SET_PROTOCOL[class=PacketHandshakingInSetProtocol, id=0]], gamephase=PLAYING, options=[]]
]
molor.plugin.ping.listeners.PayloadPacketHandler@3569f2df[
  thePlugin=Ping v4.21
  theSettings=molor.plugin.ping.Settings@41e2040
  plugin=Ping v4.21
  connectionSide=SERVER_SIDE
  receivingWhitelist=EMPTY_WHITELIST
  sendingWhitelist=ListeningWhitelist[priority=HIGHEST, packets=[CUSTOM_PAYLOAD[class=PacketPlayOutCustomPayload, id=24]], gamephase=PLAYING, options=[]]
]
molor.plugin.ping.listeners.DisconnectPacketHandler@6efb10e4[
  theLogger=com.destroystokyo.paper.utils.PaperPluginLogger@b06f8fb
  theSettings=molor.plugin.ping.Settings@41e2040
  theNames=molor.plugin.ping.KnownNames@2ff56eb5
  versionManager=molor.plugin.ping.ServerVersion@5f5f7815
  packetManager=com.comphenix.protocol.injector.PacketFilterManager@3c09453e
  plugin=Ping v4.21
  connectionSide=SERVER_SIDE
  receivingWhitelist=EMPTY_WHITELIST
  sendingWhitelist=ListeningWhitelist[priority=MONITOR, packets=[DISCONNECT[class=PacketLoginOutDisconnect, id=0]], gamephase=PLAYING, options=[ASYNC]]
]

Plugins Using ProtocolLib:
Ping by [molor]
commented

Also it's still warns on startup about untested server version

commented

Thanks for the report! You're absolutely right - I will look into this!