DP-VoidBox/VoidBox/Cmds/MainCmd.cs
2024-03-02 01:31:18 +01:00

50 lines
1.5 KiB
C#

using static FFXIVClientStructs.FFXIV.Client.UI.AddonRelicNoteBook;
using System.Collections;
using System.Globalization;
using System;
namespace VoidBox.Cmds;
public sealed class MainCmd : Cmd
{
public override string Name => "voidbox";
public override string HelpMessage => $"Open / adjust the VoidBox settings.\n" +
$"\tExamples:\n" +
$"\tTo open the settings:\n\t\t{FullName}\n" +
$"\tTo enable / disable it:\n\t\t{FullName} on\n\t\t{FullName} off\n\t\t{FullName} toggle\n";
public override void Run(string arguments)
{
if (string.IsNullOrEmpty(arguments))
{
Service.PluginUI.SettingsVisible = !Service.PluginUI.SettingsVisible;
return;
}
switch (arguments.ToLowerInvariant())
{
case "on":
Service.Config.IsEnabled = true;
Service.Config.Save();
Service.PrintChat("Enabled VoidBox.");
return;
case "off":
Service.Config.IsEnabled = false;
Service.Config.Save();
Service.PrintChat("Disabled VoidBox.");
return;
case "toggle":
Service.Config.IsEnabled = !Service.Config.IsEnabled;
Service.Config.Save();
Service.PrintChat($"{(Service.Config.IsEnabled ? "Enabled" : "Disabled")} VoidBox.");
return;
}
Service.PrintChat("Invalid parameters.");
}
}