public Server() { ServerHash = Hash.MD5(Guid.NewGuid().ToByteArray()); UseOfficalAuthentication = Settings.Default.UseOfficalAuthentication; Clients = new ConcurrentDictionary<int, Client>(); Rand = new Random(); Logger = new Logger(this, Settings.Default.LogFile); PluginManager = new PluginManager(this, Settings.Default.PluginFolder); Items = new ItemDb(Settings.Default.ItemsFile); Recipes = Recipe.FromFile(Settings.Default.RecipesFile); SmeltingRecipes = SmeltingRecipe.FromFile(Settings.Default.SmeltingRecipesFile); ClientCommandHandler = new ClientCommandHandler(); ServerCommandHandler = new ServerCommandHandler(); if (Settings.Default.IrcEnabled) InitializeIrc(); _AcceptEventArgs = new SocketAsyncEventArgs(); _AcceptEventArgs.Completed += Accept_Completion; _Listener = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); }
public Server() { ChraftConfig.Load(); BanSystem = new BanSystem(); BanSystem.LoadBansAndWhiteList(); ClientsConnectionSlots = 30; Packet.Role = StreamRole.Server; Rand = new Random(); UseOfficalAuthentication = ChraftConfig.UseOfficalAuthentication; ServerHash = GetRandomServerHash(); EncryptionEnabled = ChraftConfig.EncryptionEnabled; EnableUserSightRadius = ChraftConfig.EnableUserSightRadius; Clients = new ConcurrentDictionary<int, Client>(); AuthClients = new ConcurrentDictionary<int, Client>(); Logger = new Logger(this, ChraftConfig.LogFile); PluginLogger = new PluginLogger(Logger); PluginManager = new PluginManager(this, ChraftConfig.PluginFolder); Items = new ItemDb(ChraftConfig.ItemsFile); Recipes = Recipe.FromXmlFile(ChraftConfig.RecipesFile); SmeltingRecipes = SmeltingRecipe.FromFile(ChraftConfig.SmeltingRecipesFile); ClientCommandHandler = new ClientCommandHandler(); ServerCommandHandler = new ServerCommandHandler(); PacketMap.Initialize(); _AcceptEventArgs = new SocketAsyncEventArgs(); _AcceptEventArgs.Completed += Accept_Completion; _Listener = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); for(int i = 0; i < 10; ++i) { MapChunkPacket.DeflaterPool.Push(new Deflater(5)); } PlayersToSave = new ConcurrentQueue<Client>(); PlayersToSavePostponed = new ConcurrentQueue<Client>(); _generators = new Dictionary<string, IChunkGenerator>(); ServerKey = PacketCryptography.GenerateKeyPair(); }
public Server() { ChraftConfig.Load(); ClientsConnectionSlots = 30; Packet.Role = StreamRole.Server; Rand = new Random(); ServerHash = GetRandomServerHash(); UseOfficalAuthentication = ChraftConfig.UseOfficalAuthentication; Clients = new ConcurrentDictionary<int, Client>(); AuthClients = new ConcurrentDictionary<int, Client>(); Logger = new Logger(this, ChraftConfig.LogFile); PluginManager = new PluginManager(this, ChraftConfig.PluginFolder); Items = new ItemDb(ChraftConfig.ItemsFile); Recipes = Recipe.FromXmlFile(ChraftConfig.RecipesFile); SmeltingRecipes = SmeltingRecipe.FromFile(ChraftConfig.SmeltingRecipesFile); ClientCommandHandler = new ClientCommandHandler(); ServerCommandHandler = new ServerCommandHandler(); if (ChraftConfig.IrcEnabled) InitializeIrc(); PacketMap.Initialize(); _AcceptEventArgs = new SocketAsyncEventArgs(); _AcceptEventArgs.Completed += Accept_Completion; _Listener = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); for(int i = 0; i < 10; ++i) { MapChunkPacket.DeflaterPool.Push(new Deflater(5)); } PlayersToSave = new ConcurrentQueue<Client>(); PlayersToSavePostponed = new ConcurrentQueue<Client>(); }