import { world, system } from "@minecraft/server";
import {
  ActionFormData,
  ActionFormResponse,
  ModalFormData,
  MessageFormData,
} from "@minecraft/server-ui";

const clvrpotionbubblesguideui = new ActionFormData()
  .title("Potion Bubbles Guides:")
  .body(
    "Would you like to pick up the guide book? Or would you like to cancel and continue reading?"
  )
  .button("Pick up the Guide Book")
  .button("Cancel");

const clvrpotionbubblespickupui = new ActionFormData()
  .title("Potion Bubble Setting:")
  .body(
    "Would you like to pop the bubble and pick it up? Or would you like to edit the bubble's settings?"
  )
  .button("Pop the Bubble")
  .button("Edit Bubble Settings");

const clvrpotionbubblesspeedui = new ModalFormData()
  .title("Speed Bubble Settings:")
  .slider("Duration (seconds)", 1, 30, 1)
  .slider("Power Level", 1, 5, 1)
  .slider("Radius (blocks)", 1, 5, 1)
  .toggle("Effect Preview Particles", true);

const clvrpotionbubblesjumpboostui = new ModalFormData()
  .title("Jump Boost Bubble Settings:")
  .slider("Duration (seconds)", 1, 30, 1)
  .slider("Power Level", 1, 5, 1)
  .slider("Radius (blocks)", 1, 5, 1)
  .toggle("Effect Preview Particles", true);

const clvrpotionbubbleslevitationui = new ModalFormData()
  .title("Levitation Bubble Settings:")
  .slider("Duration (seconds)", 1, 30, 1)
  .slider("Power Level", 1, 5, 1)
  .slider("Radius (blocks)", 1, 5, 1)
  .toggle("Effect Preview Particles", true);

const clvrpotionbubblesslowfallingui = new ModalFormData()
  .title("Slow Falling Bubble Settings:")
  .slider("Duration (seconds)", 1, 30, 1)
  .slider("Power Level", 1, 5, 1)
  .slider("Radius (blocks)", 1, 5, 1)
  .toggle("Effect Preview Particles", true);

const clvrpotionbubblesfireresistanceui = new ModalFormData()
  .title("Fire Resistance Bubble Settings:")
  .slider("Duration (seconds)", 1, 30, 1)
  .slider("Power Level", 1, 5, 1)
  .slider("Radius (blocks)", 1, 5, 1)
  .toggle("Effect Preview Particles", true);

const clvrpotionbubbleswaterbreathingui = new ModalFormData()
  .title("Water Breathing Bubble Settings:")
  .slider("Duration (seconds)", 1, 30, 1)
  .slider("Power Level", 1, 5, 1)
  .slider("Radius (blocks)", 1, 5, 1)
  .toggle("Effect Preview Particles", true);

const clvrpotionbubbleshungerui = new ModalFormData()
  .title("Hunger Bubble Settings:")
  .slider("Duration (seconds)", 1, 30, 1)
  .slider("Power Level", 1, 5, 1)
  .slider("Radius (blocks)", 1, 5, 1)
  .toggle("Effect Preview Particles", true);

const clvrpotionbubblesslownessui = new ModalFormData()
  .title("Slowness Bubble Settings:")
  .slider("Duration (seconds)", 1, 30, 1)
  .slider("Power Level", 1, 5, 1)
  .slider("Radius (blocks)", 1, 5, 1)
  .toggle("Effect Preview Particles", true);

const clvrpotionbubblesblindnessui = new ModalFormData()
  .title("Blindness Bubble Settings:")
  .slider("Duration (seconds)", 1, 30, 1)
  .slider("Power Level", 1, 5, 1)
  .slider("Radius (blocks)", 1, 5, 1)
  .toggle("Effect Preview Particles", true);

const clvrpotionbubblesnauseaui = new ModalFormData()
  .title("Nausea Bubble Settings:")
  .slider("Duration (seconds)", 1, 30, 1)
  .slider("Power Level", 1, 5, 1)
  .slider("Radius (blocks)", 1, 5, 1)
  .toggle("Effect Preview Particles", true);

const clvrpotionbubblesdarknessui = new ModalFormData()
  .title("Darkness Bubble Settings:")
  .slider("Duration (seconds)", 1, 30, 1)
  .slider("Power Level", 1, 5, 1)
  .slider("Radius (blocks)", 1, 5, 1)
  .toggle("Effect Preview Particles", true);

