Exemplo n.º 1
0
        public override void Initialize()
        {
            _config   = UserSpecificFunctionsConfig.ReadOrCreate(ConfigPath);
            _database = new DatabaseManager();
            _database.Load();

            AccountHooks.AccountDelete   += OnAccountDelete;
            GeneralHooks.ReloadEvent     += OnReload;
            PlayerHooks.PlayerPermission += OnPlayerPermission;
            ServerApi.Hooks.ServerChat.Register(this, OnServerChat);
            ServerApi.Hooks.ServerLeave.Register(this, OnLeave);
            PlayerHooks.PlayerCommand += OnPlayerCommand;

            Commands.ChatCommands.Add(new Command("us.cmd", UsCommand, "us"));
            Commands.ChatCommands.Add(new Command("permission.cmd", PermissionCommand, "permission"));

            Action <Command> Add = c =>
            {
                Commands.ChatCommands.RemoveAll(c2 => c2.Names.Exists(s2 => c.Names.Contains(s2)));
                Commands.ChatCommands.Add(c);
            };

            Add(new Command(TShockAPI.Permissions.cantalkinthird, ThirdPerson, "me"));
            Add(new Command(TShockAPI.Permissions.whisper, Reply, "reply", "r"));
            Add(new Command(TShockAPI.Permissions.whisper, Whisper, "whisper", "w", "tell"));
        }
Exemplo n.º 2
0
        /// <summary>
        /// Initializes the plugin.
        /// </summary>
        public override void Initialize()
        {
            _config   = UserSpecificFunctionsConfig.ReadOrCreate(ConfigPath);
            _database = new DatabaseManager();
            _database.Load();

            AccountHooks.AccountDelete   += OnAccountDelete;
            GeneralHooks.ReloadEvent     += OnReload;
            PlayerHooks.PlayerPermission += OnPlayerPermission;
            ServerApi.Hooks.ServerChat.Register(this, OnServerChat);

            Commands.ChatCommands.Add(new Command(UsCommandHandler, "us"));
            Commands.ChatCommands.Add(new Command(UsPermissionCommandHandler, "permission"));
        }
 private void OnReload(ReloadEventArgs e)
 {
     _config = UserSpecificFunctionsConfig.ReadOrCreate(ConfigPath);
     _database.Load();
 }