Advertisement
Xyberviri

GatherManager.cs

Mar 29th, 2015
724
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 23.92 KB | None | 0 0
  1.  
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using UnityEngine;
  6.  
  7. namespace Oxide.Plugins
  8. {
  9.  
  10.     [Info("Gathering Manager", "Mughisi", 2.1, ResourceId = 675)]
  11.     class GatherManager : RustPlugin
  12.     {
  13.  
  14.         #region Configuration Data
  15.         // Do not modify these values because this will not change anything, the values listed below are only used to create
  16.         // the initial configuration file. If you wish changes to the configuration file you should edit 'GatherManager.json'
  17.         // which is located in your server's config folder: <drive>:\...\server\<your_server_identity>\oxide\config\
  18.  
  19.         private bool configChanged;
  20.  
  21.         // Plugin settings
  22.         private const string DefaultChatPrefix = "Gather Manager";
  23.         private const string DefaultChatPrefixColor = "#008000ff";
  24.  
  25.         public string ChatPrefix { get; private set; }
  26.         public string ChatPrefixColor { get; private set; }
  27.  
  28.         // Plugin options
  29.         private static readonly Dictionary<string, object> DefaultGatherResourceModifiers = new Dictionary<string, object>();
  30.         private static readonly Dictionary<string, object> DefaultGatherDispenserModifiers = new Dictionary<string, object>();
  31.         private static readonly Dictionary<string, object> DefaultQuarryResourceModifiers = new Dictionary<string, object>();
  32.         private static readonly Dictionary<string, object> DefaultPickupResourceModifiers = new Dictionary<string, object>();
  33.         private static readonly Dictionary<string, object> DefaultSurveyResourceModifiers = new Dictionary<string, object>();
  34.  
  35.         public Dictionary<string, float> GatherResourceModifiers { get; private set; }
  36.         public Dictionary<string, float> GatherDispenserModifiers { get; private set; }
  37.         public Dictionary<string, float> QuarryResourceModifiers { get; private set; }
  38.         public Dictionary<string, float> PickupResourceModifiers { get; private set; }
  39.         public Dictionary<string, float> SurveyResourceModifiers { get; private set; }
  40.  
  41.         // Plugin messages
  42.         private const string DefaultNotAllowed = "You don't have permission to use this command.";
  43.         private const string DefaultInvalidArgumentsGather =
  44.             "Invalid arguments supplied! Use gather.rate <type:dispenser|pickup|quarry|survey> <resource> <multiplier>";
  45.         private const string DefaultInvalidArgumentsDispenser =
  46.             "Invalid arguments supplied! Use dispenser.scale <dispenser:tree|ore|corpse> <multiplier>";
  47.         private const string DefaultInvalidModifier =
  48.             "Invalid modifier supplied! The new modifier always needs to be bigger than 0!";
  49.         private const string DefaultModifyResource = "You have set the gather rate for {0} to x{1} from {2}.";
  50.         private const string DefaultModifyResourceRemove = "You have reset the gather rate for {0} from {1}.";
  51.         private const string DefaultInvalidResource =
  52.             "{0} is not a valid resource. Check gather.resources for a list of available options.";
  53.         private const string DefaultModifyDispenser = "You have set the resource amount for {0} dispensers to x{1}";
  54.         private const string DefaultInvalidDispenser =
  55.             "{0} is not a valid dispenser. Check gather.dispensers for a list of available options.";
  56.         private const string DefaultHelpTextPlayer = "Resources gained from gathering have been scaled to the following:";
  57.         private const string DefaultHelpTextAdmin = "To change the resources gained by gathering use the command:\r\ngather.rate <type:dispenser|pickup|quarry|survey> <resource> <multiplier>\r\nTo change the amount of resources in a dispenser type use the command:\r\ndispenser.scale <dispenser:tree|ore|corpse> <multiplier>";
  58.         private const string DefaultHelpTextPlayerGains = "Resources gained from {0}:";
  59.         private const string DefaultHelpTextPlayerDefault = "Default values.";
  60.         private const string DefaultDispensers = "Resource Dispensers";
  61.         private const string DefaultCharges = "Survey Charges";
  62.         private const string DefaultQuarries = "Mining Quarries";
  63.         private const string DefaultPickups = "pickups";
  64.  
  65.         public string NotAllowed { get; private set; }
  66.         public string InvalidArgumentsGather { get; private set; }
  67.         public string InvalidArgumentsDispenser { get; private set; }
  68.         public string InvalidModifier { get; private set; }
  69.         public string ModifyResource { get; private set; }
  70.         public string ModifyResourceRemove { get; private set; }
  71.         public string InvalidResource { get; private set; }
  72.         public string ModifyDispenser { get; private set; }
  73.         public string InvalidDispenser { get; private set; }
  74.         public string HelpTextPlayer { get; private set; }
  75.         public string HelpTextAdmin { get; private set; }
  76.         public string HelpTextPlayerGains { get; private set; }
  77.         public string HelpTextPlayerDefault { get; private set; }
  78.         public string Dispensers { get; private set; }
  79.         public string Charges { get; private set; }
  80.         public string Quarries { get; private set; }
  81.         public string Pickups { get; private set; }
  82.  
  83.         #endregion
  84.  
  85.         private readonly List<string> subcommands = new List<string>() { "dispenser", "pickup", "quarry", "survey" };
  86.  
  87.         private readonly List<string> resources = new List<string>() { "Animal Fat", "Blood", "Cloth", "Metal Ore", "Sulfur Ore", "Stones", "Human Skull", "Wolf Skull", "Water", "Salt Water", "Wood", "Mushroom", "Raw Chicken Breast", "Raw Human Meat", "Raw Wolf Meat", "Bone Fragments", "Metal Fragments" };
  88.  
  89.         private readonly Hash<string, ItemDefinition> validResources = new Hash<string, ItemDefinition>();
  90.  
  91.         private readonly Hash<string, ResourceDispenser.GatherType> validDispensers = new Hash<string, ResourceDispenser.GatherType>();
  92.  
  93.         private void Init() => LoadConfigValues();
  94.  
  95.         private void Loaded()
  96.         {
  97.             var gameObjectArray = FileSystem.LoadAll<GameObject>("Assets/Items/");
  98.             var resourceDefinitions = gameObjectArray.Select(x => x.GetComponent<ItemDefinition>()).Where(x => x != null).ToList();
  99.             foreach (var def in resourceDefinitions.Where(def => resources.Contains(def.displayName.english)))
  100.                 validResources.Add(def.displayName.english.ToLower(), def);
  101.  
  102.             validDispensers.Add("tree", ResourceDispenser.GatherType.Tree);
  103.             validDispensers.Add("ore", ResourceDispenser.GatherType.Ore);
  104.             validDispensers.Add("corpse", ResourceDispenser.GatherType.Flesh);
  105.             validDispensers.Add("flesh", ResourceDispenser.GatherType.Flesh);
  106.         }
  107.  
  108.         protected override void LoadDefaultConfig() => PrintWarning("New configuration file created.");
  109.  
  110.         [ChatCommand("gather")]
  111.         private void Gather(BasePlayer player, string command, string[] args)
  112.         {
  113.             var help = HelpTextPlayer;
  114.             if (GatherResourceModifiers.Count == 0 && SurveyResourceModifiers.Count == 0 && PickupResourceModifiers.Count == 0 && QuarryResourceModifiers.Count == 0)
  115.                 help += HelpTextPlayerDefault;
  116.             else
  117.             {
  118.                 if (GatherResourceModifiers.Count > 0)
  119.                 {
  120.                     var dispensers = string.Format(HelpTextPlayerGains, Dispensers);
  121.                     dispensers = GatherResourceModifiers.Aggregate(dispensers, (current, entry) => current + ("\r\n    " + entry.Key + ": x" + entry.Value));
  122.                     help += "\r\n" + dispensers;
  123.                 }
  124.                 if (PickupResourceModifiers.Count > 0)
  125.                 {
  126.                     var pickups = string.Format(HelpTextPlayerGains, Pickups);
  127.                     pickups = PickupResourceModifiers.Aggregate(pickups, (current, entry) => current + ("\r\n    " + entry.Key + ": x" + entry.Value));
  128.                     help += "\r\n" + pickups;
  129.                 }
  130.                 if (QuarryResourceModifiers.Count > 0)
  131.                 {
  132.                     var quarries = string.Format(HelpTextPlayerGains, Quarries);
  133.                     quarries = QuarryResourceModifiers.Aggregate(quarries, (current, entry) => current + ("\r\n    " + entry.Key + ": x" + entry.Value));
  134.                     help += "\r\n" + quarries;
  135.                 }
  136.                 if (SurveyResourceModifiers.Count > 0)
  137.                 {
  138.                     var charges = string.Format(HelpTextPlayerGains, Charges);
  139.                     charges = SurveyResourceModifiers.Aggregate(charges, (current, entry) => current + ("\r\n    " + entry.Key + ": x" + entry.Value));
  140.                     help += "\r\n" + charges;
  141.                 }
  142.             }
  143.             SendMessage(player, help);
  144.             if (!player.IsAdmin()) return;
  145.             SendMessage(player, HelpTextAdmin);
  146.         }
  147.  
  148.         [ConsoleCommand("gather.rate")]
  149.         private void GatherRate(ConsoleSystem.Arg arg)
  150.         {
  151.             if (arg.Player() != null && !arg.Player().IsAdmin())
  152.             {
  153.                 arg.ReplyWith(NotAllowed);
  154.                 return;
  155.             }
  156.  
  157.             var subcommand = arg.GetString(0).ToLower();
  158.             if (!arg.HasArgs(3) || !subcommands.Contains(subcommand))
  159.             {
  160.                 arg.ReplyWith(InvalidArgumentsGather);
  161.                 return;
  162.             }
  163.  
  164.             if (!validResources[arg.GetString(1).ToLower()] && arg.GetString(1) != "*")
  165.             {
  166.                 arg.ReplyWith(string.Format(InvalidResource, arg.GetString(1)));
  167.                 return;
  168.             }
  169.  
  170.             var resource = validResources[arg.GetString(1).ToLower()]?.displayName.english ?? "*";
  171.             var modifier = arg.GetFloat(2, -1);
  172.             var remove = false;
  173.             if (modifier < 0)
  174.             {
  175.                 if (arg.GetString(2).ToLower() == "remove")
  176.                     remove = true;
  177.                 else
  178.                 {
  179.                     arg.ReplyWith(InvalidModifier);
  180.                     return;
  181.                 }
  182.             }
  183.  
  184.             switch (subcommand)
  185.             {
  186.                 case "dispenser":
  187.                     if (remove)
  188.                     {
  189.                         if (GatherResourceModifiers.ContainsKey(resource))
  190.                             GatherResourceModifiers.Remove(resource);
  191.                         arg.ReplyWith(string.Format(ModifyResourceRemove, resource, Dispensers));
  192.                     }
  193.                     else
  194.                     {
  195.                         if (GatherResourceModifiers.ContainsKey(resource))
  196.                             GatherResourceModifiers[resource] = modifier;
  197.                         else
  198.                             GatherResourceModifiers.Add(resource, modifier);
  199.                         arg.ReplyWith(string.Format(ModifyResource, resource, modifier, Dispensers));
  200.                     }
  201.                     SetConfigValue("Options", "GatherResourceModifiers", GatherResourceModifiers);
  202.                     break;
  203.                 case "pickup":
  204.                     if (remove)
  205.                     {
  206.                         if (PickupResourceModifiers.ContainsKey(resource))
  207.                             PickupResourceModifiers.Remove(resource);
  208.                         arg.ReplyWith(string.Format(ModifyResourceRemove, resource, Pickups));
  209.                     }
  210.                     else
  211.                     {
  212.                         if (PickupResourceModifiers.ContainsKey(resource))
  213.                             PickupResourceModifiers[resource] = modifier;
  214.                         else
  215.                             PickupResourceModifiers.Add(resource, modifier);
  216.                         arg.ReplyWith(string.Format(ModifyResource, resource, modifier, Pickups));
  217.                     }
  218.                     SetConfigValue("Options", "PickupResourceModifiers", PickupResourceModifiers);
  219.                     break;
  220.                 case "quarry":
  221.                     if (remove)
  222.                     {
  223.                         if (QuarryResourceModifiers.ContainsKey(resource))
  224.                             QuarryResourceModifiers.Remove(resource);
  225.                         arg.ReplyWith(string.Format(ModifyResourceRemove, resource, Quarries));
  226.                     }
  227.                     else
  228.                     {
  229.                         if (QuarryResourceModifiers.ContainsKey(resource))
  230.                             QuarryResourceModifiers[resource] = modifier;
  231.                         else
  232.                             QuarryResourceModifiers.Add(resource, modifier);
  233.                         arg.ReplyWith(string.Format(ModifyResource, resource, modifier, Quarries));
  234.                     }
  235.                     SetConfigValue("Options", "QuarryResourceModifiers", QuarryResourceModifiers);
  236.                     break;
  237.                 case "survey":
  238.                     if (remove)
  239.                     {
  240.                         if (SurveyResourceModifiers.ContainsKey(resource))
  241.                             SurveyResourceModifiers.Remove(resource);
  242.                         arg.ReplyWith(string.Format(ModifyResourceRemove, resource, Charges));
  243.                     }
  244.                     else
  245.                     {
  246.                         if (SurveyResourceModifiers.ContainsKey(resource))
  247.                             SurveyResourceModifiers[resource] = modifier;
  248.                         else
  249.                             SurveyResourceModifiers.Add(resource, modifier);
  250.                         arg.ReplyWith(string.Format(ModifyResource, resource, modifier, Charges));
  251.                     }
  252.                     SetConfigValue("Options", "SurveyResourceModifiers", SurveyResourceModifiers);
  253.                     break;
  254.             }
  255.         }
  256.  
  257.         [ConsoleCommand("gather.resources")]
  258.         private void GatherResources(ConsoleSystem.Arg arg)
  259.         {
  260.             if (arg.Player() != null && !arg.Player().IsAdmin())
  261.             {
  262.                 arg.ReplyWith(NotAllowed);
  263.                 return;
  264.             }
  265.  
  266.             arg.ReplyWith(validResources.Aggregate("Available resources:\r\n", (current, resource) => current + (resource.Value.displayName.english + "\r\n")) + "* (For all resources that are not setup separately)");
  267.         }
  268.  
  269.         [ConsoleCommand("gather.dispensers")]
  270.         private void GatherDispensers(ConsoleSystem.Arg arg)
  271.         {
  272.             if (arg.Player() != null && !arg.Player().IsAdmin())
  273.             {
  274.                 arg.ReplyWith(NotAllowed);
  275.                 return;
  276.             }
  277.  
  278.             arg.ReplyWith(validDispensers.Aggregate("Available dispensers:\r\n", (current, dispenser) => current + (dispenser.Value.ToString("G") + "\r\n")));
  279.         }
  280.  
  281.  
  282.         [ConsoleCommand("dispenser.scale")]
  283.         private void DispenserRate(ConsoleSystem.Arg arg)
  284.         {
  285.             if (arg.Player() != null && !arg.Player().IsAdmin())
  286.             {
  287.                 arg.ReplyWith(NotAllowed);
  288.                 return;
  289.             }
  290.  
  291.             if (!arg.HasArgs(2))
  292.             {
  293.                 arg.ReplyWith(InvalidArgumentsDispenser);
  294.                 return;
  295.             }
  296.  
  297.             if (!validDispensers.ContainsKey(arg.GetString(0).ToLower()))
  298.             {
  299.                 arg.ReplyWith(string.Format(InvalidDispenser, arg.GetString(0)));
  300.                 return;
  301.             }
  302.  
  303.             var dispenser = validDispensers[arg.GetString(0).ToLower()].ToString("G");
  304.             var modifier = arg.GetFloat(1, -1);
  305.             if (modifier < 0)
  306.             {
  307.                 arg.ReplyWith(InvalidModifier);
  308.                 return;
  309.             }
  310.  
  311.             if (GatherDispenserModifiers.ContainsKey(dispenser))
  312.                 GatherDispenserModifiers[dispenser] = modifier;
  313.             else
  314.                 GatherDispenserModifiers.Add(dispenser, modifier);
  315.             SetConfigValue("Options", "GatherDispenserModifiers", GatherDispenserModifiers);
  316.             arg.ReplyWith(string.Format(ModifyDispenser, dispenser, modifier));
  317.         }
  318.  
  319.         private void OnGather(ResourceDispenser dispenser, BaseEntity entity, Item item)
  320.         {
  321.             if (!entity.ToPlayer()) return;
  322.  
  323.             var gatherType = dispenser.gatherType.ToString("G");
  324.             var amount = item.amount;
  325.  
  326.             if (GatherResourceModifiers.ContainsKey(item.info.displayName.english))
  327.                 item.amount *= (int)GatherResourceModifiers[item.info.displayName.english];
  328.             else if (GatherResourceModifiers.ContainsKey("*"))
  329.                 item.amount *= (int)GatherResourceModifiers["*"];
  330.  
  331.             if (!GatherDispenserModifiers.ContainsKey(gatherType)) return;
  332.  
  333.             var dispenserModifier = GatherDispenserModifiers[gatherType];
  334.  
  335.             dispenser.containedItems.Single(x => x.itemid == item.info.itemid).amount += amount - item.amount / dispenserModifier;
  336.  
  337.             if (dispenser.containedItems.Single(x => x.itemid == item.info.itemid).amount < 0)
  338.                 item.amount += (int)dispenser.containedItems.Single(x => x.itemid == item.info.itemid).amount;
  339.         }
  340.  
  341.         private void OnQuarryGather(MiningQuarry quarry, Item item)
  342.         {
  343.             if (QuarryResourceModifiers.ContainsKey(item.info.displayName.english))
  344.                 item.amount *= (int)QuarryResourceModifiers[item.info.displayName.english];
  345.             else if (QuarryResourceModifiers.ContainsKey("*"))
  346.                 item.amount *= (int)QuarryResourceModifiers["*"];
  347.         }
  348.  
  349.         private void OnItemPickup(BasePlayer player, Item item)
  350.         {
  351.             if (PickupResourceModifiers.ContainsKey(item.info.displayName.english))
  352.                 item.amount *= (int)PickupResourceModifiers[item.info.displayName.english];
  353.             else if (PickupResourceModifiers.ContainsKey("*"))
  354.                 item.amount *= (int)PickupResourceModifiers["*"];
  355.         }
  356.  
  357.         private void OnSurveyGather(SurveyCharge surveyCharge, Item item)
  358.         {
  359.             if (SurveyResourceModifiers.ContainsKey(item.info.displayName.english))
  360.                 item.amount *= (int)SurveyResourceModifiers[item.info.displayName.english];
  361.             else if (SurveyResourceModifiers.ContainsKey("*"))
  362.                 item.amount *= (int)SurveyResourceModifiers["*"];
  363.         }
  364.  
  365.         private void LoadConfigValues()
  366.         {
  367.             // Plugin settings
  368.             ChatPrefix = GetConfigValue("Settings", "ChatPrefix", DefaultChatPrefix);
  369.             ChatPrefixColor = GetConfigValue("Settings", "ChatPrefixColor", DefaultChatPrefixColor);
  370.  
  371.             // Plugin options
  372.             var gatherResourceModifiers = GetConfigValue("Options", "GatherResourceModifiers", DefaultGatherResourceModifiers);
  373.             var gatherDispenserModifiers = GetConfigValue("Options", "GatherDispenserModifiers", DefaultGatherDispenserModifiers);
  374.             var quarryResourceModifiers = GetConfigValue("Options", "QuarryResourceModifiers", DefaultQuarryResourceModifiers);
  375.             var pickupResourceModifiers = GetConfigValue("Options", "PickupResourceModifiers", DefaultPickupResourceModifiers);
  376.             var surveyResourceModifiers = GetConfigValue("Options", "SurveyResourceModifiers", DefaultSurveyResourceModifiers);
  377.  
  378.             GatherResourceModifiers = new Dictionary<string, float>();
  379.             foreach (var entry in gatherResourceModifiers)
  380.             {
  381.                 float rate;
  382.                 if (!float.TryParse(entry.Value.ToString(), out rate)) continue;
  383.                 GatherResourceModifiers.Add(entry.Key, rate);
  384.             }
  385.  
  386.             GatherDispenserModifiers = new Dictionary<string, float>();
  387.             foreach (var entry in gatherDispenserModifiers)
  388.             {
  389.                 float rate;
  390.                 if (!float.TryParse(entry.Value.ToString(), out rate)) continue;
  391.                 GatherDispenserModifiers.Add(entry.Key, rate);
  392.             }
  393.  
  394.             QuarryResourceModifiers = new Dictionary<string, float>();
  395.             foreach (var entry in quarryResourceModifiers)
  396.             {
  397.                 float rate;
  398.                 if (!float.TryParse(entry.Value.ToString(), out rate)) continue;
  399.                 QuarryResourceModifiers.Add(entry.Key, rate);
  400.             }
  401.  
  402.             PickupResourceModifiers = new Dictionary<string, float>();
  403.             foreach (var entry in pickupResourceModifiers)
  404.             {
  405.                 float rate;
  406.                 if (!float.TryParse(entry.Value.ToString(), out rate)) continue;
  407.                 PickupResourceModifiers.Add(entry.Key, rate);
  408.             }
  409.  
  410.             SurveyResourceModifiers = new Dictionary<string, float>();
  411.             foreach (var entry in surveyResourceModifiers)
  412.             {
  413.                 float rate;
  414.                 if (!float.TryParse(entry.Value.ToString(), out rate)) continue;
  415.                 SurveyResourceModifiers.Add(entry.Key, rate);
  416.             }
  417.  
  418.             // Plugin messages
  419.             NotAllowed = GetConfigValue("Messages", "NotAllowed", DefaultNotAllowed);
  420.             InvalidArgumentsGather = GetConfigValue("Messages", "InvalidArgumentsGather", DefaultInvalidArgumentsGather);
  421.             InvalidArgumentsDispenser = GetConfigValue("Messages", "InvalidArgumentsDispenserType", DefaultInvalidArgumentsDispenser);
  422.             InvalidModifier = GetConfigValue("Messages", "InvalidModifier", DefaultInvalidModifier);
  423.             ModifyResource = GetConfigValue("Messages", "ModifyResource", DefaultModifyResource);
  424.             ModifyResourceRemove = GetConfigValue("Messages", "ModifyResourceRemove", DefaultModifyResourceRemove);
  425.             InvalidResource = GetConfigValue("Messages", "InvalidResource", DefaultInvalidResource);
  426.             ModifyDispenser = GetConfigValue("Messages", "ModifyDispenser", DefaultModifyDispenser);
  427.             InvalidDispenser = GetConfigValue("Messages", "InvalidDispenser", DefaultInvalidDispenser);
  428.             HelpTextAdmin = GetConfigValue("Messages", "HelpTextAdmin", DefaultHelpTextAdmin);
  429.             HelpTextPlayer = GetConfigValue("Messages", "HelpTextPlayer", DefaultHelpTextPlayer);
  430.             HelpTextPlayerGains = GetConfigValue("Messages", "HelpTextPlayerGains", DefaultHelpTextPlayerGains);
  431.             HelpTextPlayerDefault = GetConfigValue("Messages", "HelpTextPlayerDefault", DefaultHelpTextPlayerDefault);
  432.             Dispensers = GetConfigValue("Messages", "Dispensers", DefaultDispensers);
  433.             Quarries = GetConfigValue("Messages", "MiningQuarries", DefaultQuarries);
  434.             Charges = GetConfigValue("Messages", "SurveyCharges", DefaultCharges);
  435.             Pickups = GetConfigValue("Messages", "Pickups", DefaultPickups);
  436.  
  437.             if (!configChanged) return;
  438.             PrintWarning("Configuration file updated.");
  439.             SaveConfig();
  440.         }
  441.  
  442.         private T GetConfigValue<T>(string category, string setting, T defaultValue)
  443.         {
  444.             var data = Config[category] as Dictionary<string, object>;
  445.             object value;
  446.             if (data == null)
  447.             {
  448.                 data = new Dictionary<string, object>();
  449.                 Config[category] = data;
  450.                 configChanged = true;
  451.             }
  452.             if (data.TryGetValue(setting, out value)) return (T)Convert.ChangeType(value, typeof(T));
  453.             value = defaultValue;
  454.             data[setting] = value;
  455.             configChanged = true;
  456.             return (T)Convert.ChangeType(value, typeof(T));
  457.         }
  458.  
  459.         private void SetConfigValue<T>(string category, string setting, T newValue)
  460.         {
  461.             var data = Config[category] as Dictionary<string, object>;
  462.             object value;
  463.             if (data != null && data.TryGetValue(setting, out value))
  464.             {
  465.                 value = newValue;
  466.                 data[setting] = value;
  467.                 configChanged = true;
  468.             }
  469.             SaveConfig();
  470.         }
  471.  
  472.         private void SendMessage(BasePlayer player, string message, params object[] args) => player?.SendConsoleCommand("chat.add", -1, string.Format($"<color={ChatPrefixColor}>{ChatPrefix}</color>: {message}", args), 1.0);
  473.     }
  474. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement