PlayerEvents.loggedIn(event => {
    const { player, server } = event

    // Check if the player has already received the "Health Fix"
    if (!player.persistentData.healthFix_v1) {
        
        // Execute the attribute command to reset base health to 20
        server.runCommandSilent(`attribute ${player.username} minecraft:generic.max_health base set 20`)
        
        // Fully heal them so they don't have empty heart containers
        player.health = 20
        
        // Mark the player so this NEVER runs for them again
        player.persistentData.healthFix_v1 = true
        
        // Optional: Log it to the console so you can see it working
        console.log(`Applied one-time health fix to ${player.username}`)
    }
})