public void InitializePlugin(PluginInfo Plugin)
        {
            if (Plugin == null)
            {
                return;
            }
            Console.WriteLine(string.Format(HES.Localization.Sentences["InitializingPlugin"], Plugin.Assembly.GetName().Name));
            bool PluginInitialized = false;

            if (Plugin.Directory == null)
            {
                Plugin.Directory = "";
            }

            try
            {
                Plugin.MainClass = (PluginBase)Activator.CreateInstance(Plugin.MainClassType);

                if (Plugin.MainClass != null)
                {
                    try
                    {
                        Plugin.MainClass.Init(Plugin.Directory);
                        PluginInitialized = true;
                    }
                    catch (MissingMethodException)
                    {
                        Console.WriteLine(string.Format(HES.Localization.Sentences["InitializationPlugin"], Plugin.Assembly.GetName().Name, Plugin.MainClassType.ToString()));
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(string.Format(HES.Localization.Sentences["FailedInitPlugin"], Plugin.Assembly.GetName().Name, ex.ToString()));
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(string.Format(HES.Localization.Sentences["FailedInitPlugin"], Plugin.Assembly.GetName().Name, ex.ToString()));
            }

            if (PluginInitialized && Plugin.MainClass.Enabled)
            {
                lock (_lockObj)
                {
                    //Commands
                    foreach (Type CommandType in Plugin.FoundCommands)
                    {
                        Command c = (Command)Activator.CreateInstance(CommandType, new object[] { ServerInstance.Instance.Server });
                        ServerInstance.Instance.CommandManager.AddCommand(c);
                    }
                    //Now Look for Events... IN THE PLUGIN TYPE!!!!!!!
                    //Actually Just register them
                    //Events
                    //Enable
                    //Enable Events
                    foreach (EventListener el in Plugin.FoundEvents)
                    {
                        ServerInstance.Instance.EventHelper.RegisterEvent(el);
                    }

                    //Plugin.FoundEvents.ForEach(x => ServerInstance.Instance.EventHelper.RegisterEvent(x));

                    m_loadedPlugins.Add(Plugin);
                }
            }
        }
        private PluginInfo ValidatePlugin(String library)
        {
            byte[]   bytes;
            Assembly libraryAssembly;

            try
            {
                Console.WriteLine("Loading Plugin Located at " + library);
                bytes           = File.ReadAllBytes(library);
                libraryAssembly = Assembly.Load(bytes);
                //Bug Guid is Glitched Right Now
                //Guid guid = new Guid(((GuidAttribute)libraryAssembly.GetCustomAttributes(typeof(GuidAttribute), true)[0]).Value);

                bool       plug   = true;
                PluginInfo plugin = new PluginInfo();
                //Plugin.Guid = guid;
                plugin.Assembly = libraryAssembly;

                Command[] CommandList;

                Type[] PluginTypes = libraryAssembly.GetExportedTypes();

                foreach (Type PluginType in PluginTypes)
                {
                    if (PluginType.BaseType == typeof(Command))
                    {
                        plugin.FoundCommands.Add(PluginType);
                        //Permissions In Command
                        //Load Permissions
                        foreach (Attribute attribute in PluginType.GetCustomAttributes(true))
                        {
                            if (attribute is PermissionAttribute)
                            {
                                PermissionAttribute pa = attribute as PermissionAttribute;
                                //Add To plugin
                                //Onplayer Join Event Add Default Perms to player
                                ServerInstance.Instance.PermissionManager.AddPermissionAttribute(pa);
                            }
                        }
                        continue;
                    }
                    if (PluginType.GetInterface(typeof(IPlugin).FullName) != null && plug)
                    {
                        plugin.MainClassType = PluginType;
                        plug = false;
                        continue;
                    }
                }
                //B4 resturn Check for Events here
                //Now Look for Events... IN THE PLUGIN TYPE!!!!!!!
                //Events
                if (!plug)
                {
                    //Loads Events
                    foreach (MethodInfo method in plugin.MainClassType.GetMethods())
                    {
                        Boolean isevent = false;
                        foreach (Attribute attribute in method.GetCustomAttributes(true))
                        {
                            if (attribute is HESEventAttribute)
                            {
                                HESEventAttribute hea = attribute as HESEventAttribute;

                                plugin = HandelEvent(method, plugin, hea.EventType);
                            }
                        }
                    }
                    //Load Permissions
                    foreach (Attribute attribute in plugin.GetType().GetCustomAttributes(true))
                    {
                        if (attribute is PermissionAttribute)
                        {
                            PermissionAttribute pa = attribute as PermissionAttribute;
                            //Add To plugin
                            //Onplayer Join Event Add Default Perms to player
                            ServerInstance.Instance.PermissionManager.AddPermissionAttribute(pa);
                        }
                    }
                }
                return(plugin);
            }
            catch (Exception ex)
            {
                Console.WriteLine("Failed to load assembly: " + library + " Error: " + ex.ToString());
            }
            return(null);
        }