const clvrpotionbubblesstrengthui = new ModalFormData()
  .title("Strength Bubble Settings:")
  .slider("Duration (seconds)", 1, 30, 1)
  .slider("Power Level", 1, 5, 1)
  .slider("Radius (blocks)", 1, 5, 1)
  .toggle("Effect Preview Particles", true);

const clvrpotionbubbleshasteui = new ModalFormData()
  .title("Haste Bubble Settings:")
  .slider("Duration (seconds)", 1, 30, 1)
  .slider("Power Level", 1, 5, 1)
  .slider("Radius (blocks)", 1, 5, 1)
  .toggle("Effect Preview Particles", true);

const clvrpotionbubblesregenerationui = new ModalFormData()
  .title("Regeneration Bubble Settings:")
  .slider("Duration (seconds)", 1, 30, 1)
  .slider("Power Level", 1, 5, 1)
  .slider("Radius (blocks)", 1, 5, 1)
  .toggle("Effect Preview Particles", true);

const clvrpotionbubblesresistanceui = new ModalFormData()
  .title("Resistance Bubble Settings:")
  .slider("Duration (seconds)", 1, 30, 1)
  .slider("Power Level", 1, 5, 1)
  .slider("Radius (blocks)", 1, 5, 1)
  .toggle("Effect Preview Particles", true);

const clvrpotionbubblesinvisibilityui = new ModalFormData()
  .title("Invisibility Bubble Settings:")
  .slider("Duration (seconds)", 1, 30, 1)
  .slider("Power Level", 1, 5, 1)
  .slider("Radius (blocks)", 1, 5, 1)
  .toggle("Effect Preview Particles", true);

const clvrpotionbubblesnightvisionui = new ModalFormData()
  .title("Night Vision Bubble Settings:")
  .slider("Duration (seconds)", 1, 30, 1)
  .slider("Power Level", 1, 5, 1)
  .slider("Radius (blocks)", 1, 5, 1)
  .toggle("Effect Preview Particles", true);

const clvrpotionbubbleshealthboostui = new ModalFormData()
  .title("Health Boost Bubble Settings:")
  .slider("Duration (seconds)", 1, 30, 1)
  .slider("Power Level", 1, 5, 1)
  .slider("Radius (blocks)", 1, 5, 1)
  .toggle("Effect Preview Particles", true);

const clvrpotionbubblesabsorptionui = new ModalFormData()
  .title("Absorption Bubble Settings:")
  .slider("Duration (seconds)", 1, 30, 1)
  .slider("Power Level", 1, 5, 1)
  .slider("Radius (blocks)", 1, 5, 1)
  .toggle("Effect Preview Particles", true);

const clvrpotionbubblessaturationui = new ModalFormData()
  .title("Saturation Bubble Settings:")
  .slider("Duration (seconds)", 1, 30, 1)
  .slider("Power Level", 1, 5, 1)
  .slider("Radius (blocks)", 1, 5, 1)
  .toggle("Effect Preview Particles", true);

const clvrpotionbubblesminingfatigueui = new ModalFormData()
  .title("Mining Fatigue Bubble Settings:")
  .slider("Duration (seconds)", 1, 30, 1)
  .slider("Power Level", 1, 5, 1)
  .slider("Radius (blocks)", 1, 5, 1)
  .toggle("Effect Preview Particles", true);

const clvrpotionbubblesweaknessui = new ModalFormData()
  .title("Weakness Bubble Settings:")
  .slider("Duration (seconds)", 1, 30, 1)
  .slider("Power Level", 1, 5, 1)
  .slider("Radius (blocks)", 1, 5, 1)
  .toggle("Effect Preview Particles", true);

const clvrpotionbubblespoisonui = new ModalFormData()
  .title("Poison Bubble Settings:")
  .slider("Duration (seconds)", 1, 30, 1)
  .slider("Power Level", 1, 5, 1)
  .slider("Radius (blocks)", 1, 5, 1)
  .toggle("Effect Preview Particles", true);

const clvrpotionbubbleswitherui = new ModalFormData()
  .title("Wither Bubble Settings:")
  .slider("Duration (seconds)", 1, 30, 1)
  .slider("Power Level", 1, 5, 1)
  .slider("Radius (blocks)", 1, 5, 1)
  .toggle("Effect Preview Particles", true);

