Пример #1
0
 public static bool OpenYS_Command_Administration_Password_Method(Client ThisClient, CommandReader Command)
 {
     Console.WriteLine("&c" + ThisClient.Username + " is trying to log in to the server as an administrator...");
     if (Settings.Administration.AdminPassword == "")
     {
         ThisClient.SendMessage("&cNo Admin Password is set for the server, cannot log you in!");
         return(false);
     }
     ThisClient.SendMessage("&9OpenYS Server Authentication System");
     ThisClient.SendMessage("&f===================================");
     ThisClient.SendMessage("");
     ThisClient.SendMessage("&9Ready to log you in to the server. All messages are now being securely caught, and will not be passed onto the server.");
     ThisClient.SendMessage("&9Please also note that you are deaf to all messages while you you are in this interface!");
     ThisClient.SendMessage("");
     ThisClient.SendMessage("Please enter the admin password.");
     Console.WriteLine("&e" + ThisClient.Username + " temporarily deafened as part of the authentication process...");
     ThisClient.IsDeaf = true;
     while (true)
     {
         Packets.GenericPacket InPacket = ThisClient.YSFClient.ReceivePacket();
         if (InPacket.Type == 32)
         {
             ThisClient.IsDeaf = false;
             Packets.Packet_32_ChatMessage ChatMessage = new Packets.Packet_32_ChatMessage(InPacket, ThisClient.Username);
             if (ChatMessage.Message == Settings.Administration.AdminPassword)
             {
                 Console.WriteLine("&a" + ThisClient.Username + " has successfully authenticated as a server administrator.");
                 ThisClient.SendMessage("&aSuccessfully logged in as an administrator... Returning you back to the server.");
                 Clients.YSFClients.Exclude(ThisClient).SendMessage("&a" + ThisClient.Username + " has successfully authenticated as a server administrator.");
                 ThisClient.OP();
                 break;
             }
             else
             {
                 Console.WriteLine("&c" + ThisClient.Username + " failed to authenticate as an administrator.");
                 ThisClient.SendMessage("&cAdmin Password Incorrect... Returning you back to the server.");
                 break;
             }
         }
         else
         {
             if (InPacket.Type == 08)
             {
                 ThisClient.IsDeaf = false;
                 ThisClient.SendMessage("&cJoin Requested Detected... Returning you back to the server.");
                 ThisClient.YSFClient.ProcessPacket(InPacket);
                 break;
             }
             ThisClient.YSFClient.ProcessPacket(InPacket);
         }
     }
     return(true);
 }
 private static bool YSFHandle_32_ChatMessage(Client ThisClient, Packets.GenericPacket InPacket)
 {
     Packets.Packet_32_ChatMessage ChatMessage = new Packets.Packet_32_ChatMessage(InPacket, ThisClient.Username);
     lock (ThisClient.MessagesTyped)
     {
         if ((ChatMessage.Message) == "/" & ThisClient.MessagesTyped.Count == 0)
         {
             ThisClient.SendMessage("No previously typed commands...");
             return(false);
         }
         if ((ChatMessage.Message) != "/")
         {
             ThisClient.MessagesTyped.Add(new Client.MessageTypedInfo(ChatMessage.Message));
         }
     }
     CommandManager.Process(ThisClient, ChatMessage.Message);
     return(true);
 }