public bool Logout(ulong accid) { ClientAccount acc = accounts.Read(accid, DatabaseLocationType.MemoryOnly); if (acc == null) { return(false); } acc.OnLogout(); ServerPluginController.OnServerPluginEvent(ServerPluginEvent.AccountLogout, acc); return(accounts.StoreAndUnload(acc.id)); }
public bool CreateNewAccount(string email, string password) { ClientAccount newAccount = null; if (accounts.Exists(email, out newAccount)) { return(false); } newAccount = new ClientAccount(email, password); accounts.Store(newAccount, DatabaseLocationType.DiskOnly); ServerPluginController.OnServerPluginEvent(ServerPluginEvent.AccountCreated, newAccount); return(true); }
public ClientAccount Login(string userName, string password) { ClientAccount acc = null; if (!accounts.Exists(userName, out acc)) { return(null); } if (acc.password.CompareTo(password) != 0) { return(null); } acc.OnLogin(); ServerPluginController.OnServerPluginEvent(ServerPluginEvent.AccountLogin, acc); return(acc); }