PlayerEvents.loggedIn(event => {
    const { player } = event;
    if (!player.persistentData.getBoolean('first_join_gamemode_fixed')) {
        player.gameMode = 'survival';
        player.persistentData.putBoolean('first_join_gamemode_fixed', true);
    }
});