use of com.mojang.brigadier.Command.SINGLE_SUCCESS 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;
}));
}
use of com.mojang.brigadier.Command.SINGLE_SUCCESS in project Client by MatHax.
the class BindsCommand method build.
@Override
public void build(LiteralArgumentBuilder<CommandSource> builder) {
builder.executes(context -> {
// Modules
List<Module> modules = Modules.get().getAll().stream().filter(module -> module.keybind.isSet()).collect(Collectors.toList());
info("--- Bound Modules ((highlight)%d(default)) ---", modules.size());
for (Module module : modules) {
HoverEvent hoverEvent = new HoverEvent(HoverEvent.Action.SHOW_TEXT, getTooltip(module));
MutableText text = new LiteralText(module.title).formatted(Formatting.WHITE);
text.setStyle(text.getStyle().withHoverEvent(hoverEvent));
MutableText sep = new LiteralText(" - ");
sep.setStyle(sep.getStyle().withHoverEvent(hoverEvent));
text.append(sep.formatted(Formatting.GRAY));
MutableText key = new LiteralText(module.keybind.toString());
key.setStyle(key.getStyle().withHoverEvent(hoverEvent));
text.append(key.formatted(Formatting.GRAY));
ChatUtils.sendMsg(text);
}
return SINGLE_SUCCESS;
});
}
Aggregations