package dev.crucifixbeta.mod.commands.impl;

import dev.crucifixbeta.CrucifixBeta;
import dev.crucifixbeta.mod.commands.Command;
import dev.crucifixbeta.mod.modules.impl.misc.FakePlayer;
import java.util.ArrayList;
import java.util.List;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;

@Environment(EnvType.CLIENT)
public class FakePlayerCommand extends Command {

   public FakePlayerCommand() {
      super("fakeplayer", "[record/play]");
   }

   @Override
   public void runCommand(String[] parameters) {
      if (parameters.length == 0) {
         FakePlayer.INSTANCE.toggle();
      } else {
         String var2 = parameters[0];
         boolean var3 = false;
         switch (var2) {
            case "record":
               FakePlayer.INSTANCE.record.setValue(!FakePlayer.INSTANCE.record.getValue());
               break;
            case "play":
               FakePlayer.INSTANCE.play.setValue(!FakePlayer.INSTANCE.play.getValue());
               break;
            default:
               this.sendUsage();
         }
      }
   }

   @Override
   public String[] getAutocorrect(int count, List<String> seperated) {
      if (count != 1) {
         return null;
      } else {
         String var3 = ((String)seperated.getLast()).toLowerCase();
         ArrayList<String> var4 = new ArrayList<>();

         for (String var7 : List.of("record", "play")) {
            if (var3.equalsIgnoreCase(CrucifixBeta.getPrefix() + "fakeplayer") || var7.toLowerCase().startsWith(var3)) {
               var4.add(var7);
            }
         }

         int var11 = var4.size();
         String[] var12 = new String[var11];
         int var8 = 0;

         for (String var10 : var4) {
            var12[var8++] = var10;
         }

         return var12;
      }
   }
}
