コード例 #1
0
 public override void Initialize()
 {
     if (!Directory.Exists(EBDir))
     {
         Directory.CreateDirectory(EBDir);
     }
     if (Cfg.Load())
     {
         EBConfig.UseMysql      = bool.Parse(Cfg["usemysql"]);
         EBConfig.MysqlHost     = Cfg["mysqlhost"];
         EBConfig.MysqlLogin    = Cfg["mysqllogin"];
         EBConfig.MysqlPassword = Cfg["mysqlpassword"];
         EBConfig.MysqlDatabase = Cfg["mysqldatabase"];
         InitConfig             = true;
     }
     if (InitConfig)
     {
         EBData.InitXBansDB();
         EBCommands.Load();
         ServerApi.Hooks.NetGreetPlayer.Register(this, OnGreetPlayer);
         ServerApi.Hooks.ServerConnect.Register(this, OnConnect);
         ServerApi.Hooks.ServerJoin.Register(this, OnJoin);
         ServerApi.Hooks.ServerLeave.Register(this, OnLeave);
         ServerApi.Hooks.ServerChat.Register(this, OnChat);
     }
 }
コード例 #2
0
 public override void Initialize()
 {
     if (!Directory.Exists(EBDir))
     {
         Directory.CreateDirectory(EBDir);
     }
     if (Cfg.Load())
     {
         EBConfig.UseMysql      = bool.Parse(Cfg["usemysql"]);
         EBConfig.MysqlHost     = Cfg["mysqlhost"];
         EBConfig.MysqlLogin    = Cfg["mysqllogin"];
         EBConfig.MysqlPassword = Cfg["mysqlpassword"];
         EBConfig.MysqlDatabase = Cfg["mysqldatabase"];
         InitConfig             = true;
     }
     if (InitConfig)
     {
         EBData.InitXBansDB();
         EBCommands.Load();
         Hooks.NetHooks.GreetPlayer += OnGreetPlayer;
         Hooks.ServerHooks.Connect  += OnConnect;
         Hooks.ServerHooks.Join     += OnJoin;
         Hooks.ServerHooks.Leave    += OnLeave;
         Hooks.ServerHooks.Chat     += OnChat;
     }
 }