Exemplo n.º 1
0
        public void Execute(IRocketPlayer caller, string[] command)
        {
            if (command.Length != 1 && command.Length != 2)
            {
                WarningUtilities.SendMessage(caller, WarningsPlugin.Instance.Translate("wrong_usage"));
                return;
            }

            UnturnedPlayer warnedPlayer = UnturnedPlayer.FromName(command[0]);

            if (warnedPlayer == null)
            {
                WarningUtilities.SendMessage(caller, WarningsPlugin.Instance.Translate("player_not_found", command[0]));
                return;
            }

            if (!WarningsPlugin.util.CheckIfHasData(warnedPlayer))
            {
                WarningsPlugin.util.AddPlayerData(warnedPlayer);
            }

            if (command.Length == 1)
            {
                WarningsPlugin.util.WarnPlayer(caller, warnedPlayer, "", false);
            }
            else if (command.Length == 2)
            {
                WarningsPlugin.util.WarnPlayer(caller, warnedPlayer, command[1], true);
            }

            WarningUtilities.SendMessage(caller, WarningsPlugin.Instance.Translate("warned_caller", warnedPlayer.DisplayName));
        }
Exemplo n.º 2
0
        public void Execute(IRocketPlayer caller, string[] command)
        {
            if (command.Length == 0)
            {
                if (caller is ConsolePlayer)
                {
                    WarningUtilities.SendMessage(caller, WarningsPlugin.Instance.Translate("console_warnings_noparameter"));
                    return;
                }
                else
                {
                    UnturnedPlayer uCaller = (UnturnedPlayer)caller;
                    checkForDataAndSendMessage(uCaller, caller, true);
                }
            }
            else if (command.Length == 1)
            {
                UnturnedPlayer uCaller = UnturnedPlayer.FromName(command[0]);
                if (uCaller == null)
                {
                    WarningUtilities.SendMessage(caller, WarningsPlugin.Instance.Translate("player_not_found", command[0]));
                    return;
                }

                checkForDataAndSendMessage(uCaller, caller, false);
            }
        }
Exemplo n.º 3
0
        protected override void Load()
        {
            WarningUtilities.Log("AdminWarnings has Loaded!");
            Instance = this;

            util.RemoveExpiredWarnings(1000);
            WarningLogger.Init();
        }
Exemplo n.º 4
0
        public void Execute(IRocketPlayer caller, string[] command)
        {
            if (command.Length != 1 && command.Length != 2)
            {
                WarningUtilities.SendMessage(caller, WarningsPlugin.Instance.Translate("wrong_usage_removewarn"));
                return;
            }

            UnturnedPlayer targetPlayer = UnturnedPlayer.FromName(command[0]);

            if (targetPlayer == null)
            {
                WarningUtilities.SendMessage(caller, WarningsPlugin.Instance.Translate("player_not_found", command[0]));
                return;
            }

            if (!WarningsPlugin.util.CheckIfHasData(targetPlayer))
            {
                WarningUtilities.SendMessage(caller, WarningsPlugin.Instance.Translate("no_data", targetPlayer.DisplayName));
                return;
            }

            if (command.Length == 1)
            {
                WarningsPlugin.util.DecreasePlayerWarnings(targetPlayer, 1);
                WarningUtilities.SendMessage(caller, WarningsPlugin.Instance.Translate("remove_warn", 1, targetPlayer.DisplayName));
            }
            else if (command.Length == 2)
            {
                int decreaseAmount = 0;
                if (!int.TryParse(command[1], out decreaseAmount))
                {
                    WarningUtilities.SendMessage(caller, WarningsPlugin.Instance.Translate("wrong_usage_removewarn"));
                    return;
                }

                WarningsPlugin.util.DecreasePlayerWarnings(targetPlayer, decreaseAmount);
                WarningUtilities.SendMessage(caller, WarningsPlugin.Instance.Translate("remove_warn", decreaseAmount, targetPlayer.DisplayName));
            }
        }
Exemplo n.º 5
0
        void checkForDataAndSendMessage(UnturnedPlayer player, IRocketPlayer caller, bool checkForCallersWarnings)
        {
            int warnings = 0;

            if (checkForCallersWarnings)
            {
                player = (UnturnedPlayer)caller;
            }

            if (WarningsPlugin.util.CheckIfHasData(player))
            {
                warnings = WarningsPlugin.util.GetPlayerWarnings(player);
            }

            if (checkForCallersWarnings)
            {
                WarningUtilities.SendMessage(caller, WarningsPlugin.Instance.Translate("warning_count_self", warnings));
            }
            else
            {
                WarningUtilities.SendMessage(caller, WarningsPlugin.Instance.Translate("warning_count_admin", player.DisplayName, warnings));
            }
        }
Exemplo n.º 6
0
 protected override void Unload()
 {
     WarningUtilities.Log("AdminWarnings has Unloaded!");
 }