eorzea-votes/client/EorzeaVotes/Commands.cs

33 lines
784 B
C#

using Dalamud.Game.Command;
namespace EorzeaVotes;
internal class Commands : IDisposable {
private Plugin Plugin { get; }
private static readonly string[] CommandNames = {
"/eorzeavotes",
"/ev",
};
internal Commands(Plugin plugin) {
this.Plugin = plugin;
foreach (var name in CommandNames) {
this.Plugin.CommandManager.AddHandler(name, new CommandInfo(this.Handler) {
HelpMessage = "Toggle the main interface",
});
}
}
public void Dispose() {
foreach (var name in CommandNames) {
this.Plugin.CommandManager.RemoveHandler(name);
}
}
private void Handler(string command, string arguments) {
this.Plugin.Ui.Visible ^= true;
}
}