public Package OnPlayerMove(McpeMovePlayer packet, Player player) { var userManager = Context.Server.UserManager; var user = userManager.FindByNameAsync(player.Username).Result; if (user != null) { if (!user.IsAuthenticated) { player.SetPosition(player.SpawnPosition); player.ClearPopups(); player.AddPopup(new Popup() { Message = $"{ChatColors.Green}Type your password to login!", Duration = 10, Priority = 1000 }); } } else { player.SetPosition(player.SpawnPosition); player.ClearPopups(); player.AddPopup(new Popup() { Message = $"{ChatColors.Green}Type /reg password to register!", Duration = 10, Priority = 1000 }); } return packet; }
public void Auth(Player player, string password) { if (!_registerlist.Contains(player.User)) { player.User.IsAuthenticated = player.User.PasswordHash == GetPasswordHash(password); player.ClearPopups(); player.AddPopup(new Popup() { Message = ChatColors.Green + "Добро пожаловать назад!.", Duration = 20 * 10, MessageType = MessageType.Popup }); } else { player.SendMessage(ChatColors.Red + "Вы не зарегистрированы!!"); } }