Added async PreLoginEvent to change online mode per connection.
Removed unused import and made code nicer.