aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/cc/polyfrost/oneconfig/internal/command/OneConfigCommand.java
blob: 82d040ab6ecf9e6735fa440c84e3c84ae97cb6df (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package cc.polyfrost.oneconfig.internal.command;

import cc.polyfrost.oneconfig.gui.HudGui;
import cc.polyfrost.oneconfig.gui.OneConfigGui;
import cc.polyfrost.oneconfig.utils.gui.GuiUtils;
import cc.polyfrost.oneconfig.utils.InputUtils;
import cc.polyfrost.oneconfig.utils.commands.annotations.Command;
import cc.polyfrost.oneconfig.utils.commands.annotations.Main;
import cc.polyfrost.oneconfig.utils.commands.annotations.SubCommand;

/**
 * The main OneConfig command.
 */
@Command(value = "oneconfig", aliases = {"ocfg", "oneconfig"}, description = "Access the OneConfig GUI.")
public class OneConfigCommand {

    @Main
    private static void main() {
        GuiUtils.displayScreen(OneConfigGui.create());
    }

    @SubCommand(value = "hud", description = "Open the OneConfig HUD config.")
    private static class HUDSubCommand {
        @Main
        private static void main() {
            GuiUtils.displayScreen(new HudGui());
        }
    }

    @SubCommand(value = "destroy", description = "Destroy the cached OneConfig GUI.")
    private static class DestroySubCommand {
        @Main
        private static void main() {
            OneConfigGui.instanceToRestore = null;
            InputUtils.blockClicks(false);
        }
    }
}