/// <summary>
        /// Register the plugin with the server.
        /// TODO: If key is already registered, check if plugin reference is the same and reply if they aren't. (Resolve two plugins trying to use same name).
        /// </summary>
        /// <param name="plugin"></param>
        /// <param name="name"></param>
        public void RegisterPlugin(object plugin, string name)
        {
            Logger.Debug($"Registering plugin {name}");

            if (plugin == null)
            {
                Logger.Error("Plugin is null, unable to register");
                return;
            }
            ICommandPlugin plug = plugin as ICommandPlugin;

            if (plug != null)
            {
                try
                {
                    Plugins.AddSafe(plug.PluginName, plug);
                    plug.MessageReady += OnMessage;
                }
                catch (Exception ex)
                {
                    Logger.Exception("Error registering plugin", ex);
                }
            }
            else
            {
                Logger.Error("Tried to register null plugin");
            }
        }