2021-04-06 14:47:32 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using Dalamud.Game.Command;
|
|
|
|
|
|
2021-04-06 14:57:15 +00:00
|
|
|
|
namespace BurntToast {
|
2021-04-06 14:47:32 +00:00
|
|
|
|
public class Commands : IDisposable {
|
|
|
|
|
private static readonly Dictionary<string, string> CommandList = new Dictionary<string, string>() {
|
|
|
|
|
["/burnttoast"] = "Opens the configuration for Burnt Toast",
|
|
|
|
|
["/bt"] = "Alias for /burnttoast",
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
private BurntToast Plugin { get; }
|
|
|
|
|
|
|
|
|
|
internal Commands(BurntToast plugin) {
|
|
|
|
|
this.Plugin = plugin;
|
|
|
|
|
|
2021-09-20 18:26:42 +00:00
|
|
|
|
foreach (var (name, desc) in CommandList) {
|
|
|
|
|
this.Plugin.CommandManager.AddHandler(name, new CommandInfo(this.OnCommand) {
|
|
|
|
|
HelpMessage = desc,
|
2021-04-06 14:47:32 +00:00
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void Dispose() {
|
|
|
|
|
foreach (var name in CommandList.Keys) {
|
2021-09-20 18:26:42 +00:00
|
|
|
|
this.Plugin.CommandManager.RemoveHandler(name);
|
2021-04-06 14:47:32 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void OnCommand(string command, string arguments) {
|
|
|
|
|
this.Plugin.Ui.ToggleConfig();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|