Esempio n. 1
0
        public bool Setup()
        {
            //TODO: (in order)
            LoadEvents();
            Logger.Init();
            Logger.Log("Starting Server");
            SQLiteDB = new SQLiteDatabase();  //
            UpdateDB();
            //ItemDB = new ItemDB();
            LoadFiles();

            Properties.Load("properties/server.properties");
            Command.InitCore();
            BlockChange.InitAll();
            Physics.Handlers.InitAll();
            Plugin.Load();
            Command.SortCommands();

            //Get latest developerlist
            new Thread(new ThreadStart(UpdateDevs)).Start();

            //load groups
            consolePlayer = new ConsolePlayer(s);
            consolePlayer.SetUsername(ConsoleName);
            //Group.DefaultGroup = new DefaultGroup(); //debug
            Group.LoadGroups();

            BanList.AddRange(Properties.LoadList("properties/banned.txt"));
            if (usewhitelist)
            {
                WhiteList.AddRange(Properties.LoadList("properties/whitelist.txt"));
            }
            if (useviplist)
            {
                VIPList.AddRange(Properties.LoadList("properties/viplist.txt"));
            }

            loadLevels();
            loadCleanUp();

            try
            {
                IPEndPoint endpoint = new IPEndPoint(IPAddress.Any, port);
                listen = new Socket(endpoint.Address.AddressFamily, SocketType.Stream, ProtocolType.Tcp);
                listen.Bind(endpoint);
                listen.Listen(int.MaxValue);

                listen.BeginAccept(new AsyncCallback(Accept), null);

                return(true);
            }
            catch (SocketException e) { Logger.Log(e.Message + e.StackTrace); return(false); }
            catch (Exception e) { Logger.Log(e.Message + e.StackTrace); return(false); }
        }
Esempio n. 2
0
 private 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);
     Logger.LogFormat("Loaded plugin: {0} v{1}", plugin.name, plugin.version);
     Logger.Log(plugin.welcome);
 }
Esempio n. 3
0
 private 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);
     Logger.LogFormat("Loaded plugin: {0} v{1}", plugin.name, plugin.version);
     Logger.Log(plugin.welcome);
 }