コード例 #1
0
        /// <inheritdoc />
        public override void Initialize()
        {
            Directory.CreateDirectory("clans");
            if (File.Exists(ConfigPath))
            {
                _configuration = JsonConvert.DeserializeObject <ClansConfig>(File.ReadAllText(ConfigPath));
            }

            var databaseConnection =
                new SqliteConnection($"uri=file://{Path.Combine("clans", "database.sqlite")},Version=3");

            (_clanManager = new ClanManager(databaseConnection)).Load();
            (_memberManager = new MemberManager(databaseConnection, _clanManager)).Load();
            _commandRegistry.RegisterCommands();

            GeneralHooks.ReloadEvent     += OnReload;
            PlayerHooks.PlayerPermission += OnPlayerPermission;
            PlayerHooks.PlayerPostLogin  += OnPlayerPostLogin;
            ServerApi.Hooks.NetSendBytes.Register(this, OnNetSendBytes);
            ServerApi.Hooks.ServerChat.Register(this, OnServerChat);
        }
コード例 #2
0
 private void OnReload(ReloadEventArgs e)
 {
     _configuration = JsonConvert.DeserializeObject <ClansConfig>(File.ReadAllText(ConfigPath));
     e.Player.SendSuccessMessage("Clans configuration file reloaded!");
 }