Ejemplo n.º 1
0
        /// <summary>
        /// Credits a player if they successfully kill another player during the Capture The Flag game.
        ///
        /// NOTE: If the <see cref="MySqlDatabase"/> is not loaded then the kill is not accumulated to the attackers total kill count.
        /// </summary>
        /// <param name="ctfBot">The <see cref="CaptureTheFlagBot"/> instance.</param>
        /// <param name="eventArgs">The arguments for when the player (or players) was/were reset.</param>
        private void OnPlayerReset(CaptureTheFlagBot ctfBot, PlayerResetEventArgs eventArgs)
        {
            if (eventArgs.PlayersReset.Count == 1)
            {
                Player killedPlayer = eventArgs.PlayersReset[0];

                if (killedPlayer.LastAttacker != Player.None)
                {
                    ctfBot.SendPrivateMessage(killedPlayer, $"You were killed by player {killedPlayer.LastAttacker.Username}!");
                    ctfBot.SendPrivateMessage(killedPlayer.LastAttacker, $"You killed player {killedPlayer.Username}!");

                    if (MySqlDatabase.Loaded)
                    {
                        PlayerData playerData = MySqlDatabase.GetRow(killedPlayer.LastAttacker.Username);

                        if (playerData != null)
                        {
                            playerData.Statistics.TotalKills++;
                        }
                    }

                    ctfBot.CurrentGameRound.IncreaseGameFund(GameFundIncreaseReason.PlayerKilledEnemy);
                }

                killedPlayer.LastAttacker = Player.None;
            }
        }
        /// <summary>
        /// Notifies a player via a private message if they wear a special smiley.
        /// <param name="ctfBot">The <see cref="CaptureTheFlagBot"/> instance.</param>
        /// <param name="player">The player to be handled.</param>
        private void OnSmileyChanged(CaptureTheFlagBot ctfBot, Player player)
        {
            if (!player.IsPlayingGame)
            {
                return;
            }

            if (HealSystem.CanHealTeammates(player))
            {
                ctfBot.SendPrivateMessage(player, "You are now a healer for your team!");
            }
            else if (DigSystem.WearingDiggableSmiley(player))
            {
                ctfBot.SendPrivateMessage(player, "You can now dig dirt in the world!");
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Ends the Capture The Flag game by awarding the winning team with .
        /// </summary>
        /// <param name="ctfBot">The <see cref="CaptureTheFlagBot"/> instance.</param>
        /// <param name="winningTeam">The team what won the game.</param>
        public void End(CaptureTheFlagBot ctfBot, Team winningTeam)
        {
            ctfBot.SayChatMessage($"Game over! Team {winningTeam.GetStringName()} has won the game.");

            int coinsWon = GetGameFundShare(ctfBot.JoinedWorld.Players, winningTeam);

            foreach (Player player in ctfBot.JoinedWorld.Players.Values)
            {
                PlayerData playerData = MySqlDatabase.GetRow(player.Username);

                if (playerData != null && player.IsPlayingGame)
                {
                    if (player.Team == winningTeam)
                    {
                        playerData.Statistics.TotalWins++;
                        playerData.Statistics.Coins += coinsWon;

                        ctfBot.SendPrivateMessage(player, $"You received {coinsWon} coin{(coinsWon == 1 ? "" : "s")} for winning!");
                    }
                    else
                    {
                        playerData.Statistics.TotalLosses++;
                    }
                }
            }

            ResetRoundStatistics();
            MySqlDatabase.Save();

            ctfBot.ResetLevel();
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Handles a player trying to heal their teammate(s).
        /// </summary>
        /// <param name="ctfBot">The <see cref="CaptureTheFlagBot"/> instance.</param>
        /// <param name="player">The player to be handled.</param>
        private void OnPlayerMoved(CaptureTheFlagBot ctfBot, Player player)
        {
            if (!player.IsPlayingGame || player.IsInGodMode || !CanHealTeammates(player))
            {
                return;
            }

            foreach (Player allyPlayer in ctfBot.JoinedWorld.Players.Values)
            {
                if (player == allyPlayer)
                {
                    continue;
                }

                if (!player.IsEnemiesWith(allyPlayer) && player.IsNearPlayer(allyPlayer) && allyPlayer.Health < 100)
                {
                    if (allyPlayer.Heal())
                    {
                        ctfBot.SendPrivateMessage(allyPlayer, $"You were healed player {player.Username}");
                        ctfBot.SendPrivateMessage(player, $"You fully healed player {allyPlayer.Username}");
                    }
                }
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Handles the daily bonus system. If the player is eligible to receive a daily bonus, they are rewarded N coins defined in the <see cref="CoinsAwardAmount"/>
        /// variable.
        /// </summary>
        /// <param name="ctfBot">The <see cref="CaptureTheFlagBot"/> instance.</param>
        /// <param name="player">The player to be handled.</param>
        private void OnPlayerJoined(CaptureTheFlagBot ctfBot, Player player)
        {
            if (MySqlDatabase.Loaded && MySqlDatabase.PlayerExists(player.Username))
            {
                PlayerData playerData = MySqlDatabase.GetRow(player.Username);

                if (playerData != null && DateTime.Today > playerData.LastVisitDate)
                {
                    playerData.Statistics.Coins += CoinsAwardAmount;
                    playerData.LastVisitDate     = DateTime.Today;

                    Task.Run(async() =>
                    {
                        await Task.Delay(PrivateMessageDelayMs);

                        ctfBot.SendPrivateMessage(player, $"Daily bonus! You have been awarded {CoinsAwardAmount} coins for revisiting the world.");
                    });
                }
            }
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Handles the trap that is located in the lava lake. This trap can be activated by both the blue team and the red team, however, the player must be wearing the Fire Demon
        /// smiley.
        /// </summary>
        /// <param name="ctfBot">The <see cref="CaptureTheFlagBot"/> instance.</param>
        /// <param name="player">The player that is triggering the trap.</param>
        public override void Handle(CaptureTheFlagBot ctfBot, Player player)
        {
            if (!CanTriggerTrap(player))
            {
                return;
            }

            if (!TrapActivated)
            {
                Task.Run(async() =>
                {
                    ctfBot.SendPrivateMessage(player, "You triggered a secret trap!");

                    TrapActivated = true;

                    // Place wall
                    for (int y = 133; y >= 129; y--)
                    {
                        ctfBot.PlaceBlock(BlockLayer.Foreground, new Point(259, y), Blocks.Foreground.Caution);
                        ctfBot.PlaceBlock(BlockLayer.Foreground, new Point(306, y), Blocks.Foreground.Caution);

                        await Task.Delay(100);
                    }

                    await Task.Delay(TrapCooldownMs);

                    // Remove wall
                    for (int y = 129; y <= 133; y++)
                    {
                        ctfBot.PlaceBlock(BlockLayer.Foreground, new Point(259, y), Blocks.None);
                        ctfBot.PlaceBlock(BlockLayer.Foreground, new Point(306, y), Blocks.None);

                        await Task.Delay(100);
                    }

                    await Task.Delay(TrapCooldownMs);

                    TrapActivated = false;
                });
            }
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Handles team balance in the Capture The Flag game. If a player joins a team with more players than the other team, then they are transferred to the other team
        /// with less players.
        /// </summary>
        /// <param name="ctfBot">The <see cref="CaptureTheFlagBot"/> instance.</param>
        /// <param name="player">The player to be handled.</param>
        private void OnTeamChanged(CaptureTheFlagBot ctfBot, Player player)
        {
            if (!player.IsPlayingGame)
            {
                return;
            }

            string resultMsg = $"You joined the {player.Team.GetStringName()} team!";
            int    joinedTeamTotalPlayers   = GetTeamPlayersCount(ctfBot.JoinedWorld.Players, player.Team) - 1;
            int    oppositeTeamTotalPlayers = GetTeamPlayersCount(ctfBot.JoinedWorld.Players, player.Team.GetOppositeTeam());

            if (joinedTeamTotalPlayers > oppositeTeamTotalPlayers)
            {
                resultMsg = "Unbalanced teams! You have been transferred to the other team!";

                Point teleLocation = player.Team == Team.Blue ? RespawnSystem.RedCheckpointLocation : RespawnSystem.BlueCheckpointLocation;
                ctfBot.TeleportPlayer(player, teleLocation.X, teleLocation.Y);
            }

            ctfBot.SendPrivateMessage(player, resultMsg);
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Sends a player a private message if their health is at a certain level. The private message is to warn them that they are close to being killed by an enemy player.
        /// </summary>
        /// <param name="ctfBot">The Capture The Flag bot instance.</param>
        /// <param name="player">The player to warn about their health.</param>
        private void HandleHealthStatusWarning(CaptureTheFlagBot ctfBot, Player player)
        {
            string healthDescription = string.Empty;

            switch (player.Health)
            {
            case 35:
                healthDescription = "low";
                break;

            case 10:
                healthDescription = "critically low";
                break;
            }

            if (healthDescription != string.Empty)
            {
                string msg = $"Warning! Your health is {healthDescription} ({player.Health} HP).";

                ctfBot.SendPrivateMessage(player, msg);
            }
        }
Ejemplo n.º 9
0
        /// <summary>
        /// Handles when a player wants to purchase an item at the shop in the Everybody Edits world. All shop items are defined in the <see cref="m_shopItems"/> array.
        /// </summary>
        /// <param name="ctfBot">The <see cref="CaptureTheFlagBot"/> instance.</param>
        /// <param name="player">The player to be handled.</param>
        private void OnPlayerMoved(CaptureTheFlagBot ctfBot, Player player)
        {
            if (!MySqlDatabase.Loaded || !player.IsPlayingGame || player.IsInGodMode || player.VerticalDirection != VerticalDirection.Down)
            {
                return;
            }

            PlayerData playerData = MySqlDatabase.GetRow(player.Username);

            if (playerData != null)
            {
                foreach (ShopItem shopItem in m_shopItems)
                {
                    if (player.Location == shopItem.PurchaseLocation) // Player wants to purchase an item
                    {
                        string msgResult = "You don't have enough coins to purchase this item.";

                        if (playerData.Statistics.Coins >= shopItem.Cost)
                        {
                            playerData.Statistics.Coins -= shopItem.Cost;
                            msgResult = $"You have successfully bought the {shopItem.Name} for {shopItem.Cost} coin{(playerData.Statistics.Coins == 1 ? "" : "s")}.";

                            // Set flag variable for the anti-cheat system
                            if (m_effectNameMap.ContainsValue(shopItem.Name))
                            {
                                player.PurchasedEffectFlag = m_effectNameMap.FirstOrDefault(x => x.Value == shopItem.Name).Key;
                            }

                            ctfBot.TeleportPlayer(player, shopItem.PurchaseTeleportLocation.X, shopItem.PurchaseTeleportLocation.Y);
                        }

                        ctfBot.SendPrivateMessage(player, msgResult);

                        break; // Player attempted to purchase the item, no need to check the other shop items
                    }
                }
            }
        }
Ejemplo n.º 10
0
        /// <summary>
        /// Handles a player executing a game command. A game command can only be executed by a player either on the blue team or red team.
        /// </summary>
        /// <param name="ctfBot">The <see cref="CaptureTheFlagBot"/> instance.</param>
        /// <param name="player">The player executing the command.</param>
        /// <param name="parsedCommand">The command being executed.</param>
        /// <returns>
        /// True if the command was successfully handled, if not, false. A successful handle is when the parsed command is not equal to null and also the ValidCommands string
        /// array contains the parsed command.
        /// </returns>
        public override bool Handle(CaptureTheFlagBot ctfBot, Player player, ParsedCommand parsedCommand)
        {
            bool canHandle = base.Handle(ctfBot, player, parsedCommand);

            if (canHandle)
            {
                if (player.IsPlayingGame)
                {
                    switch (parsedCommand.Command)
                    {
                    case "blueflag":
                    case "redflag":
                    {
                        Team   targetTeam         = parsedCommand.Command == "blueflag" ? Team.Blue : Team.Red;
                        string flagHolderUsername = ctfBot.FlagSystem.Flags[targetTeam].Holder?.Username ?? "";
                        string teamName           = targetTeam.GetStringName();
                        string msgToSend          = !string.IsNullOrEmpty(flagHolderUsername) ? $"Player {flagHolderUsername} has the {teamName} flag." : $"No one has {teamName} flag.";

                        ctfBot.SayChatMessage(msgToSend);
                    }
                    break;

                    case "dropflag":
                    {
                        Team enemyTeam     = player.Team.GetOppositeTeam();
                        Flag enemyTeamFlag = ctfBot.FlagSystem.Flags[enemyTeam];

                        if (enemyTeamFlag.Holder == player)
                        {
                            if (ctfBot.JoinedWorld.Blocks != null)
                            {
                                if (ctfBot.JoinedWorld.Blocks[(uint)BlockLayer.Foreground, player.Location.X, player.Location.Y].Id == 0)
                                {
                                    enemyTeamFlag.Drop(ctfBot);
                                }
                                else
                                {
                                    ctfBot.SendPrivateMessage(player, "You can't drop the flag here!");
                                }
                            }
                        }
                        else
                        {
                            ctfBot.SendPrivateMessage(player, "You are not holding the enemy flag.");
                        }
                    }
                    break;

                    case "gamefund":
                    {
                        ctfBot.SendPrivateMessage(player, $"The game fund is currently: {ctfBot.CurrentGameRound.GameFund} coins.");
                    }
                    break;

                    case "heal":
                    {
                        string resultMsg = "You cannot heal yourself because you are not inside your base!";         // Default message if the player is not inside their base

                        if ((player.Team == Team.Blue && player.IsInBlueBase) ||
                            (player.Team == Team.Red && player.IsInRedBase))
                        {
                            player.RestoreHealth();

                            resultMsg = "Success! Your health was restored fully.";
                        }

                        ctfBot.SendPrivateMessage(player, resultMsg);
                    }
                    break;

                    case "health":
                    case "hp":
                    {
                        ctfBot.SendPrivateMessage(player, $"Your current health is: {player.Health} HP.");
                    }
                    break;

                    case "lobby":
                    case "quit":
                    {
                        player.GoToLobby(ctfBot);
                    }
                    break;

                    case "maxflags":
                    {
                        ctfBot.SendPrivateMessage(player, $"The maximum number of flags to win is {FlagSystem.MaxScoreToWin} flag{(FlagSystem.MaxScoreToWin == 1 ? "" : "s")}.");
                    }
                    break;

                    case "scores":
                    {
                        ctfBot.SendPrivateMessage(player, ctfBot.CurrentGameRound.GetScoresString());
                    }
                    break;

                    case "suicide":
                    {
                        if (!player.IsRespawning)
                        {
                            player.Die(ctfBot);
                        }
                    }
                    break;
                    }
                }
                else
                {
                    ctfBot.SendPrivateMessage(player, "You must be on either team blue or team red to use this command.");
                }
            }

            return(canHandle);
        }
        /// <summary>
        /// Handles a player executing a regular command. A regular command can be executed by any player.
        /// </summary>
        /// <param name="ctfBot">The <see cref="CaptureTheFlagBot"/> instance.</param>
        /// <param name="player">The player executing the command.</param>
        /// <param name="parsedCommand">The command being executed.</param>
        /// <returns>
        /// True if the command was successfully handled, if not, false. A successful handle is when the parsed command is not equal to null and also the ValidCommands string
        /// array contains the parsed command.
        /// </returns>
        public override bool Handle(CaptureTheFlagBot ctfBot, Player player, ParsedCommand parsedCommand)
        {
            bool canHandle = base.Handle(ctfBot, player, parsedCommand);

            if (canHandle)
            {
                switch (parsedCommand.Command)
                {
                case "amiadmin":
                {
                    string result = MySqlDatabase.Loaded && MySqlDatabase.GetRow(player.Username).IsAdministrator ? "You are an administrator." : "You are not an administrator.";

                    ctfBot.SendPrivateMessage(player, result);
                }
                break;

                case "coins":
                {
                    if (MySqlDatabase.Loaded)
                    {
                        PlayerData row = MySqlDatabase.GetRow(player.Username);

                        ctfBot.SendPrivateMessage(player, $"You currently have {row.Statistics.Coins} coin{(row.Statistics.Coins == 1 ? "" : "s")}.");
                    }
                }
                break;

                case "donatecoins":
                {
                    if (MySqlDatabase.Loaded)
                    {
                        if (parsedCommand.Parameters.Length >= 2)
                        {
                            if (parsedCommand.Parameters[0] != player.Username)
                            {
                                PlayerData playerToDonateData = MySqlDatabase.GetRow(parsedCommand.Parameters[0]);

                                if (playerToDonateData != null)
                                {
                                    PlayerData donatorData = MySqlDatabase.GetRow(player.Username);

                                    if (int.TryParse(parsedCommand.Parameters[1], out int amount))
                                    {
                                        if (donatorData.Statistics.Coins >= amount)
                                        {
                                            playerToDonateData.Statistics.Coins += amount;
                                            donatorData.Statistics.Coins        -= amount;

                                            ctfBot.SendPrivateMessage(player, $"Success! You donated {amount} coin{(amount == 1 ? "" : "s")} to player {parsedCommand.Parameters[0].ToUpper()}.");
                                        }
                                        else
                                        {
                                            ctfBot.SendPrivateMessage(player, "You don't have enough coins to donate that amount!");
                                        }
                                    }
                                    else
                                    {
                                        ctfBot.SendPrivateMessage(player, "Third parameter of command is invalid! It must be a number.");
                                    }
                                }
                                else
                                {
                                    ctfBot.SendPrivateMessage(player, $"Player {parsedCommand.Parameters[0].ToUpper()} does not exist.");
                                }
                            }
                            else
                            {
                                ctfBot.SendPrivateMessage(player, "You can't donate coins to yourself!");
                            }
                        }
                        else
                        {
                            ctfBot.SendPrivateMessage(player, "Insufficient amount of parameters for command.");
                        }
                    }
                }
                break;

                case "help":
                {
                    ctfBot.SendPrivateMessage(player, "Command prefixes: . > ! #");

                    ctfBot.SendPrivateMessage(player, "Regular Commands:");
                    ctfBot.SendPrivateMessage(player, StringArrayToString(ctfBot.BotCommands[2].ValidCommands));

                    ctfBot.SendPrivateMessage(player, "Game Commands:");
                    ctfBot.SendPrivateMessage(player, StringArrayToString(ctfBot.BotCommands[1].ValidCommands));

                    ctfBot.SendPrivateMessage(player, "Administrator Commands:");
                    ctfBot.SendPrivateMessage(player, StringArrayToString(ctfBot.BotCommands[0].ValidCommands));

                    ctfBot.SendPrivateMessage(player, "Tips:");
                    ctfBot.SendPrivateMessage(player, "- Press arrow keys/WASD keys around an enemy player to attack them.");
                    ctfBot.SendPrivateMessage(player, "- Use hard hat/worker smiley to dig dirt.");
                    ctfBot.SendPrivateMessage(player, "- Use doctor/nurse smiley to heal your teammates.");
                    ctfBot.SendPrivateMessage(player, "- There is an item shop in the clouds.");
                    ctfBot.SendPrivateMessage(player, "- Watch out for traps around the map.");
                }
                break;

                case "spectate":
                {
                    if (!player.IsPlayingGame && !player.CanToggleGodMode)
                    {
                        ctfBot.SetForceFly(player, !player.IsInGodMode);

                        if (player.IsInGodMode)
                        {
                            player.GoToLobby(ctfBot);
                        }

                        ctfBot.SendPrivateMessage(player, player.IsInGodMode ? "You have left spectate mode." : $"You have entered spectate mode. Type {parsedCommand.Prefix}spectate again to exit out of spectate mode.");
                    }
                    else
                    {
                        string privateMessage = player.IsPlayingGame ? "This command is only available to players not playing!" : "You can toggle God mode! Use that instead.";

                        ctfBot.SendPrivateMessage(player, privateMessage);
                    }
                }
                break;

                case "totalwins":
                case "totallosses":
                case "losses":
                case "wins":
                {
                    if (MySqlDatabase.Loaded)
                    {
                        PlayerData row         = MySqlDatabase.GetRow(player.Username);
                        int        resultCount = parsedCommand.Command == "totalwins" || parsedCommand.Command == "wins" ? row.Statistics.TotalWins : row.Statistics.TotalLosses;
                        string     type        = parsedCommand.Command == "totalwins" || parsedCommand.Command == "wins" ? "won" : "lost";

                        ctfBot.SendPrivateMessage(player, $"You have {type} {resultCount} time{(row.Statistics.TotalWins == 1 ? "" : "s")}.");
                    }
                }
                break;

                case "totalkills":
                {
                    if (MySqlDatabase.Loaded)
                    {
                        PlayerData playerData = MySqlDatabase.GetRow(player.Username);

                        ctfBot.SendPrivateMessage(player, $"You have killed a total of {playerData.Statistics.TotalKills} player{(playerData.Statistics.TotalKills == 1 ? "" : "s")}.");
                    }
                }
                break;
                }
            }
            else
            {
                ctfBot.SendPrivateMessage(player, $"The command \"{parsedCommand.Command}\" is invalid!");
            }

            return(canHandle);
        }
        /// <summary>
        /// Handles a player executing an administrator command. Administrators are defined in the MySql database.
        /// </summary>
        /// <param name="ctfBot">The <see cref="CaptureTheFlagBot"/> instance.</param>
        /// <param name="player">The player executing the command.</param>
        /// <param name="parsedCommand">The command being executed.</param>
        /// <returns>
        /// True if the command was successfully handled, if not, false. A successful handle is when the parsed command is not equal to null and also the ValidCommands string
        /// array contains the parsed command.
        /// </returns>
        public override bool Handle(CaptureTheFlagBot ctfBot, Player player, ParsedCommand parsedCommand)
        {
            bool canHandle = base.Handle(ctfBot, player, parsedCommand);

            if (canHandle)
            {
                if (MySqlDatabase.Loaded)
                {
                    if (MySqlDatabase.GetRow(player.Username).IsAdministrator)
                    {
                        switch (parsedCommand.Command)
                        {
                        case "ban":
                        case "unban":
                        {
                            if (parsedCommand.Parameters.Length >= 1)
                            {
                                string     username   = parsedCommand.Parameters[0];
                                PlayerData playerData = MySqlDatabase.GetRow(username);

                                if (parsedCommand.Command.Equals("ban", System.StringComparison.OrdinalIgnoreCase))
                                {
                                    if (playerData != null)         // Player exists in the database
                                    {
                                        if (!playerData.IsBanned)
                                        {
                                            playerData.IsBanned = true;
                                            ctfBot?.KickPlayer(username, "You've been banned from this world.");
                                        }
                                        else
                                        {
                                            ctfBot?.SendPrivateMessage(player, $"Player {username.ToUpper()} is already banned!");
                                        }
                                    }
                                    else         // Player does not exist in the database
                                    {
                                        MySqlDatabase.AddNewPlayer(username, true);
                                    }

                                    ctfBot?.SendPrivateMessage(player, $"Player {username.ToUpper()} has been banned from the world.");
                                }
                                else         // The command is "unban"
                                {
                                    if (playerData != null)
                                    {
                                        if (playerData.IsBanned)
                                        {
                                            playerData.IsBanned = false;

                                            ctfBot?.ForgivePlayer(username);
                                            ctfBot?.SendPrivateMessage(player, $"Player {username.ToUpper()} has been unbanned.");
                                        }
                                        else
                                        {
                                            ctfBot?.SendPrivateMessage(player, $"Player {username.ToUpper()} is not banned!");
                                        }
                                    }
                                    else
                                    {
                                        ctfBot?.SendPrivateMessage(player, $"Cannot ban player {username.ToUpper()} because they don't exist.");
                                    }
                                }
                            }
                            else
                            {
                                ctfBot?.SendPrivateMessage(player, "Insufficient amount of parameters!");
                            }
                        }
                        break;

                        case "disconnect":
                        {
                            ctfBot.Disconnect();
                        }
                        break;

                        case "kick":
                        {
                            if (parsedCommand.Parameters.Length >= 1)
                            {
                                string playerToKick = parsedCommand.Parameters[0];
                                string reason       = "";

                                if (parsedCommand.Parameters.Length >= 2)
                                {
                                    for (int i = 2; i < parsedCommand.Parameters.Length; i++)
                                    {
                                        reason += parsedCommand.Parameters[i] + " ";
                                    }
                                }

                                ctfBot.KickPlayer(playerToKick, reason);
                            }
                            else
                            {
                                ctfBot.SendPrivateMessage(player, "Insufficient amount of parameters for command.");
                            }
                        }
                        break;

                        case "retf":     // Return flag
                        {
                            if (parsedCommand.Parameters.Length >= 1)
                            {
                                bool isValidParameter = string.Equals(parsedCommand.Parameters[0], "blue", StringComparison.OrdinalIgnoreCase) || string.Equals(parsedCommand.Parameters[0], "red", StringComparison.OrdinalIgnoreCase);

                                if (isValidParameter)
                                {
                                    if (string.Equals(parsedCommand.Parameters[0], "blue", StringComparison.OrdinalIgnoreCase) && ctfBot.FlagSystem.Flags[Team.Blue].IsTaken)
                                    {
                                        ctfBot?.FlagSystem.Flags[Team.Blue].Return(ctfBot, null, false);
                                    }
                                    else if (string.Equals(parsedCommand.Parameters[0], "red", StringComparison.OrdinalIgnoreCase) && ctfBot.FlagSystem.Flags[Team.Red].IsTaken)
                                    {
                                        ctfBot?.FlagSystem.Flags[Team.Red].Return(ctfBot, null, false);
                                    }
                                    else
                                    {
                                        ctfBot?.SendPrivateMessage(player, $"Cannot return the {parsedCommand.Parameters[0].ToLower()} flag as it is already at its base!");
                                    }
                                }
                                else         // Parameter is not "blue" or "red"
                                {
                                    ctfBot?.SendPrivateMessage(player, "Unknown flag type.");
                                }
                            }
                            else
                            {
                                ctfBot?.SendPrivateMessage(player, "Insufficient amount of parameters for command.");
                            }
                        }
                        break;
                        }
                    }
                    else // User is not an administrator
                    {
                        ctfBot?.SendPrivateMessage(player, "You don't have permission to execute this command.");
                    }
                }
                else
                {
                    ctfBot?.SendPrivateMessage(player, "Administrator commands are disabled due to the database not being loaded!");
                }
            }

            return(canHandle);
        }