Extend API so that player is not neededSuggestion

I've added 2 method overloads for the Zone Domes API to allow creating and deleting of zones without the need for a player object, The code i have used is below. Could you please add it or something of a similar nature to the plugin as i would rather not have to maintain a local copy of the plugin.

        [HookMethod("AddNewDome")]
        public bool AddNewDome(string ID)
        {
            var zoneid = VerifyZoneID(ID);
            if (zoneid is string && !string.IsNullOrEmpty((string)zoneid))
            {
                if (data.Zones.ContainsKey(ID))
                {
                    Puts(GetMsg("alreadyExists"));
                    return false;
                }
                var pos = GetZoneLocation(ID);
                if (pos != null && pos is Vector3)
                {
                    var radius = GetZoneRadius(ID);
                    if (radius != null && radius is float)
                    {
                        CreateSphere((Vector3)pos, (float)radius);
                        data.Zones.Add(ID, new ZoneEntry { Position = (Vector3)pos, Radius = (float)radius });
                        SaveData();
                        Puts(GetMsg("newSuccess"));
                        return true;
                    }
                    else
                    {
                        Puts(GetMsg("noRad"));
                        return false;
                    }
                }
                else
                {
                    Puts(GetMsg("noLoc"));
                    return false;
                }
            }
            else
            {
                Puts(GetMsg("noVerify"));
                return false;
            }
        }​
        [HookMethod("RemoveExistingDome")]
        public bool RemoveExistingDome(string ID)
        {
            if (data.Zones.ContainsKey(ID))
            {
                for (int i = 0; i < Spheres.Count; i++)
                {
                    if (Spheres[i] != null)
                    {
                        if (Spheres[i].transform.position == data.Zones[ID].Position)
                        {
                            DestroySphere(Spheres[i]);
                            data.Zones.Remove(ID);
                            SaveData();
                            Puts(GetMsg("remSuccess"));
                            return true;
                        }
                    }
                }
                Puts(GetMsg("noEntity"));
                Puts(GetMsg("remInvalid"));
                return false;
            }
            else
            {
                Puts(GetMsg("noInfo"));
                return false;
            }
        }

Actually a better option would be to swap the arguments around on the current api methods and make the player object optional.
then only sending the messages if the player object is provided. There would likly still need to be a method overload to ensure backwards compatability.

eg:

From: RemoveExistingDome(BasePlayer player, string ID) to RemoveExistingDome(string ID, BasePlayer player = null)



Merged post

Just updated my local copy of the plugin to to meet my second suggestion above. Code to be updated below:

        #region Zone Creation
        [HookMethod("AddNewDome")]
        public bool AddNewDome(BasePlayer player, string ID) => AddNewDome(ID, player);
        [HookMethod("AddNewDome")]
        public bool AddNewDome(string ID, BasePlayer player = null)
        {
            var zoneid = VerifyZoneID(ID);
            if (zoneid is string && !string.IsNullOrEmpty((string)zoneid))
            {
                if (data.Zones.ContainsKey(ID))
                {
                    if(player != null)
                        SendMsg(player, "", GetMsg("alreadyExists"));
                    else
                        Puts(GetMsg("alreadyExists"));
                    return false;
                }
                var pos = GetZoneLocation(ID);
                if (pos != null && pos is Vector3)
                {
                    var radius = GetZoneRadius(ID);
                    if (radius != null && radius is float)
                    {
                        CreateSphere((Vector3)pos, (float)radius);
                        data.Zones.Add(ID, new ZoneEntry { Position = (Vector3)pos, Radius = (float)radius });
                        SaveData();
                        if(player != null)
                            SendMsg(player, ID, GetMsg("newSuccess"));
                        return true;
                    }
                    else
                    {
                        if(player != null)
                            SendMsg(player, ID, GetMsg("noRad"));
                        else
                            Puts(GetMsg("noRad"));
                        return false;
                    }
                }
                else
                {
                    if(player != null)
                        SendMsg(player, ID, GetMsg("noLoc"));
                    else
                        Puts(GetMsg("noLoc"));
                    return false;
                }
            }
            else
            {
                if(player != null)
                    SendMsg(player, ID, GetMsg("noVerify"));
                else
                    Puts(GetMsg("noVerify"));
                return false;
            }
        }
        [HookMethod("RemoveExistingDome")]
        public bool RemoveExistingDome(BasePlayer player, string ID) => RemoveExistingDome(ID, player);
        [HookMethod("RemoveExistingDome")]
        public bool RemoveExistingDome(string ID, BasePlayer player = null)
        {
            if (data.Zones.ContainsKey(ID))
            {
                for (int i = 0; i < Spheres.Count; i++)
                {
                    if (Spheres[i] != null)
                    {
                        if (Spheres[i].transform.position == data.Zones[ID].Position)
                        {
                            DestroySphere(Spheres[i]);
                            data.Zones.Remove(ID);
                            SaveData();
                            if(player != null)
                                SendMsg(player, ID, GetMsg("remSuccess"));
                            return true;
                        }
                    }
                }
                if(player != null)
                {
                    SendMsg(player, ID, GetMsg("noEntity"));
                    SendMsg(player, ID, GetMsg("remInvalid"));
                }else{
                    Puts(GetMsg("noEntity"));
                    Puts(GetMsg("remInvalid"));
                }

                return false;
            }
            else
            {
                if(player != null)
                    SendMsg(player, ID, GetMsg("noInfo"));
                else
                    Puts(GetMsg("noInfo"));
                return false;
            }
        }

        #endregion
This would be nice.