public void PrivateWarnPlayer(UnturnedPlayer Player, PlayerWarning pData, string reason, bool reasonIncluded) { if (reasonIncluded) { SendMessage(Player, WarningsPlugin.Instance.Translate("warning_reason", reason)); } else { SendMessage(Player, WarningsPlugin.Instance.Translate("warning", pData.Warnings)); } }
public void PublicWarnPlayer(UnturnedPlayer Player, PlayerWarning pData, string reason, bool reasonIncluded) { if (reasonIncluded) { TellPlayerWarning(Player, WarningsPlugin.Instance.Translate("public_player_warned_reason", Player.DisplayName, reason)); } else { TellPlayerWarning(Player, WarningsPlugin.Instance.Translate("public_player_warned", Player.DisplayName, pData.Warnings)); } }
public void DecreasePlayerWarnings(UnturnedPlayer player, int amount) { PlayerWarning PlayerData = GetPlayerData(player); if (PlayerData.Warnings > 0) { PlayerData.Warnings -= amount; Save(); } if (GetPlayerWarnings(player) <= 0) { RemovePlayerData(PlayerData); } }
public void RemovePlayerData(PlayerWarning data) { WarningsPlugin.Instance.Configuration.Instance.PlayerWarnings.Remove(data); Save(); }
public void WarnPlayer(IRocketPlayer caller, UnturnedPlayer Player, string reason, bool reasonIncluded) { bool actionTaken = false; PlayerWarning pData = GetPlayerData(Player); pData.Warnings += 1; Save(); if (MatchesWarningPoint(pData.Warnings)) { WarningPoint point = GetWarningPoint(pData.Warnings); if (!string.IsNullOrEmpty(point.ConsoleCommand)) { string cmd = ConsoleCommandHelper.FormatConsoleCommandString(point.ConsoleCommand.ToLower(), Player); CommandWindow.input.onInputText(cmd); logger.Log(WarningsPlugin.Instance.Translate("console_command", cmd, Player.DisplayName, point.WarningsToTrigger)); } else if (point.KickPlayer) { if (reasonIncluded) { KickPlayer(Player, reason, pData.Warnings); LogWarning(WarningsPlugin.Instance.Translate("console_player_kicked_reason", GetPlayerName(caller), Player.DisplayName, reason)); } else { KickPlayer(Player, pData.Warnings); LogWarning(WarningsPlugin.Instance.Translate("console_player_kicked", GetPlayerName(caller), Player.DisplayName)); } actionTaken = true; if (GetConfigAnnouceMessageServerWide()) { UnturnedChat.Say(WarningsPlugin.Instance.Translate("public_player_kicked", Player.DisplayName, pData.Warnings), GetMessageColor()); } } else if (point.BanPlayer) { if (reasonIncluded) { BanPlayer(Player, reason, pData.Warnings, point.BanLengthSeconds, caller); LogWarning(WarningsPlugin.Instance.Translate("console_player_banned_reason", GetPlayerName(caller), Player.DisplayName, point.BanLengthSeconds, reason)); } else { BanPlayer(Player, pData.Warnings, point.BanLengthSeconds, caller); LogWarning(WarningsPlugin.Instance.Translate("console_player_banned", GetPlayerName(caller), Player.DisplayName, point.BanLengthSeconds)); } actionTaken = true; if (GetConfigAnnouceMessageServerWide()) { UnturnedChat.Say(WarningsPlugin.Instance.Translate("public_player_banned", Player.DisplayName, pData.Warnings, point.BanLengthSeconds), GetMessageColor()); } } } if (!actionTaken) { if (WarningsPlugin.Instance.Configuration.Instance.AnnouceWarningsServerWide) { PublicWarnPlayer(Player, pData, reason, reasonIncluded); } else { PrivateWarnPlayer(Player, pData, reason, reasonIncluded); } LogWarning(WarningsPlugin.Instance.Translate("console_player_warning", GetPlayerName(caller), Player.DisplayName, pData.Warnings)); } var allWarningPoints = GetAllWarningPoints(); if (pData.Warnings >= allWarningPoints[allWarningPoints.Count - 1].WarningsToTrigger) { RemovePlayerData(pData); Save(); } if (caller is ConsolePlayer) { WarningLogger.LogWarning(0.ToString(), "*Console*", Player, reason); } else { WarningLogger.LogWarning((UnturnedPlayer)caller, Player, reason); } }