joshuaprince / CoordinateOffset

⛏️ A Minecraft Spigot/Paper plugin that configurably obfuscates players' coordinates.
GNU Affero General Public License v3.0
18 stars 7 forks source link

"Unknown player for Offset lookup" errors when players disconnect abnormally #15

Closed joshuaprince closed 4 months ago

joshuaprince commented 4 months ago

Describe the bug Occasionally when players are disconnected, usually abnormally (time out, connection reset, etc.), errors are logged in the console.

Log errors

[00:00:00] [Netty Epoll Server IO #3/ERROR]: [CoordinateOffset] Failed to apply offset for outgoing packet ENTITY_VELOCITY to PLAYERNAME
Caused by java.util.NoSuchElementException: Unknown player for Offset lookup: PLAYERNAME
  CoordinateOffset-v4.0.1.jar//com.jtprince.coordinateoffset.PlayerOffsetsManager.getPerWorldCacheFor(PlayerOffsetsManager.java:79)
  CoordinateOffset-v4.0.1.jar//com.jtprince.coordinateoffset.PlayerOffsetsManager.getOffset(PlayerOffsetsManager.java:37)
  CoordinateOffset-v4.0.1.jar//com.jtprince.coordinateoffset.PacketOffsetAdapter$Listener.onPacketSend(PacketOffsetAdapter.java:72)
  CoordinateOffset-v4.0.1.jar//com.jtprince.lib.com.github.retrooper.packetevents.event.PacketSendEvent.call(PacketSendEvent.java:51)
 (+75 hidden frames)

Steps to reproduce Not sure how to reproduce this consistently yet.

Additional context These errors happen when the player has left the game from the perspective of the main server thread, but the player's connection has not been completely closed yet. The errors are harmless since the player is no longer in the game when they are printed.