Search in sources :

Example 1 with Enemies

use of mathax.client.systems.enemies.Enemies in project Client by MatHax.

the class Systems method init.

public static void init() {
    System<?> config = add(new Config());
    config.init();
    config.load();
    add(new Modules());
    add(new Commands());
    add(new Friends());
    add(new Enemies());
    add(new Macros());
    add(new Accounts());
    add(new Waypoints());
    add(new Profiles());
    add(new Proxies());
    add(new HUD());
    MatHax.EVENT_BUS.subscribe(Systems.class);
}
Also used : Waypoints(mathax.client.systems.waypoints.Waypoints) Enemies(mathax.client.systems.enemies.Enemies) Proxies(mathax.client.systems.proxies.Proxies) Config(mathax.client.systems.config.Config) Modules(mathax.client.systems.modules.Modules) Friends(mathax.client.systems.friends.Friends) HUD(mathax.client.systems.hud.HUD) Profiles(mathax.client.systems.profiles.Profiles) Commands(mathax.client.systems.commands.Commands) Macros(mathax.client.systems.macros.Macros) Accounts(mathax.client.systems.accounts.Accounts)

Example 2 with Enemies

use of mathax.client.systems.enemies.Enemies in project Client by MatHax.

the class EnemiesCommand method build.

@Override
public void build(LiteralArgumentBuilder<CommandSource> builder) {
    builder.then(literal("add").then(argument("enemy", EnemyArgumentType.enemy()).executes(context -> {
        Enemy enemy = EnemyArgumentType.getEnemy(context, "enemy");
        if (Enemies.get().add(enemy)) {
            if (enemy.name.equals(mc.getSession().getUsername()))
                return SINGLE_SUCCESS;
            if (Config.get().chatFeedback.get())
                info("Added (highlight)%s(default) to enemies.", enemy.name);
            if (Config.get().toastFeedback.get())
                mc.getToastManager().add(new ToastSystem(Items.REDSTONE_BLOCK, Enemies.get().color.getPacked(), "Enemies " + Formatting.GRAY + "[" + Formatting.WHITE + enemy.name + Formatting.GRAY + "]", null, Formatting.GRAY + "Added to enemies.", Config.get().toastDuration.get()));
        } else {
            if (enemy.name.equals(mc.getSession().getUsername()))
                return SINGLE_SUCCESS;
            if (Config.get().chatFeedback.get())
                error("(highlight)%s(default) is already your enemy.", enemy.name);
            if (Config.get().toastFeedback.get())
                mc.getToastManager().add(new ToastSystem(Items.REDSTONE_BLOCK, Enemies.get().color.getPacked(), "Enemies " + Formatting.GRAY + "[" + Formatting.WHITE + enemy.name + Formatting.GRAY + "]", null, Formatting.RED + "Already your enemy.", Config.get().toastDuration.get()));
        }
        return SINGLE_SUCCESS;
    })));
    builder.then(literal("remove").then(argument("enemy", EnemyArgumentType.enemy()).executes(context -> {
        Enemy enemy = EnemyArgumentType.getEnemy(context, "enemy");
        if (Enemies.get().remove(enemy)) {
            if (enemy.name.equals(mc.getSession().getUsername()))
                return SINGLE_SUCCESS;
            if (Config.get().chatFeedback.get())
                info("Removed (highlight)%s(default) from enemies.", enemy.name);
            if (Config.get().toastFeedback.get())
                mc.getToastManager().add(new ToastSystem(Items.REDSTONE_BLOCK, Enemies.get().color.getPacked(), "Enemies " + Formatting.GRAY + "[" + Formatting.WHITE + enemy.name + Formatting.GRAY + "]", null, Formatting.GRAY + "Removed from enemies.", Config.get().toastDuration.get()));
        } else {
            if (enemy.name.equals(mc.getSession().getUsername()))
                return SINGLE_SUCCESS;
            if (Config.get().chatFeedback.get())
                error("(highlight)%s(default) is not your enemy.", enemy.name);
            if (Config.get().toastFeedback.get())
                mc.getToastManager().add(new ToastSystem(Items.REDSTONE_BLOCK, Enemies.get().color.getPacked(), "Enemies " + Formatting.GRAY + "[" + Formatting.WHITE + enemy.name + Formatting.GRAY + "]", null, Formatting.RED + "Not your enemy.", Config.get().toastDuration.get()));
        }
        return SINGLE_SUCCESS;
    })));
    builder.then(literal("list").executes(context -> {
        info("--- Enemies ((highlight)%s(default)) ---", Enemies.get().count());
        Enemies.get().forEach(enemy -> info("(highlight)" + enemy.name));
        return SINGLE_SUCCESS;
    }));
}
Also used : Suggestions(com.mojang.brigadier.suggestion.Suggestions) CommandContext(com.mojang.brigadier.context.CommandContext) Collection(java.util.Collection) CompletableFuture(java.util.concurrent.CompletableFuture) Items(net.minecraft.item.Items) Enemies(mathax.client.systems.enemies.Enemies) ArgumentType(com.mojang.brigadier.arguments.ArgumentType) Collectors(java.util.stream.Collectors) LiteralArgumentBuilder(com.mojang.brigadier.builder.LiteralArgumentBuilder) Config(mathax.client.systems.config.Config) Enemy(mathax.client.systems.enemies.Enemy) CommandSource(net.minecraft.command.CommandSource) SINGLE_SUCCESS(com.mojang.brigadier.Command.SINGLE_SUCCESS) Formatting(net.minecraft.util.Formatting) List(java.util.List) CommandSource.suggestMatching(net.minecraft.command.CommandSource.suggestMatching) Command(mathax.client.systems.commands.Command) StringReader(com.mojang.brigadier.StringReader) ToastSystem(mathax.client.utils.render.ToastSystem) CommandSyntaxException(com.mojang.brigadier.exceptions.CommandSyntaxException) SuggestionsBuilder(com.mojang.brigadier.suggestion.SuggestionsBuilder) Enemy(mathax.client.systems.enemies.Enemy) ToastSystem(mathax.client.utils.render.ToastSystem)

Aggregations

Config (mathax.client.systems.config.Config)2 Enemies (mathax.client.systems.enemies.Enemies)2 SINGLE_SUCCESS (com.mojang.brigadier.Command.SINGLE_SUCCESS)1 StringReader (com.mojang.brigadier.StringReader)1 ArgumentType (com.mojang.brigadier.arguments.ArgumentType)1 LiteralArgumentBuilder (com.mojang.brigadier.builder.LiteralArgumentBuilder)1 CommandContext (com.mojang.brigadier.context.CommandContext)1 CommandSyntaxException (com.mojang.brigadier.exceptions.CommandSyntaxException)1 Suggestions (com.mojang.brigadier.suggestion.Suggestions)1 SuggestionsBuilder (com.mojang.brigadier.suggestion.SuggestionsBuilder)1 Collection (java.util.Collection)1 List (java.util.List)1 CompletableFuture (java.util.concurrent.CompletableFuture)1 Collectors (java.util.stream.Collectors)1 Accounts (mathax.client.systems.accounts.Accounts)1 Command (mathax.client.systems.commands.Command)1 Commands (mathax.client.systems.commands.Commands)1 Enemy (mathax.client.systems.enemies.Enemy)1 Friends (mathax.client.systems.friends.Friends)1 HUD (mathax.client.systems.hud.HUD)1