public static void onServerJoinHandler(Player JoinedPlayer) { if (ConfigAPI.loadProfile(JoinedPlayer)) { PlayerAPI.createPlayer(JoinedPlayer); ColourEngine.write("[Project Eco] ", ConsoleColor.Magenta, Console.BackgroundColor); ColourEngine.writeLine("Welcome " + JoinedPlayer.playerName + " to the server!", ConsoleColor.Red, Console.BackgroundColor); } else { ServerAPI.playerList.Add(JoinedPlayer); ColourEngine.write("[Project Eco] ", ConsoleColor.Magenta, Console.BackgroundColor); ColourEngine.writeLine(JoinedPlayer.playerName + " joined the server.", ConsoleColor.Yellow, Console.BackgroundColor); } }
public static void CommandHandler(bool Repeat) { if (Repeat) { Console.Write("> "); string Input = Console.ReadLine().ToLower(); if (Input.StartsWith("/")) { if (Input.Split(' ').Length >= 1) { string Command = Input.Split(' ')[0]; switch (Command) { case "/hello": Console.WriteLine("Hello World!"); CommandHandler(true); break; case "/exit": break; case "/bal": string[] CommandArgs = Input.Split(' '); if (CommandArgs.Length <= 1) { Console.WriteLine("Your balance is: $" + BalanceAPI.getBalance()); } CommandHandler(true); break; case "/help": command_Help(); CommandHandler(true); break; case "/list": if (Input.Split(' ').Length >= 2) { string SubCommand = Input.Split(' ')[1]; switch (SubCommand) { case "players": command_listPlayers(); CommandHandler(true); break; case "items": command_Items(); CommandHandler(true); break; default: ColourEngine.writeLine("Syntax: /list [players|items]", ConsoleColor.DarkGreen, Console.BackgroundColor); CommandHandler(true); break; } } else { ColourEngine.writeLine("Syntax: /list [players|items]", ConsoleColor.DarkGreen, Console.BackgroundColor); CommandHandler(true); break; } break; default: ColourEngine.writeLine("The command you entered, does not exist!", ConsoleColor.Red, Console.BackgroundColor); CommandHandler(true); break; } } } else { ColourEngine.write(SEMod.playerName + "> ", ConsoleColor.White, Console.BackgroundColor); ColourEngine.writeLine(Input, ConsoleColor.Green, Console.BackgroundColor); CommandHandler(true); } } }