function clvrpotionbubblesshowui(player, ui, target) {
  ui.show(player).then((response) => {
    if (response.canceled) return;
    if (response.formValues[0] == 1) {
      target.runCommand("event entity @s e_timer1");
    } else if (response.formValues[0] == 2) {
      target.runCommand("event entity @s e_timer2");
    } else if (response.formValues[0] == 3) {
      target.runCommand("event entity @s e_timer3");
    } else if (response.formValues[0] == 4) {
      target.runCommand("event entity @s e_timer4");
    } else if (response.formValues[0] == 5) {
      target.runCommand("event entity @s e_timer5");
    } else if (response.formValues[0] == 6) {
      target.runCommand("event entity @s e_timer6");
    } else if (response.formValues[0] == 7) {
      target.runCommand("event entity @s e_timer7");
    } else if (response.formValues[0] == 8) {
      target.runCommand("event entity @s e_timer8");
    } else if (response.formValues[0] == 9) {
      target.runCommand("event entity @s e_timer9");
    } else if (response.formValues[0] == 10) {
      target.runCommand("event entity @s e_timer10");
    } else if (response.formValues[0] == 11) {
      target.runCommand("event entity @s e_timer11");
    } else if (response.formValues[0] == 12) {
      target.runCommand("event entity @s e_timer12");
    } else if (response.formValues[0] == 13) {
      target.runCommand("event entity @s e_timer13");
    } else if (response.formValues[0] == 14) {
      target.runCommand("event entity @s e_timer14");
    } else if (response.formValues[0] == 15) {
      target.runCommand("event entity @s e_timer15");
    } else if (response.formValues[0] == 16) {
      target.runCommand("event entity @s e_timer16");
    } else if (response.formValues[0] == 17) {
      target.runCommand("event entity @s e_timer17");
    } else if (response.formValues[0] == 18) {
      target.runCommand("event entity @s e_timer18");
    } else if (response.formValues[0] == 19) {
      target.runCommand("event entity @s e_timer19");
    } else if (response.formValues[0] == 20) {
      target.runCommand("event entity @s e_timer20");
    } else if (response.formValues[0] == 21) {
      target.runCommand("event entity @s e_timer21");
    } else if (response.formValues[0] == 22) {
      target.runCommand("event entity @s e_timer22");
    } else if (response.formValues[0] == 23) {
      target.runCommand("event entity @s e_timer23");
    } else if (response.formValues[0] == 24) {
      target.runCommand("event entity @s e_timer24");
    } else if (response.formValues[0] == 25) {
      target.runCommand("event entity @s e_timer25");
    } else if (response.formValues[0] == 26) {
      target.runCommand("event entity @s e_timer26");
    } else if (response.formValues[0] == 27) {
      target.runCommand("event entity @s e_timer27");
    } else if (response.formValues[0] == 28) {
      target.runCommand("event entity @s e_timer28");
    } else if (response.formValues[0] == 29) {
      target.runCommand("event entity @s e_timer29");
    } else if (response.formValues[0] == 30) {
      target.runCommand("event entity @s e_timer30");
    }
    if (response.formValues[1] == 1) {
      target.runCommand("event entity @s e_power1");
    } else if (response.formValues[1] == 2) {
      target.runCommand("event entity @s e_power2");
    } else if (response.formValues[1] == 3) {
      target.runCommand("event entity @s e_power3");
    } else if (response.formValues[1] == 4) {
      target.runCommand("event entity @s e_power4");
    } else if (response.formValues[1] == 5) {
      target.runCommand("event entity @s e_power5");
    }
    if (response.formValues[2] == 1) {
      target.runCommand("event entity @s e_radius1");
    } else if (response.formValues[2] == 2) {
      target.runCommand("event entity @s e_radius2");
    } else if (response.formValues[2] == 3) {
      target.runCommand("event entity @s e_radius3");
    } else if (response.formValues[2] == 4) {
      target.runCommand("event entity @s e_radius4");
    } else if (response.formValues[2] == 5) {
      target.runCommand("event entity @s e_radius5");
    }
    if (response.formValues[3] == true) {
      target.runCommand("event entity @s e_particleson");
    } else if (response.formValues[3] == false) {
      target.runCommand("event entity @s e_particlesoff");
    }
    return;
  });
}

