benbaptist/minecraft-wrapper — pull request #39 by melair (2014-11-02 20:59:02+00:00)
Title: Add pre login event to permit plugins to allow/deny logins.

This passes name, online/offline uuid and IP address to a plugin via the "player.preLogin" event. If the event returns True the user login proceeds, False it fails.

This isn't ideal as I'd like to pass back a message, but it'd require a larger rework of the event system then I feel capable of. Additionally I can't get the "Login denied." message to make it to the client, I think the Client side is already expecting encryption and the wrapper isn't quite in the state to send it. In lieu of a complete ban/whitelist system this allows plugins to handle it.

My use case of it is simply:
def onPlayerPreLogin(self, data):
return self.redis.sismember("knownUsers", data["online_uuid"]) == 1