コード例 #1
0
        public static void Organize()
        {
            List <PluginLoadEvent> temp  = new List <PluginLoadEvent>();
            List <PluginLoadEvent> temp2 = events;
            PluginLoadEvent        temp3 = null;
            int i  = 0;
            int ii = temp2.Count;

            while (i < ii)
            {
                foreach (PluginLoadEvent p in temp2)
                {
                    if (temp3 == null)
                    {
                        temp3 = p;
                    }
                    else if (temp3.priority < p.priority)
                    {
                        temp3 = p;
                    }
                }
                temp.Add(temp3);
                temp2.Remove(temp3);
                temp3 = null;
                i++;
            }
            events = temp;
        }
コード例 #2
0
 internal static void Load(Plugin plugin, bool startup)
 {
     if (plugin == null)
     {
         throw new ArgumentNullException();
     }
     if (plugin.ForgeCraft_Version > Server.version)
     {
         Logger.LogFormat("Plugin \"{0}\" isn't compatible with this version of ForgeCraft!", plugin.name);
         if (Server.unsafe_plugin)
         {
             Logger.Log("Will attempt to load anyways.");
         }
         else
         {
             return;
         }
     }
     Plugin.all.Add(plugin);
     plugin.Load(startup);
     PluginLoadEvent.Call(plugin);
     if (cancelload)
     {
         Unload(plugin, false);
         cancelload = false;
         return;
     }
     Logger.LogFormat("Loaded plugin: {0} v{1}", plugin.name, plugin.version);
     Logger.Log(plugin.welcome);
 }