function clvrpotionbubblesswitch(interactplayer, target, selectedItem) {
  if (selectedItem?.typeId === "clvr_potionbubbles:bubblewand") {
    switch (target.typeId) {
      case "clvr_potionbubbles:speed":
        clvrpotionbubblesshowui(
          interactplayer,
          clvrpotionbubblesspeedui,
          target
        );
        return;
      case "clvr_potionbubbles:jumpboost":
        clvrpotionbubblesshowui(
          interactplayer,
          clvrpotionbubblesjumpboostui,
          target
        );
        return;
      case "clvr_potionbubbles:levitation":
        clvrpotionbubblesshowui(
          interactplayer,
          clvrpotionbubbleslevitationui,
          target
        );
        return;
      case "clvr_potionbubbles:slowfalling":
        clvrpotionbubblesshowui(
          interactplayer,
          clvrpotionbubblesslowfallingui,
          target
        );
        return;
      case "clvr_potionbubbles:fireresistance":
        clvrpotionbubblesshowui(
          interactplayer,
          clvrpotionbubblesfireresistanceui,
          target
        );
        return;
      case "clvr_potionbubbles:waterbreathing":
        clvrpotionbubblesshowui(
          interactplayer,
          clvrpotionbubbleswaterbreathingui,
          target
        );
        return;
      case "clvr_potionbubbles:hunger":
        clvrpotionbubblesshowui(
          interactplayer,
          clvrpotionbubbleshungerui,
          target
        );
        return;
      case "clvr_potionbubbles:slowness":
        clvrpotionbubblesshowui(
          interactplayer,
          clvrpotionbubblesslownessui,
          target
        );
        return;
      case "clvr_potionbubbles:blindness":
        clvrpotionbubblesshowui(
          interactplayer,
          clvrpotionbubblesblindnessui,
          target
        );
        return;
      case "clvr_potionbubbles:nausea":
        clvrpotionbubblesshowui(
          interactplayer,
          clvrpotionbubblesnauseaui,
          target
        );
        return;
      case "clvr_potionbubbles:darkness":
        clvrpotionbubblesshowui(
          interactplayer,
          clvrpotionbubblesdarknessui,
          target
        );
        return;
      case "clvr_potionbubbles:strength":
        clvrpotionbubblesshowui(
          interactplayer,
          clvrpotionbubblesstrengthui,
          target
        );
        return;
      case "clvr_potionbubbles:haste":
        clvrpotionbubblesshowui(
          interactplayer,
          clvrpotionbubbleshasteui,
          target
        );
        return;
      case "clvr_potionbubbles:regeneration":
        clvrpotionbubblesshowui(
          interactplayer,
          clvrpotionbubblesregenerationui,
          target
        );
        return;
      case "clvr_potionbubbles:resistance":
        clvrpotionbubblesshowui(
          interactplayer,
          clvrpotionbubblesresistanceui,
          target
        );
        return;
      case "clvr_potionbubbles:invisibility":
        clvrpotionbubblesshowui(
          interactplayer,
          clvrpotionbubblesinvisibilityui,
          target
        );
        return;
      case "clvr_potionbubbles:nightvision":
        clvrpotionbubblesshowui(
          interactplayer,
          clvrpotionbubblesnightvisionui,
          target
        );
        return;
      case "clvr_potionbubbles:healthboost":
        clvrpotionbubblesshowui(
          interactplayer,
          clvrpotionbubbleshealthboostui,
          target
        );
        return;
      case "clvr_potionbubbles:absorption":
        clvrpotionbubblesshowui(
          interactplayer,
          clvrpotionbubblesabsorptionui,
          target
        );
        return;
      case "clvr_potionbubbles:saturation":
        clvrpotionbubblesshowui(
          interactplayer,
          clvrpotionbubblessaturationui,
          target
        );
        return;
      case "clvr_potionbubbles:miningfatigue":
        clvrpotionbubblesshowui(
          interactplayer,
          clvrpotionbubblesminingfatigueui,
          target
        );
        return;
      case "clvr_potionbubbles:weakness":
        clvrpotionbubblesshowui(
          interactplayer,
          clvrpotionbubblesweaknessui,
          target
        );
        return;
      case "clvr_potionbubbles:poison":
        clvrpotionbubblesshowui(
          interactplayer,
          clvrpotionbubblespoisonui,
          target
        );
        return;
      case "clvr_potionbubbles:wither":
        clvrpotionbubblesshowui(
          interactplayer,
          clvrpotionbubbleswitherui,
          target
        );
        return;
    }
  }
}

