public void Initialize(DalamudPluginInterface pluginInterface)
        {
            PluginInterface     = pluginInterface;
            PluginConfiguration = pluginInterface.GetPluginConfig() as VisibilityConfiguration ?? new VisibilityConfiguration();
            PluginConfiguration.Init(this, pluginInterface);

            PluginInterface.CommandManager.AddHandler(PluginCommandName, new CommandInfo(PluginCommand)
            {
                HelpMessage = $"Shows the config for the visibility plugin.\nAdditional help available via '{PluginCommandName} help'",
                ShowInHelp  = true
            });

            PluginInterface.CommandManager.AddHandler(VoidCommandName, new CommandInfo(VoidPlayer)
            {
                HelpMessage = $"Adds player to void list.\nUsage: {VoidCommandName} <charactername> <worldname> <reason>",
                ShowInHelp  = true
            });

            PluginInterface.CommandManager.AddHandler(VoidTargetCommandName, new CommandInfo(VoidTargetPlayer)
            {
                HelpMessage = $"Adds targeted player to void list.\nUsage: {VoidTargetCommandName} <reason>",
                ShowInHelp  = true
            });

            PluginInterface.CommandManager.AddHandler(WhitelistCommandName, new CommandInfo(WhitelistPlayer)
            {
                HelpMessage = $"Adds player to whitelist.\nUsage: {WhitelistCommandName} <charactername> <worldname>",
                ShowInHelp  = true
            });

            PluginInterface.CommandManager.AddHandler(WhitelistTargetCommandName, new CommandInfo(WhitelistTargetPlayer)
            {
                HelpMessage = $"Adds targeted player to whitelist.\nUsage: {WhitelistTargetCommandName}",
                ShowInHelp  = true
            });

            _characterDrawResolver = new CharacterDrawResolver();
            _characterDrawResolver.Init(pluginInterface, PluginConfiguration);

            Common            = new XivCommonBase(PluginInterface, Hooks.ContextMenu);
            PluginContextMenu = new ContextMenu(this);

            if (PluginConfiguration.EnableContextMenu)
            {
                PluginContextMenu.Toggle();
            }

            PluginInterface.Framework.OnUpdateEvent          += FrameworkOnOnUpdateEvent;
            PluginInterface.UiBuilder.OnBuildUi              += BuildUi;
            PluginInterface.UiBuilder.OnOpenConfigUi         += OpenConfigUi;
            PluginInterface.Framework.Gui.Chat.OnChatMessage += OnChatMessage;
        }
Exemple #2
0
        public VisibilityPlugin()
        {
            Instance           = this;
            this.Configuration = PluginInterface.GetPluginConfig() as VisibilityConfiguration ??
                                 new VisibilityConfiguration();
            this.Configuration.Init(ClientState.TerritoryType);
            this.PluginLocalization = new Localization(this.Configuration.Language);

            CommandManager.AddHandler(
                PluginCommandName,
                new CommandInfo(this.PluginCommand)
            {
                HelpMessage = this.PluginLocalization.PluginCommandHelpMessage,
                ShowInHelp  = true
            });

            CommandManager.AddHandler(
                VoidCommandName,
                new CommandInfo(this.VoidPlayer)
            {
                HelpMessage = this.PluginLocalization.VoidPlayerHelpMessage,
                ShowInHelp  = true
            });

            CommandManager.AddHandler(
                VoidTargetCommandName,
                new CommandInfo(this.VoidTargetPlayer)
            {
                HelpMessage = this.PluginLocalization.VoidTargetPlayerHelpMessage,
                ShowInHelp  = true
            });

            CommandManager.AddHandler(
                WhitelistCommandName,
                new CommandInfo(this.WhitelistPlayer)
            {
                HelpMessage = this.PluginLocalization.WhitelistPlayerHelpMessage,
                ShowInHelp  = true
            });

            CommandManager.AddHandler(
                WhitelistTargetCommandName,
                new CommandInfo(this.WhitelistTargetPlayer)
            {
                HelpMessage = this.PluginLocalization.WhitelistTargetPlayerHelpMessage,
                ShowInHelp  = true
            });

            this.characterDrawResolver = new CharacterDrawResolver();
            this.characterDrawResolver.Init();

            Framework.Update += this.FrameworkOnOnUpdateEvent;

            PluginInterface.UiBuilder.Draw         += this.BuildUi;
            PluginInterface.UiBuilder.OpenConfigUi += this.OpenConfigUi;
            ChatGui.ChatMessage          += this.OnChatMessage;
            ClientState.TerritoryChanged += this.ClientStateOnTerritoryChanged;

            this.Api         = new VisibilityApi();
            this.IpcProvider = new VisibilityProvider(this.Api);
        }