Search in sources :

Example 1 with Setting

use of mathax.client.settings.Setting in project Client by MatHax.

the class ResetCommand method build.

@Override
public void build(LiteralArgumentBuilder<CommandSource> builder) {
    builder.then(literal("settings").then(argument("module", ModuleArgumentType.module()).executes(context -> {
        Module module = context.getArgument("module", Module.class);
        module.settings.forEach(group -> group.forEach(Setting::reset));
        module.info("Reset all settings.");
        return SINGLE_SUCCESS;
    })).then(literal("all").executes(context -> {
        Modules.get().getAll().forEach(module -> module.settings.forEach(group -> group.forEach(Setting::reset)));
        info("Reset all module settings.");
        return SINGLE_SUCCESS;
    }))).then(literal("gui").executes(context -> {
        GuiThemes.get().clearWindowConfigs();
        info("The Click GUI positioning has been reset.");
        return SINGLE_SUCCESS;
    }).then(literal("scale").executes(context -> {
        GuiThemes.get().resetScale();
        info("The GUI scale has been reset.");
        return SINGLE_SUCCESS;
    }))).then(literal("bind").then(argument("module", ModuleArgumentType.module()).executes(context -> {
        Module module = context.getArgument("module", Module.class);
        module.keybind.set(true, -1);
        module.info("Reset bind.");
        return SINGLE_SUCCESS;
    })).then(literal("all").executes(context -> {
        Modules.get().getAll().forEach(module -> module.keybind.set(true, -1));
        info("Reset all binds.");
        return SINGLE_SUCCESS;
    }))).then(literal("hud").executes(context -> {
        Systems.get(HUD.class).reset.run();
        ChatUtils.info("HUD", "Reset all elements.");
        return SINGLE_SUCCESS;
    }));
}
Also used : CommandSource(net.minecraft.command.CommandSource) SINGLE_SUCCESS(com.mojang.brigadier.Command.SINGLE_SUCCESS) Setting(mathax.client.settings.Setting) Systems(mathax.client.systems.Systems) GuiThemes(mathax.client.gui.GuiThemes) ChatUtils(mathax.client.utils.misc.ChatUtils) Modules(mathax.client.systems.modules.Modules) Command(mathax.client.systems.commands.Command) Module(mathax.client.systems.modules.Module) HUD(mathax.client.systems.hud.HUD) LiteralArgumentBuilder(com.mojang.brigadier.builder.LiteralArgumentBuilder) ModuleArgumentType(mathax.client.systems.commands.arguments.ModuleArgumentType) HUD(mathax.client.systems.hud.HUD) Module(mathax.client.systems.modules.Module)

Aggregations

SINGLE_SUCCESS (com.mojang.brigadier.Command.SINGLE_SUCCESS)1 LiteralArgumentBuilder (com.mojang.brigadier.builder.LiteralArgumentBuilder)1 GuiThemes (mathax.client.gui.GuiThemes)1 Setting (mathax.client.settings.Setting)1 Systems (mathax.client.systems.Systems)1 Command (mathax.client.systems.commands.Command)1 ModuleArgumentType (mathax.client.systems.commands.arguments.ModuleArgumentType)1 HUD (mathax.client.systems.hud.HUD)1 Module (mathax.client.systems.modules.Module)1 Modules (mathax.client.systems.modules.Modules)1 ChatUtils (mathax.client.utils.misc.ChatUtils)1 CommandSource (net.minecraft.command.CommandSource)1