world.afterEvents.entityHitEntity.subscribe((event) => {
  const { hitEntity, damagingEntity } = event;
  const interactplayer = damagingEntity;
  const target = hitEntity;
  const inventory = interactplayer.getComponent("inventory").container;
  const selectedItem = inventory.getItem(interactplayer.selectedSlotIndex);

  if (
    target.typeId === "clvr_potionbubbles:tutbook" &&
    interactplayer.typeId === "minecraft:player"
  ) {
    clvrpotionbubblesguideui.show(interactplayer).then((response) => {
      if (response.canceled) return;
      if (response.selection === 0) {
        interactplayer.runCommand("give @s clvr_potionbubbles:tutbook_spawn_egg");
        target.runCommand("event entity @s e_despawn");
      }
      if (response.selection === 1) {
        return;
      }
    });
  }

  if (selectedItem?.typeId === "clvr_potionbubbles:bubblewand" &&
    (target.typeId === "clvr_potionbubbles:speed" ||
      target.typeId === "clvr_potionbubbles:jumpboost" ||
      target.typeId === "clvr_potionbubbles:levitation" ||
      target.typeId === "clvr_potionbubbles:slowfalling" ||
      target.typeId === "clvr_potionbubbles:fireresistance" ||
      target.typeId === "clvr_potionbubbles:waterbreathing" ||
      target.typeId === "clvr_potionbubbles:hunger" ||
      target.typeId === "clvr_potionbubbles:slowness" ||
      target.typeId === "clvr_potionbubbles:blindness" ||
      target.typeId === "clvr_potionbubbles:nausea" ||
      target.typeId === "clvr_potionbubbles:darkness" ||
      target.typeId === "clvr_potionbubbles:strength" ||
      target.typeId === "clvr_potionbubbles:haste" ||
      target.typeId === "clvr_potionbubbles:regeneration" ||
      target.typeId === "clvr_potionbubbles:resistance" ||
      target.typeId === "clvr_potionbubbles:invisibility" ||
      target.typeId === "clvr_potionbubbles:nightvision" ||
      target.typeId === "clvr_potionbubbles:healthboost" ||
      target.typeId === "clvr_potionbubbles:absorption" ||
      target.typeId === "clvr_potionbubbles:saturation" ||
      target.typeId === "clvr_potionbubbles:miningfatigue" ||
      target.typeId === "clvr_potionbubbles:weakness" ||
      target.typeId === "clvr_potionbubbles:poison" ||
      target.typeId === "clvr_potionbubbles:wither")
  ) {
    clvrpotionbubblespickupui.show(interactplayer).then((response) => {
      if (response.canceled) return;
      if (response.selection === 0) {
        hitEntity.runCommand("event entity @s e_despawn");
        switch (target.typeId) {
          case "clvr_potionbubbles:speed":
            interactplayer.runCommand(
              "give @s clvr_potionbubbles:speed_spawn_egg"
            );
            return;
          case "clvr_potionbubbles:jumpboost":
            interactplayer.runCommand(
              "give @s clvr_potionbubbles:jumpboost_spawn_egg"
            );
            return;
          case "clvr_potionbubbles:levitation":
            interactplayer.runCommand(
              "give @s clvr_potionbubbles:levitation_spawn_egg"
            );
            return;
          case "clvr_potionbubbles:slowfalling":
            interactplayer.runCommand(
              "give @s clvr_potionbubbles:slowfalling_spawn_egg"
            );
            return;
          case "clvr_potionbubbles:fireresistance":
            interactplayer.runCommand(
              "give @s clvr_potionbubbles:fireresistance_spawn_egg"
            );
            return;
          case "clvr_potionbubbles:waterbreathing":
            interactplayer.runCommand(
              "give @s clvr_potionbubbles:waterbreathing_spawn_egg"
            );
            return;
          case "clvr_potionbubbles:hunger":
            interactplayer.runCommand(
              "give @s clvr_potionbubbles:hunger_spawn_egg"
            );
            return;
          case "clvr_potionbubbles:slowness":
            interactplayer.runCommand(
              "give @s clvr_potionbubbles:slowness_spawn_egg"
            );
            return;
          case "clvr_potionbubbles:blindness":
            interactplayer.runCommand(
              "give @s clvr_potionbubbles:blindness_spawn_egg"
            );
            return;
          case "clvr_potionbubbles:nausea":
            interactplayer.runCommand(
              "give @s clvr_potionbubbles:nausea_spawn_egg"
            );
            return;
          case "clvr_potionbubbles:darkness":
            interactplayer.runCommand(
              "give @s clvr_potionbubbles:darkness_spawn_egg"
            );
            return;
          case "clvr_potionbubbles:strength":
            interactplayer.runCommand(
              "give @s clvr_potionbubbles:strength_spawn_egg"
            );
            return;
          case "clvr_potionbubbles:haste":
            interactplayer.runCommand(
              "give @s clvr_potionbubbles:haste_spawn_egg"
            );
            return;
          case "clvr_potionbubbles:regeneration":
            interactplayer.runCommand(
              "give @s clvr_potionbubbles:regeneration_spawn_egg"
            );
            return;
          case "clvr_potionbubbles:resistance":
            interactplayer.runCommand(
              "give @s clvr_potionbubbles:resistance_spawn_egg"
            );
            return;
          case "clvr_potionbubbles:invisibility":
            interactplayer.runCommand(
              "give @s clvr_potionbubbles:invisibility_spawn_egg"
            );
            return;
          case "clvr_potionbubbles:nightvision":
            interactplayer.runCommand(
              "give @s clvr_potionbubbles:nightvision_spawn_egg"
            );
            return;
          case "clvr_potionbubbles:healthboost":
            interactplayer.runCommand(
              "give @s clvr_potionbubbles:healthboost_spawn_egg"
            );
            return;
          case "clvr_potionbubbles:absorption":
            interactplayer.runCommand(
              "give @s clvr_potionbubbles:absorption_spawn_egg"
            );
            return;
          case "clvr_potionbubbles:saturation":
            interactplayer.runCommand(
              "give @s clvr_potionbubbles:saturation_spawn_egg"
            );
            return;
          case "clvr_potionbubbles:miningfatigue":
            interactplayer.runCommand(
              "give @s clvr_potionbubbles:miningfatigue_spawn_egg"
            );
            return;
          case "clvr_potionbubbles:weakness":
            interactplayer.runCommand(
              "give @s clvr_potionbubbles:weakness_spawn_egg"
            );
            return;
          case "clvr_potionbubbles:poison":
            interactplayer.runCommand(
              "give @s clvr_potionbubbles:poison_spawn_egg"
            );
            return;
          case "clvr_potionbubbles:wither":
            interactplayer.runCommand(
              "give @s clvr_potionbubbles:wither_spawn_egg"
            );
            return;
        }
      }
      if (response.selection === 1) {
        clvrpotionbubblesswitch(interactplayer, target, selectedItem);
      }
    });
  }
});

