private static void StartInput() { while (true) { string input = Console.ReadLine(); if (input == null || (input = input.Trim()).Length == 0) { continue; } string[] inputParts = input.Split(); if (inputParts[0].StartsWith("/")) { string cmd = inputParts[0].Substring(1).ToLower(); switch (cmd) { case "stop": Logger.Log(LogLevel.Info, "Stopping Server..."); for (int i = Player.players.Count - 1; i >= 0; i--) { Player.players[i].Kick("Server Shutting Down!"); } Exit(); return; case "id": new Thread(new ThreadStart(InventoryDebug)).Start(); break; default: Command command = Command.all.Find(cmd); if (command == null) { Logger.Log(LogLevel.Info, "Unrecognized command: " + cmd); break; } if (command.ConsoleUseable) { string[] args = new string[inputParts.Length - 1]; Array.Copy(inputParts, 1, args, 0, inputParts.Length - 1); try { command.Use(Server.consolePlayer, args); } catch (Exception e) { Logger.LogError(e); } break; } else { Logger.Log(LogLevel.Info, cmd + " command not useable in the console."); break; } } } else if (inputParts[0].StartsWith("@")) { string name = inputParts[0].Substring(1); string message = ""; Player p = Player.FindPlayer(name); Logger.Log(name + " : "); if (p != null) { if (inputParts.Length <= 1) { Logger.Log(LogLevel.Warning, "Please enter a message to send"); } else if (input.Length > 1) { for (int i = 1; i < inputParts.Length; i++) { message += inputParts[i]; } p.SendMessage(Color.PrivateMsg + "[Server >> Me] " + Color.ServerDefaultColor + message); } } else { Logger.Log(LogLevel.Warning, "Please enter a valid username"); } } else { Player.GlobalMessage(Color.Announce + "[" + Server.consolePlayer.username + "]: " + Color.Blue + input); } } }