/*
 * Decompiled with CFR 0.152.
 * 
 * Could not load the following classes:
 *  com.mojang.brigadier.Message
 *  com.mojang.brigadier.builder.LiteralArgumentBuilder
 *  com.mojang.brigadier.exceptions.SimpleCommandExceptionType
 *  net.minecraft.class_1657
 *  net.minecraft.class_2172
 *  net.minecraft.class_2561
 */
package meteordevelopment.meteorclient.commands.commands;

import com.mojang.brigadier.Message;
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
import com.mojang.brigadier.exceptions.SimpleCommandExceptionType;
import meteordevelopment.meteorclient.commands.Command;
import meteordevelopment.meteorclient.commands.arguments.PlayerArgumentType;
import meteordevelopment.meteorclient.systems.modules.Modules;
import meteordevelopment.meteorclient.systems.modules.movement.AutoWasp;
import net.minecraft.class_1657;
import net.minecraft.class_2172;
import net.minecraft.class_2561;

public class WaspCommand
extends Command {
    private static final SimpleCommandExceptionType CANT_WASP_SELF = new SimpleCommandExceptionType((Message)class_2561.method_43470((String)"You cannot target yourself!"));

    public WaspCommand() {
        super("wasp", "Sets the auto wasp target.", new String[0]);
    }

    @Override
    public void build(LiteralArgumentBuilder<class_2172> builder) {
        AutoWasp wasp = Modules.get().get(AutoWasp.class);
        builder.then(WaspCommand.literal("reset").executes(context -> {
            wasp.disable();
            return 1;
        }));
        builder.then(WaspCommand.argument("player", PlayerArgumentType.create()).executes(context -> {
            class_1657 player = PlayerArgumentType.get(context);
            if (player == WaspCommand.mc.field_1724) {
                throw CANT_WASP_SELF.create();
            }
            wasp.target = player;
            wasp.enable();
            this.info(player.method_5477().getString() + " set as target.", new Object[0]);
            return 1;
        }));
    }
}