world.afterEvents.playerInteractWithEntity.subscribe((event) => {
  const interactplayer = event.player;
  const target = event.target;
  const selectedItem = event.beforeItemStack;
  if (selectedItem?.typeId === "clvr_potionbubbles:bubblewand" &&
    (target.typeId === "clvr_potionbubbles:speed" ||
      target.typeId === "clvr_potionbubbles:jumpboost" ||
      target.typeId === "clvr_potionbubbles:levitation" ||
      target.typeId === "clvr_potionbubbles:slowfalling" ||
      target.typeId === "clvr_potionbubbles:fireresistance" ||
      target.typeId === "clvr_potionbubbles:waterbreathing" ||
      target.typeId === "clvr_potionbubbles:hunger" ||
      target.typeId === "clvr_potionbubbles:slowness" ||
      target.typeId === "clvr_potionbubbles:blindness" ||
      target.typeId === "clvr_potionbubbles:nausea" ||
      target.typeId === "clvr_potionbubbles:darkness" ||
      target.typeId === "clvr_potionbubbles:strength" ||
      target.typeId === "clvr_potionbubbles:haste" ||
      target.typeId === "clvr_potionbubbles:regeneration" ||
      target.typeId === "clvr_potionbubbles:resistance" ||
      target.typeId === "clvr_potionbubbles:invisibility" ||
      target.typeId === "clvr_potionbubbles:nightvision" ||
      target.typeId === "clvr_potionbubbles:healthboost" ||
      target.typeId === "clvr_potionbubbles:absorption" ||
      target.typeId === "clvr_potionbubbles:saturation" ||
      target.typeId === "clvr_potionbubbles:miningfatigue" ||
      target.typeId === "clvr_potionbubbles:weakness" ||
      target.typeId === "clvr_potionbubbles:poison" ||
      target.typeId === "clvr_potionbubbles:wither")
  ) {
    clvrpotionbubblesswitch(interactplayer, target, selectedItem);
  }
});
