Skip to content

NPE in onPlayerJoin when no session is stored (3.5.5) #99

Closed

Description

@officialtaxz2

Hi, on 3.5.5 (Paper 26.3) every player's first join after a restart throws this:

Could not pass event PlayerJoinEvent to AFKPlus v3.5.5
java.lang.NullPointerException: Cannot invoke "net.lapismc.afkplus.playerdata.AFKSession.processReconnect(net.lapismc.afkplus.playerdata.AFKPlusPlayer)" because "session" is null
    at net.lapismc.afkplus.AFKPlusListeners.onPlayerJoin(AFKPlusListeners.java:74)

If there's no stored session and the player isn't AFK, it falls into the else branch and calls processReconnect on null. Came in with c22ca6e I think.

Something like this should do it:

if (session == null) {
    if (player.isAFK())
        player.forceStopAFK();
} else {
    session.processReconnect(player);
}

AFK detection itself still works fine, it's just the error in console. Thanks!

Activity

  1. added a commit that references this issue on Oct 18, 2026
  2. Dart2112 commented on Oct 18, 2026

    @Dart2112
    Member

    Thank you for the report, not sure how I didn't hit this in testing. I must have been restarting my test server between sessions. Update should be out everywhere.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions