
import {world, system, Vector} from "@minecraft/server"

import { ActionFormData, ModalFormData, MessageFormData } from "@minecraft/server-ui"

  
const modal = new ModalFormData()

    modal.title("Blade Paper")

    modal.dropdown("Types of Blades", ["Hard Blade §2XP: 35L", "Long Blade §2XP: 30L", "Sharp Blade §2XP: 36L", "Pick Blade §2XP: 30L", "Drill Blade §2XP: 30L", "Ax Blade §2XP: 30L", "Shovel Blade §2XP: 30L", "Scythe Blade §2XP: 30L"])
    const book = new ActionFormData()
    book.title("Skilled Book")
    book.body("Everything about the addon will be in this book.")
    book.button("§6§lSkilled Anvil", "textures/bookui/sa")
    book.button("§d§lSkills", "textures/bookui/sk")
    book.button("§c§lRituals", "textures/bookui/rt")
    book.button("§a§lItems Without Recipes", "textures/bookui/item")
    book.button("§5§lCreatures Invocation", "textures/bookui/cr")
    const anvil = new ActionFormData()
    anvil.title("Skilled Anvil")
    anvil.button("Back")
    anvil.body( { rawtext: [ { translate: "btext.anvil" }, { text: `\n` }, { translate: "btext.anvil1" }, { text: `\n` }, { translate: "btext.anvil2" } ] } )
  const skills = new ActionFormData()
  skills.title("Skills Info")
  skills.button("Back")
  skills.body( { rawtext: [ { translate: "btext.skills" }, { text: `\n` }, { translate: "btext.skills1" }, { text: `\n` }, { translate: "btext.skills2" }, { text: `\n` }, { translate: "btext.skills3" }, { text: `\n` }, { translate: "btext.skills4" }, { text: `\n` }, { translate: "btext.skills5" }, { text: `\n` }, { translate: "btext.skills6" }, { text: `\n` }, { translate: "btext.skills7" }, { text: `\n` }, { translate: "btext.skills7" }, { text: `\n` }, { translate: "btext.skills8" }, { text: `\n` }, { translate: "btext.skills9" }, { text: `\n` }, { translate: "btext.skills10" }, { text: `\n` }, { translate: "btext.skills11" }, { text: `\n` }, { translate: "btext.skills12" } ] } )

const rituals = new ActionFormData()
rituals.title("Rituals")
rituals.body(`
§f----------------------------------
§l§fEndynium Ritual
§r§5• = Obsidian  §g• = End Stone
§9• = Water

§o§7reserve a place in your world and place the blocks in the following order:
§l§5• §g• §5•
§g• §9• §g•
§5• §g• §5•
§d§rYou also have to place "ender crystals" on top of all obsidians in the ritual.
§o§r§7After the ritual is done, throw any item or any entity in the middle of the ritual, in the place where the water is.
§r§f----------------------------------
§f§l Endynium Ingot Recipe
§r§5• = Crying Obsidian  §d• = End Crystal
§2• = Ender Eye  §7• = Steel Ingot

§o§7open the interface of the entity that will be at the center of the ritual and place the items in the slots as follows:
§l§5• §d• • §2• §d• • §5•
§7• • • • • • •
§4• §d• • §2• §d• • §5•
§f----------------------------------
§l§fIlluminatic Ritual
§r§b• = Diamond Block  §3• = Prismarine
§9• = Lava

§o§7reserve a place in your world and place the blocks in the following order:
§l§b• §3• §b•
§3• §9• §3•
§b• §3• §b•
§o§r§7After the ritual is done, throw any item or any entity in the middle of the ritual, in the place where the water is.
§r§f----------------------------------
§f§lIlluminatic Ingot Recipe
§r§9• = Heart Of the Sea  §b• = §3Prismarine
§b• = Diamond Block  §7• = Steel Ingot

§o§7open the interface of the entity that will be at the center of the ritual and place the items in the slots as follows:
§l§9• §b• • §3• §b• • §9•
§7• • • • • • •
§9• §b• • §3• §b• • §9•
§f----------------------------------
§l§fMagmatic Ritual
§r§5• = Netherite Block  §6• = Magma Block
§c• = Lava

§o§7reserve a place in your world and place the blocks in the following order:
§l§5• §6• §5•
§6• §c• §6•
§5• §6• §5•
§o§r§7After the ritual is done, throw any item or any entity in the middle of the ritual, in the place where the lava is.

§f§lMagmatic Ingot Recipe
§r§5• = Netherite Ingot  §c• = Magma Cream
§6• = Magma Block  §7• = Steel Ingot

§o§7open the interface of the entity that will be at the center of the ritual and place the items in the slots as follows:
§l§5• §c• • §6• §c• • §5•
§7• • • • • • •
§5• §c• • §6• §c• • §5•
§r§f----------------------------------
`)
rituals.button("Back")

const items = new ActionFormData()
items.title("Items Without Recipes")
items.body(`
§r§f----------------------------------
§l§7Iron Plate,Gold Plate, Diamond Plate
§rcan be obtained when the player clicks on an iron block,gold block, or diamond block with any of the hammers
§r§f----------------------------------
§l§5Bat Wing
§rcan be obtained by killing bats.
§r§f----------------------------------
§l§8Piece of Steel
§rcan be heated in a furnace
§r§f----------------------------------
§l§9Magic Feather
§rThere is a small chance of being dropped by chicken
§r§f----------------------------------
`)
items.button("Back")

const boss = new ActionFormData()
boss.title("Creatures Invocation")
boss.body(`
§lCorrupted Zombie
§r§c Take a Nametag and rename a zombie to "corrupted",
after that, throw a netherite dagger and wait for the zombie to pick it up.`)
boss.button("Back")
world.afterEvents.itemUseOn.subscribe(data => {
  if (data.block.typeId == "skilleditems:skilled_upgrader") {
    const player = data.source
    if (data.itemStack.typeId.startsWith("skilleditems:") && data.itemStack.typeId.endsWith("hardsword") || data.itemStack.typeId.endsWith("hardhammer") == true) {
      player.runCommandAsync(`execute if entity @s[hasitem={item=minecraft:redstone_block,quantity=9..}] run tellraw @s {"rawtext":[{"translate":"§aSuccessfully Upgraded!!"}]}`)
      player.runCommandAsync(`execute if entity @s[hasitem={item=minecraft:redstone_block,quantity=..8}] run tellraw @s {"rawtext":[{"translate":"§cYou need 9 redstone blocks!!"}]}`)
        player.runCommandAsync(`execute if entity @s[hasitem={item=minecraft:redstone_block,quantity=9..}] run replaceitem entity @s slot.weapon.mainhand 0 skilleditems:${data.itemStack.typeId.split(":")[1]}_2`)
        player.runCommandAsync("clear @s redstone_block 0 9")
        
    }
    if (data.itemStack.typeId.startsWith("skilleditems:") && data.itemStack.typeId.endsWith("hardsword_2") || data.itemStack.typeId.endsWith("hardhammer_2") == true) {
      player.runCommandAsync(`execute if entity @s[hasitem={item=minecraft:obsidian,quantity=9..}] run tellraw @s {"rawtext":[{"translate":"§aSuccessfully Upgraded!!"}]}`)
      player.runCommandAsync(`execute if entity @s[hasitem={item=minecraft:obsidian,quantity=..8}] run tellraw @s {"rawtext":[{"translate":"§cYou need 9 obsidians!!"}]}`)
        player.runCommandAsync(`execute if entity @s[hasitem={item=minecraft:obsidian,quantity=9..}] run replaceitem entity @s slot.weapon.mainhand 0 skilleditems:${data.itemStack.typeId.split(":")[1].replace("_2", "_3")}`)
        player.runCommandAsync("clear @s obsidian 0 9")
       
    }
    if (data.itemStack.typeId.startsWith("skilleditems:") && data.itemStack.typeId.endsWith("hardsword_3") || data.itemStack.typeId.endsWith("hardhammer_3") == true) {
      player.runCommandAsync(`execute if entity @s[hasitem={item=minecraft:lapis_block,quantity=9..}] run tellraw @s {"rawtext":[{"translate":"§aSuccessfully Upgraded!!"}]}`)
      player.runCommandAsync(`execute if entity @s[hasitem={item=minecraft:lapis_block,quantity=..8}] run tellraw @s {"rawtext":[{"translate":"§cYou need 9 lapis blocks!!"}]}`)
        player.runCommandAsync(`execute if entity @s[hasitem={item=minecraft:lapis_block,quantity=9..}] run replaceitem entity @s slot.weapon.mainhand 0 skilleditems:${data.itemStack.typeId.split(":")[1].replace("_3", "_4")}`)
        player.runCommandAsync("clear @s lapis_block 0 9")
       
    }

  }
})
world.afterEvents.itemUse.subscribe(eventData => {

    if (eventData.itemStack.typeId == "skilleditems:paper") {

        const player = eventData.source

        modal.show(player).then(result => {

            if (result.formValues[0] == 0) {

                player.runCommandAsync(`replaceitem entity @s[lm=35] slot.weapon.mainhand 0 skilleditems:hard_paper`)
                player.runCommandAsync(`xp -10L @s[lm=35]`)

            }

            if (result.formValues[0] == 1) {

                player.runCommandAsync(`replaceitem entity @s[lm=30] slot.weapon.mainhand 0 skilleditems:long_paper`)
                player.runCommandAsync(`xp -5L @s[lm=30]`)
                
            }

            if(result.formValues[0] == 2) {

                player.runCommandAsync(`replaceitem entity @s[lm=36] slot.weapon.mainhand 0 skilleditems:sharp_paper`)
                player.runCommandAsync(`xp -10L @s[lm=36]`)

            }
            
            if(result.formValues[0] == 3) {

                player.runCommandAsync(`replaceitem entity @s[lm=30] slot.weapon.mainhand 0 skilleditems:pick_paper`)
                player.runCommandAsync(`xp -5L @s[lm=30]`)

            }
            
            if(result.formValues[0] == 4) {

                player.runCommandAsync(`replaceitem entity @s[lm=30] slot.weapon.mainhand 0 skilleditems:drill_paper`)
                player.runCommandAsync(`xp -5L @s[lm=30]`)

            }
            
            if(result.formValues[0] == 5) {

                player.runCommandAsync(`replaceitem entity @s[lm=30] slot.weapon.mainhand 0 skilleditems:ax_paper`)
                player.runCommandAsync(`xp -5L @s[lm=30]`)

            }
            
            if(result.formValues[0] == 7) {

                player.runCommandAsync(`replaceitem entity @s[lm=30] slot.weapon.mainhand 0 skilleditems:schyte_paper`)
                player.runCommandAsync(`xp -5L @s[lm=30]`)

            }
            
            if(result.formValues[0] == 6) {

                player.runCommandAsync(`replaceitem entity @s[lm=30] slot.weapon.mainhand 0 skilleditems:shovel_paper`)
                player.runCommandAsync(`xp -5L @s[lm=30]`)

            }



        })

    }
if (eventData.itemStack.typeId == "skilleditems:skilled_book") {
  const player = eventData.source
  player.runCommandAsync("scriptevent blayy:skbook")
}
})
world.afterEvents.entityHitEntity.subscribe(data => {
  const entity = data.hitEntity
  const player = data.damagingEntity
  
  if (entity.typeId == "skilleditems:mag_ritual") {
  if (entity.hasTag("mag_ingot") == true) {
    player.runCommandAsync("give @s skilleditems:magmatic_steel")
let inv = entity.getComponent("minecraft:inventory").container
let slots = [1, 2, 3, 4, 5, 6, 7, 10, 11, 12, 13, 14, 15, 16, 19, 20, 21, 22, 23, 24, 25]
slots.forEach(slot=>{
  let item = inv.getItem(slot)
  if(item){
    if (item.amount >= 2) {
    item.amount--;
    inv.setItem(slot, item)
    }else{
      entity.runCommandAsync(`replaceitem entity @s slot.inventory ${slot} minecraft:air`)
    }
  }
})
  entity.runCommandAsync("tag @s remove mag_ingot")
  }
}
  if (entity.typeId == "skilleditems:iluminar_ritual") {
  if (entity.hasTag("iluminar_ingot") == true) {
    player.runCommandAsync("give @s skilleditems:illuminatic_steel")
let inv = entity.getComponent("minecraft:inventory").container
let slots = [1, 2, 3, 4, 5, 6, 7, 10, 11, 12, 13, 14, 15, 16, 19, 20, 21, 22, 23, 24, 25]
slots.forEach(slot=>{
  let item = inv.getItem(slot)
  if(item){
    if (item.amount >= 2) {
    item.amount--;
    inv.setItem(slot, item)
    }else{
      entity.runCommandAsync(`replaceitem entity @s slot.inventory ${slot} minecraft:air`)
    }
  }
})
  entity.runCommandAsync("tag @s remove iluminar_ingot")
  }
}
  if (entity.typeId == "skilleditems:end_ritual") {
 if (entity.hasTag("end_ingot") == true) {
    player.runCommandAsync("give @s skilleditems:endynium")
let inv = entity.getComponent("minecraft:inventory").container
let slots = [1, 2, 3, 4, 5, 6, 7, 10, 11, 12, 13, 14, 15, 16, 19, 20, 21, 22, 23, 24, 25]
slots.forEach(slot=>{
  let item = inv.getItem(slot)
  if(item){
    if (item.amount >= 2) {
    item.amount--;
    inv.setItem(slot, item)
    }else{
      entity.runCommandAsync(`replaceitem entity @s slot.inventory ${slot} minecraft:air`)
    }
  }
})
  entity.runCommandAsync("tag @s remove end_ingot")
  }
}
})
world.afterEvents.playerBreakBlock.subscribe(sla => {
  const player = sla.player
  const entity = sla.brokenBlockPermutation.type.id
  if (entity.includes('log') || entity.endsWith('stem') || entity.endsWith('wood') == true) {
    if (player.hasTag("dvt") == false && player.getComponent("minecraft:inventory").container.getItem(player.selectedSlot).typeId.startsWith('skilleditems') == true && player.getComponent("minecraft:inventory").container.getItem(player.selectedSlot).typeId.endsWith('heavyaxe') || player.getComponent("minecraft:inventory").container.getItem(player.selectedSlot).typeId.endsWith('paxel') == true) {
       let fillblock = sla.block.location
      let fillblocks = [
new Vector(fillblock.x, fillblock.y, fillblock.z),
new Vector(fillblock.x, fillblock.y+1, fillblock.z),
new Vector(fillblock.x, fillblock.y+2, fillblock.z),
new Vector(fillblock.x, fillblock.y+3, fillblock.z),
new Vector(fillblock.x, fillblock.y+4, fillblock.z),
new Vector(fillblock.x, fillblock.y+5, fillblock.z),
new Vector(fillblock.x, fillblock.y+6, fillblock.z),
new Vector(fillblock.x, fillblock.y+7, fillblock.z),
new Vector(fillblock.x, fillblock.y+8, fillblock.z),
new Vector(fillblock.x, fillblock.y+9, fillblock.z),
new Vector(fillblock.x, fillblock.y+10, fillblock.z),
new Vector(fillblock.x, fillblock.y+11, fillblock.z),
new Vector(fillblock.x, fillblock.y+12, fillblock.z),
new Vector(fillblock.x, fillblock.y+13, fillblock.z),
new Vector(fillblock.x, fillblock.y+14, fillblock.z),
new Vector(fillblock.x, fillblock.y+15, fillblock.z),
new Vector(fillblock.x, fillblock.y+16, fillblock.z),
new Vector(fillblock.x, fillblock.y+17, fillblock.z),
new Vector(fillblock.x, fillblock.y+18, fillblock.z),
new Vector(fillblock.x, fillblock.y+19, fillblock.z),
new Vector(fillblock.x, fillblock.y+20, fillblock.z),
new Vector(fillblock.x, fillblock.y+21, fillblock.z),
new Vector(fillblock.x, fillblock.y+22, fillblock.z),
new Vector(fillblock.x, fillblock.y+23, fillblock.z),
new Vector(fillblock.x, fillblock.y+24, fillblock.z),
new Vector(fillblock.x, fillblock.y+25, fillblock.z),
new Vector(fillblock.x, fillblock.y+26, fillblock.z),
new Vector(fillblock.x, fillblock.y+27, fillblock.z),
new Vector(fillblock.x, fillblock.y+28, fillblock.z),
new Vector(fillblock.x, fillblock.y+29, fillblock.z),
new Vector(fillblock.x, fillblock.y+30, fillblock.z),
]
        fillblocks.forEach(fl => {
                      let block = sla.block.dimension.getBlock(fl)
            if (block.typeId == entity) {
              block.dimension.runCommandAsync(`setblock ${block.location.x} ${block.location.y} ${block.location.z} air [] destroy`)
            }
          
        })
    }
  }
if (entity.endsWith('ore') == true) {
  if (player.hasTag("dvt") == false && player.getComponent("minecraft:inventory").container.getItem(player.selectedSlot).typeId.startsWith('skilleditems') == true && player.getComponent("minecraft:inventory").container.getItem(player.selectedSlot).typeId.endsWith('pickaxe') || player.getComponent("minecraft:inventory").container.getItem(player.selectedSlot).typeId.endsWith('paxel') == true) {
    let fillblock = sla.block.location
let fillblocks = [
new Vector(fillblock.x, fillblock.y, fillblock.z),
   new Vector(fillblock.x +1, fillblock.y, fillblock.z),
   new Vector(fillblock.x, fillblock.y, fillblock.z +1),
   new Vector(fillblock.x -1, fillblock.y, fillblock.z),
   new Vector(fillblock.x, fillblock.y,  fillblock.z -1),
   new Vector(fillblock.x -1, fillblock.y, fillblock.z -1),
   new Vector(fillblock.x +1, fillblock.y, fillblock.z +1),
   new Vector(fillblock.x -1, fillblock.y, fillblock.z +1),
   new Vector(fillblock.x +1, fillblock.y, fillblock.z -1),
   
   new Vector(fillblock.x, fillblock.y +1, fillblock.z),
   new Vector(fillblock.x +1, fillblock.y +1, fillblock.z),
   new Vector(fillblock.x, fillblock.y +1, fillblock.z +1),
   new Vector(fillblock.x -1, fillblock.y +1, fillblock.z),
   new Vector(fillblock.x, fillblock.y +1,  fillblock.z -1),
   new Vector(fillblock.x -1, fillblock.y +1, fillblock.z -1),
   new Vector(fillblock.x +1, fillblock.y +1, fillblock.z +1),
   new Vector(fillblock.x -1, fillblock.y +1, fillblock.z +1),
   new Vector(fillblock.x +1, fillblock.y +1, fillblock.z -1),

new Vector(fillblock.x, fillblock.y -1, fillblock.z),
   new Vector(fillblock.x +1, fillblock.y -1, fillblock.z),
   new Vector(fillblock.x, fillblock.y -1, fillblock.z +1),
   new Vector(fillblock.x -1, fillblock.y -1, fillblock.z),
   new Vector(fillblock.x, fillblock.y -1,  fillblock.z -1),
   new Vector(fillblock.x -1, fillblock.y -1, fillblock.z -1),
   new Vector(fillblock.x +1, fillblock.y -1, fillblock.z +1),
   new Vector(fillblock.x -1, fillblock.y -1, fillblock.z +1),
   new Vector(fillblock.x +1, fillblock.y -1, fillblock.z -1),
   
   new Vector(fillblock.x, fillblock.y -2, fillblock.z),
   new Vector(fillblock.x +1, fillblock.y -2, fillblock.z),
   new Vector(fillblock.x, fillblock.y -2, fillblock.z +1),
   new Vector(fillblock.x -1, fillblock.y -2, fillblock.z),
   new Vector(fillblock.x, fillblock.y -2,  fillblock.z -1),
   new Vector(fillblock.x -1, fillblock.y -2, fillblock.z -1),
   new Vector(fillblock.x +1, fillblock.y -2, fillblock.z +1),
   new Vector(fillblock.x -1, fillblock.y -2, fillblock.z +1),
   new Vector(fillblock.x +1, fillblock.y -2, fillblock.z -1),
   ]
        fillblocks.forEach(fl => {
                      let block = sla.block.dimension.getBlock(fl)
            if (block.typeId == entity) {
              block.dimension.runCommandAsync(`setblock ${block.location.x} ${block.location.y} ${block.location.z} air [] destroy`)
            }
          
        })

        
    
  }
}
if (player.getComponent("minecraft:inventory").container.getItem(player.selectedSlot) && player.getComponent("minecraft:inventory").container.getItem(player.selectedSlot).typeId.includes('hammer') || player.getComponent("minecraft:inventory").container.getItem(player.selectedSlot).typeId.endsWith('shovel') == true && player.getComponent("minecraft:inventory").container.getItem(player.selectedSlot).typeId.startsWith('skilleditems') == true) {
  const x = sla.block.location["x"]
    const y = sla.block.location["y"]
    const z = sla.block.location["z"]
  if (player.hasTag("baixo") == true) {
    player.runCommandAsync(`execute if block ${x+1} ${y} ${z} ${entity} run setblock ${x+1} ${y} ${z} air [] destroy`)
    player.runCommandAsync(`execute if block ${x-1} ${y} ${z} ${entity} run setblock ${x-1} ${y} ${z} air [] destroy`)
    player.runCommandAsync(`execute if block ${x} ${y} ${z+1} ${entity} run setblock ${x} ${y} ${z+1} air [] destroy`)
    player.runCommandAsync(`execute if block ${x} ${y} ${z-1} ${entity} run setblock ${x} ${y} ${z-1} air [] destroy`)
    player.runCommandAsync(`execute if block ${x+1} ${y} ${z-1} ${entity} run setblock ${x+1} ${y} ${z-1} air [] destroy`)
    player.runCommandAsync(`execute if block ${x+1} ${y} ${z+1} ${entity} run setblock ${x+1} ${y} ${z+1} air [] destroy`)
    player.runCommandAsync(`execute if block ${x-1} ${y} ${z-1} ${entity} run setblock ${x-1} ${y} ${z-1} air [] destroy`)
    player.runCommandAsync(`execute if block ${x-1} ${y} ${z+1} ${entity} run setblock ${x-1} ${y} ${z+1} air [] destroy`)
    player.runCommandAsync("tag @s remove baixo")
  }
  if (player.hasTag("dbaixo") == true) {
    player.runCommandAsync(`execute if block ${x} ${y-1} ${z} ${entity} run setblock ${x} ${y-1} ${z} air [] destroy`)
    player.runCommandAsync(`execute if block ${x} ${y-2} ${z} ${entity} run setblock ${x} ${y-2} ${z} air [] destroy`)
    
    player.runCommandAsync(`execute if block ${x+1} ${y-1} ${z} ${entity} run setblock ${x+1} ${y-1} ${z} air [] destroy`)
    player.runCommandAsync(`execute if block ${x-1} ${y-1} ${z} ${entity} run setblock ${x-1} ${y-1} ${z} air [] destroy`)
    player.runCommandAsync(`execute if block ${x} ${y-1} ${z+1} ${entity} run setblock ${x} ${y-1} ${z+1} air [] destroy`)
    player.runCommandAsync(`execute if block ${x} ${y-1} ${z-1} ${entity} run setblock ${x} ${y-1} ${z-1} air [] destroy`)
    player.runCommandAsync(`execute if block ${x+1} ${y-1} ${z-1} ${entity} run setblock ${x+1} ${y-1} ${z-1} air [] destroy`)
    player.runCommandAsync(`execute if block ${x+1} ${y-1} ${z+1} ${entity} run setblock ${x+1} ${y-1} ${z+1} air [] destroy`)
    player.runCommandAsync(`execute if block ${x-1} ${y-1} ${z-1} ${entity} run setblock ${x-1} ${y-1} ${z-1} air [] destroy`)
    player.runCommandAsync(`execute if block ${x-1} ${y-1} ${z+1} ${entity} run setblock ${x-1} ${y-1} ${z+1} air [] destroy`)
    
    player.runCommandAsync(`execute if block ${x} ${y-1} ${z} ${entity} run setblock ${x} ${y-1} ${z} air [] destroy`)
    
    player.runCommandAsync(`execute if block ${x+1} ${y-2} ${z} ${entity} run setblock ${x+1} ${y-2} ${z} air [] destroy`)
    player.runCommandAsync(`execute if block ${x-1} ${y-2} ${z} ${entity} run setblock ${x-1} ${y-2} ${z} air [] destroy`)
    player.runCommandAsync(`execute if block ${x} ${y-2} ${z+1} ${entity} run setblock ${x} ${y-2} ${z+1} air [] destroy`)
    player.runCommandAsync(`execute if block ${x} ${y-2} ${z-1} ${entity} run setblock ${x} ${y-2} ${z-1} air [] destroy`)
    player.runCommandAsync(`execute if block ${x+1} ${y-2} ${z-1} ${entity} run setblock ${x+1} ${y-2} ${z-1} air [] destroy`)
    player.runCommandAsync(`execute if block ${x+1} ${y-2} ${z+1} ${entity} run setblock ${x+1} ${y-2} ${z+1} air [] destroy`)
    player.runCommandAsync(`execute if block ${x-1} ${y-2} ${z-1} ${entity} run setblock ${x-1} ${y-2} ${z-1} air [] destroy`)
    player.runCommandAsync(`execute if block ${x-1} ${y-2} ${z+1} ${entity} run setblock ${x-1} ${y-2} ${z+1} air [] destroy`)
    player.runCommandAsync("tag @s remove dbaixo")
  }
  if (player.hasTag("dcima") == true) {
    player.runCommandAsync(`execute if block ${x} ${y+1} ${z} ${entity} run setblock ${x} ${y+1} ${z} air [] destroy`)
    player.runCommandAsync(`execute if block ${x} ${y+2} ${z} ${entity} run setblock ${x} ${y+2} ${z} air [] destroy`)
    
    player.runCommandAsync(`execute if block ${x+1} ${y+1} ${z} ${entity} run setblock ${x+1} ${y+1} ${z} air [] destroy`)
    player.runCommandAsync(`execute if block ${x-1} ${y+1} ${z} ${entity} run setblock ${x-1} ${y+1} ${z} air [] destroy`)
    player.runCommandAsync(`execute if block ${x} ${y+1} ${z+1} ${entity} run setblock ${x} ${y+1} ${z+1} air [] destroy`)
    player.runCommandAsync(`execute if block ${x} ${y+1} ${z-1} ${entity} run setblock ${x} ${y+1} ${z-1} air [] destroy`)
    player.runCommandAsync(`execute if block ${x+1} ${y+1} ${z-1} ${entity} run setblock ${x+1} ${y+1} ${z-1} air [] destroy`)
    player.runCommandAsync(`execute if block ${x+1} ${y+1} ${z+1} ${entity} run setblock ${x+1} ${y+1} ${z+1} air [] destroy`)
    player.runCommandAsync(`execute if block ${x-1} ${y+1} ${z-1} ${entity} run setblock ${x-1} ${y+1} ${z-1} air [] destroy`)
    player.runCommandAsync(`execute if block ${x-1} ${y+1} ${z+1} ${entity} run setblock ${x-1} ${y+1} ${z+1} air [] destroy`)
    
    player.runCommandAsync(`execute if block ${x} ${y+1} ${z} ${entity} run setblock ${x} ${y+1} ${z} air [] destroy`)
    
    player.runCommandAsync(`execute if block ${x+1} ${y+2} ${z} ${entity} run setblock ${x+1} ${y+2} ${z} air [] destroy`)
    player.runCommandAsync(`execute if block ${x-1} ${y+2} ${z} ${entity} run setblock ${x-1} ${y+2} ${z} air [] destroy`)
    player.runCommandAsync(`execute if block ${x} ${y+2} ${z+1} ${entity} run setblock ${x} ${y+2} ${z+1} air [] destroy`)
    player.runCommandAsync(`execute if block ${x} ${y+2} ${z-1} ${entity} run setblock ${x} ${y+2} ${z-1} air [] destroy`)
    player.runCommandAsync(`execute if block ${x+1} ${y+2} ${z-1} ${entity} run setblock ${x+1} ${y+2} ${z-1} air [] destroy`)
    player.runCommandAsync(`execute if block ${x+1} ${y+2} ${z+1} ${entity} run setblock ${x+1} ${y+2} ${z+1} air [] destroy`)
    player.runCommandAsync(`execute if block ${x-1} ${y+2} ${z-1} ${entity} run setblock ${x-1} ${y+2} ${z-1} air [] destroy`)
    player.runCommandAsync(`execute if block ${x-1} ${y+2} ${z+1} ${entity} run setblock ${x-1} ${y+2} ${z+1} air [] destroy`)
    player.runCommandAsync("tag @s remove dcima")
  }
  if (player.hasTag("norte_sul") == true) {
    player.runCommandAsync(`execute if block ${x} ${y+1} ${z} ${entity} run setblock ${x} ${y+1} ${z} air [] destroy`)
    player.runCommandAsync(`execute if block ${x} ${y-1} ${z} ${entity} run setblock ${x} ${y-1} ${z} air [] destroy`)
    
    player.runCommandAsync(`execute if block ${x+1} ${y+1} ${z} ${entity} run setblock ${x+1} ${y+1} ${z} air [] destroy`)
    player.runCommandAsync(`execute if block ${x+1} ${y} ${z} ${entity} run setblock ${x+1} ${y} ${z} air [] destroy`)
    player.runCommandAsync(`execute if block ${x+1} ${y-1} ${z} ${entity} run setblock ${x+1} ${y-1} ${z} air [] destroy`)
    
    player.runCommandAsync(`execute if block ${x-1} ${y+1} ${z} ${entity} run setblock ${x-1} ${y+1} ${z} air [] destroy`)
    player.runCommandAsync(`execute if block ${x-1} ${y} ${z} ${entity} run setblock ${x-1} ${y} ${z} air [] destroy`)
    player.runCommandAsync(`execute if block ${x-1} ${y-1} ${z} ${entity} run setblock ${x-1} ${y-1} ${z} air [] destroy`)
    player.runCommandAsync("tag @s remove norte_sul")
  }
  if (player.hasTag("dnorte") == true) {
    player.runCommandAsync(`execute if block ${x} ${y} ${z-1} ${entity} run setblock ${x} ${y} ${z-1} air [] destroy`)
    player.runCommandAsync(`execute if block ${x} ${y} ${z-2} ${entity} run setblock ${x} ${y} ${z-2} air [] destroy`)



    player.runCommandAsync(`execute if block ${x} ${y+1} ${z-1} ${entity} run setblock ${x} ${y+1} ${z-1} air [] destroy`)
    player.runCommandAsync(`execute if block ${x} ${y-1} ${z-1} ${entity} run setblock ${x} ${y-1} ${z-1} air [] destroy`)
    
    player.runCommandAsync(`execute if block ${x+1} ${y+1} ${z-1} ${entity} run setblock ${x+1} ${y+1} ${z-1} air [] destroy`)
    player.runCommandAsync(`execute if block ${x+1} ${y} ${z-1} ${entity} run setblock ${x+1} ${y} ${z-1} air [] destroy`)
    player.runCommandAsync(`execute if block ${x+1} ${y-1} ${z-1} ${entity} run setblock ${x+1} ${y-1} ${z-1} air [] destroy`)
    
    player.runCommandAsync(`execute if block ${x-1} ${y+1} ${z-1} ${entity} run setblock ${x-1} ${y+1} ${z-1} air [] destroy`)
    player.runCommandAsync(`execute if block ${x-1} ${y} ${z-1} ${entity} run setblock ${x-1} ${y} ${z-1} air [] destroy`)
    player.runCommandAsync(`execute if block ${x-1} ${y-1} ${z-1} ${entity} run setblock ${x-1} ${y-1} ${z-1} air [] destroy`)

    

    player.runCommandAsync(`execute if block ${x} ${y+1} ${z-2} ${entity} run setblock ${x} ${y+1} ${z-2} air [] destroy`)
    player.runCommandAsync(`execute if block ${x} ${y-1} ${z-2} ${entity} run setblock ${x} ${y-1} ${z-2} air [] destroy`)
    
    player.runCommandAsync(`execute if block ${x+1} ${y+1} ${z-2} ${entity} run setblock ${x+1} ${y+1} ${z-2} air [] destroy`)
    player.runCommandAsync(`execute if block ${x+1} ${y} ${z-2} ${entity} run setblock ${x+1} ${y} ${z-2} air [] destroy`)
    player.runCommandAsync(`execute if block ${x+1} ${y-1} ${z-2} ${entity} run setblock ${x+1} ${y-1} ${z-2} air [] destroy`)
    
    player.runCommandAsync(`execute if block ${x-1} ${y+1} ${z-2} ${entity} run setblock ${x-1} ${y+1} ${z-2} air [] destroy`)
    player.runCommandAsync(`execute if block ${x-1} ${y} ${z-2} ${entity} run setblock ${x-1} ${y} ${z-2} air [] destroy`)
    player.runCommandAsync(`execute if block ${x-1} ${y-1} ${z-2} ${entity} run setblock ${x-1} ${y-1} ${z-2} air [] destroy`)
    player.runCommandAsync("tag @s remove dnorte")
  }
  if (player.hasTag("dsul") == true) {
    player.runCommandAsync(`execute if block ${x} ${y} ${z+1} ${entity} run setblock ${x} ${y} ${z+1} air [] destroy`)
    player.runCommandAsync(`execute if block ${x} ${y} ${z+2} ${entity} run setblock ${x} ${y} ${z+2} air [] destroy`)

    player.runCommandAsync(`execute if block ${x} ${y+1} ${z+1} ${entity} run setblock ${x} ${y+1} ${z+1} air [] destroy`)
    player.runCommandAsync(`execute if block ${x} ${y-1} ${z+1} ${entity} run setblock ${x} ${y-1} ${z+1} air [] destroy`)
    
    player.runCommandAsync(`execute if block ${x+1} ${y+1} ${z+1} ${entity} run setblock ${x+1} ${y+1} ${z+1} air [] destroy`)
    player.runCommandAsync(`execute if block ${x+1} ${y} ${z+1} ${entity} run setblock ${x+1} ${y} ${z+1} air [] destroy`)
    player.runCommandAsync(`execute if block ${x+1} ${y-1} ${z+1} ${entity} run setblock ${x+1} ${y-1} ${z+1} air [] destroy`)
    
    player.runCommandAsync(`execute if block ${x-1} ${y+1} ${z+1} ${entity} run setblock ${x-1} ${y+1} ${z+1} air [] destroy`)
    player.runCommandAsync(`execute if block ${x-1} ${y} ${z+1} ${entity} run setblock ${x-1} ${y} ${z+1} air [] destroy`)
    player.runCommandAsync(`execute if block ${x-1} ${y-1} ${z+1} ${entity} run setblock ${x-1} ${y-1} ${z+1} air [] destroy`)

    

    player.runCommandAsync(`execute if block ${x} ${y+1} ${z+2} ${entity} run setblock ${x} ${y+1} ${z+2} air [] destroy`)
    player.runCommandAsync(`execute if block ${x} ${y-1} ${z+2} ${entity} run setblock ${x} ${y-1} ${z+2} air [] destroy`)
    
    player.runCommandAsync(`execute if block ${x+1} ${y+1} ${z+2} ${entity} run setblock ${x+1} ${y+1} ${z+2} air [] destroy`)
    player.runCommandAsync(`execute if block ${x+1} ${y} ${z+2} ${entity} run setblock ${x+1} ${y} ${z+2} air [] destroy`)
    player.runCommandAsync(`execute if block ${x+1} ${y-1} ${z+2} ${entity} run setblock ${x+1} ${y-1} ${z+2} air [] destroy`)
    
    player.runCommandAsync(`execute if block ${x-1} ${y+1} ${z+2} ${entity} run setblock ${x-1} ${y+1} ${z+2} air [] destroy`)
    player.runCommandAsync(`execute if block ${x-1} ${y} ${z+2} ${entity} run setblock ${x-1} ${y} ${z+2} air [] destroy`)
    player.runCommandAsync(`execute if block ${x-1} ${y-1} ${z+2} ${entity} run setblock ${x-1} ${y-1} ${z+2} air [] destroy`)
    player.runCommandAsync("tag @s remove dsul")
  }
  if (player.hasTag("leste_oeste") == true) {
    player.runCommandAsync(`execute if block ${x} ${y+1} ${z} ${entity} run setblock ${x} ${y+1} ${z} air [] destroy`)
    player.runCommandAsync(`execute if block ${x} ${y-1} ${z} ${entity} run setblock ${x} ${y-1} ${z} air [] destroy`)
    
    player.runCommandAsync(`execute if block ${x} ${y+1} ${z+1} ${entity} run setblock ${x} ${y+1} ${z+1} air [] destroy`)
    player.runCommandAsync(`execute if block ${x} ${y} ${z+1} ${entity} run setblock ${x} ${y} ${z+1} air [] destroy`)
    player.runCommandAsync(`execute if block ${x} ${y-1} ${z+1} ${entity} run setblock ${x} ${y-1} ${z+1} air [] destroy`)
    player.runCommandAsync(`execute if block ${x} ${y+1} ${z-1} ${entity} run setblock ${x} ${y+1} ${z-1} air [] destroy`)
    player.runCommandAsync(`execute if block ${x} ${y} ${z-1} ${entity} run setblock ${x} ${y} ${z-1} air [] destroy`)
    player.runCommandAsync(`execute if block ${x} ${y-1} ${z-1} ${entity} run setblock ${x} ${y-1} ${z-1} air [] destroy`)
    player.runCommandAsync("tag @s remove leste_oeste")
  }
  if (player.hasTag("dleste") == true) {
    player.runCommandAsync(`execute if block ${x+1} ${y} ${z} ${entity} run setblock ${x+1} ${y} ${z} air [] destroy`)
    player.runCommandAsync(`execute if block ${x+2} ${y} ${z} ${entity} run setblock ${x+2} ${y} ${z} air [] destroy`)


    player.runCommandAsync(`execute if block ${x+1} ${y+1} ${z} ${entity} run setblock ${x+1} ${y+1} ${z} air [] destroy`)
    player.runCommandAsync(`execute if block ${x+1} ${y-1} ${z} ${entity} run setblock ${x+1} ${y-1} ${z} air [] destroy`)
    
    player.runCommandAsync(`execute if block ${x+1} ${y+1} ${z+1} ${entity} run setblock ${x+1} ${y+1} ${z+1} air [] destroy`)
    player.runCommandAsync(`execute if block ${x+1} ${y} ${z+1} ${entity} run setblock ${x+1} ${y} ${z+1} air [] destroy`)
    player.runCommandAsync(`execute if block ${x+1} ${y-1} ${z+1} ${entity} run setblock ${x+1} ${y-1} ${z+1} air [] destroy`)
    player.runCommandAsync(`execute if block ${x+1} ${y+1} ${z-1} ${entity} run setblock ${x+1} ${y+1} ${z-1} air [] destroy`)
    player.runCommandAsync(`execute if block ${x+1} ${y} ${z-1} ${entity} run setblock ${x+1} ${y} ${z-1} air [] destroy`)
    player.runCommandAsync(`execute if block ${x+1} ${y-1} ${z-1} ${entity} run setblock ${x+1} ${y-1} ${z-1} air [] destroy`)


    player.runCommandAsync(`execute if block ${x+2} ${y+1} ${z} ${entity} run setblock ${x+2} ${y+1} ${z} air [] destroy`)
    player.runCommandAsync(`execute if block ${x+2} ${y-1} ${z} ${entity} run setblock ${x+2} ${y-1} ${z} air [] destroy`)
    
    player.runCommandAsync(`execute if block ${x+2} ${y+1} ${z+1} ${entity} run setblock ${x+2} ${y+1} ${z+1} air [] destroy`)
    player.runCommandAsync(`execute if block ${x+2} ${y} ${z+1} ${entity} run setblock ${x+2} ${y} ${z+1} air [] destroy`)
    player.runCommandAsync(`execute if block ${x+2} ${y-1} ${z+1} ${entity} run setblock ${x+2} ${y-1} ${z+1} air [] destroy`)
    player.runCommandAsync(`execute if block ${x+2} ${y+1} ${z-1} ${entity} run setblock ${x+2} ${y+1} ${z-1} air [] destroy`)
    player.runCommandAsync(`execute if block ${x+2} ${y} ${z-1} ${entity} run setblock ${x+2} ${y} ${z-1} air [] destroy`)
    player.runCommandAsync(`execute if block ${x+2} ${y-1} ${z-1} ${entity} run setblock ${x+2} ${y-1} ${z-1} air [] destroy`)
    player.runCommandAsync("tag @s remove dleste")
  }
  if (player.hasTag("doeste") == true) {
    player.runCommandAsync(`execute if block ${x-1} ${y} ${z} ${entity} run setblock ${x-1} ${y} ${z} air [] destroy`)
    player.runCommandAsync(`execute if block ${x-2} ${y} ${z} ${entity} run setblock ${x-2} ${y} ${z} air [] destroy`)

    player.runCommandAsync(`execute if block ${x-1} ${y+1} ${z} ${entity} run setblock ${x-1} ${y+1} ${z} air [] destroy`)
    player.runCommandAsync(`execute if block ${x-1} ${y-1} ${z} ${entity} run setblock ${x-1} ${y-1} ${z} air [] destroy`)
    
    player.runCommandAsync(`execute if block ${x-1} ${y+1} ${z+1} ${entity} run setblock ${x-1} ${y+1} ${z+1} air [] destroy`)
    player.runCommandAsync(`execute if block ${x-1} ${y} ${z+1} ${entity} run setblock ${x-1} ${y} ${z+1} air [] destroy`)
    player.runCommandAsync(`execute if block ${x-1} ${y-1} ${z+1} ${entity} run setblock ${x-1} ${y-1} ${z+1} air [] destroy`)
    player.runCommandAsync(`execute if block ${x-1} ${y+1} ${z-1} ${entity} run setblock ${x-1} ${y+1} ${z-1} air [] destroy`)
    player.runCommandAsync(`execute if block ${x-1} ${y} ${z-1} ${entity} run setblock ${x-1} ${y} ${z-1} air [] destroy`)
    player.runCommandAsync(`execute if block ${x-1} ${y-1} ${z-1} ${entity} run setblock ${x-1} ${y-1} ${z-1} air [] destroy`)


    player.runCommandAsync(`execute if block ${x-2} ${y+1} ${z} ${entity} run setblock ${x-2} ${y+1} ${z} air [] destroy`)
    player.runCommandAsync(`execute if block ${x-2} ${y-1} ${z} ${entity} run setblock ${x-2} ${y-1} ${z} air [] destroy`)
    
    player.runCommandAsync(`execute if block ${x-2} ${y+1} ${z+1} ${entity} run setblock ${x-2} ${y+1} ${z+1} air [] destroy`)
    player.runCommandAsync(`execute if block ${x-2} ${y} ${z+1} ${entity} run setblock ${x-2} ${y} ${z+1} air [] destroy`)
    player.runCommandAsync(`execute if block ${x-2} ${y-1} ${z+1} ${entity} run setblock ${x-2} ${y-1} ${z+1} air [] destroy`)
    player.runCommandAsync(`execute if block ${x-2} ${y+1} ${z-1} ${entity} run setblock ${x-2} ${y+1} ${z-1} air [] destroy`)
    player.runCommandAsync(`execute if block ${x-2} ${y} ${z-1} ${entity} run setblock ${x-2} ${y} ${z-1} air [] destroy`)
    player.runCommandAsync(`execute if block ${x-2} ${y-1} ${z-1} ${entity} run setblock ${x-2} ${y-1} ${z-1} air [] destroy`)
    player.runCommandAsync("tag @s remove doeste")
  }
}
if (player.getComponent("minecraft:inventory").container.getItem(player.selectedSlot).typeId.endsWith('drill') == true && player.getComponent("minecraft:inventory").container.getItem(player.selectedSlot).typeId.startsWith('skilleditems') == true) {
  const x = sla.block.location["x"]
    const y = sla.block.location["y"]
    const z = sla.block.location["z"]
    if (player.hasTag("baixo") == true) {
      player.runCommandAsync(`execute if block ${x} ${y} ${z+1} ${entity} run setblock ${x} ${y} ${z+1} air [] destroy`)
      player.runCommandAsync(`execute if block ${x} ${y} ${z-1} ${entity} run setblock ${x} ${y} ${z-1} air [] destroy`)
      player.runCommandAsync(`execute if block ${x} ${y} ${z+1} ${entity} run setblock ${x} ${y} ${z+1} air [] destroy`)
      player.runCommandAsync(`execute if block ${x+1} ${y} ${z} ${entity} run setblock ${x+1} ${y} ${z} air [] destroy`)
      player.runCommandAsync(`execute if block ${x-1} ${y} ${z} ${entity} run setblock ${x-1} ${y} ${z} air [] destroy`)
      player.runCommandAsync(`tag @s remove baixo`)
}
if (player.hasTag("dbaixo") == true) {
  player.runCommandAsync(`execute if block ${x} ${y-1} ${z} ${entity} run setblock ${x} ${y-1} ${z} air [] destroy`)
  player.runCommandAsync(`execute if block ${x} ${y-2} ${z} ${entity} run setblock ${x} ${y-2} ${z} air [] destroy`)


  player.runCommandAsync(`execute if block ${x} ${y-1} ${z+1} ${entity} run setblock ${x} ${y-1} ${z+1} air [] destroy`)
  player.runCommandAsync(`execute if block ${x} ${y-1} ${z-1} ${entity} run setblock ${x} ${y-1} ${z-1} air [] destroy`)
  player.runCommandAsync(`execute if block ${x} ${y-1} ${z+1} ${entity} run setblock ${x} ${y-1} ${z+1} air [] destroy`)
  player.runCommandAsync(`execute if block ${x+1} ${y-1} ${z} ${entity} run setblock ${x+1} ${y-1} ${z} air [] destroy`)
  player.runCommandAsync(`execute if block ${x-1} ${y-1} ${z} ${entity} run setblock ${x-1} ${y-1} ${z} air [] destroy`)

  player.runCommandAsync(`execute if block ${x} ${y-2} ${z+1} ${entity} run setblock ${x} ${y-2} ${z+1} air [] destroy`)
  player.runCommandAsync(`execute if block ${x} ${y-2} ${z-1} ${entity} run setblock ${x} ${y-2} ${z-1} air [] destroy`)
  player.runCommandAsync(`execute if block ${x} ${y-2} ${z+1} ${entity} run setblock ${x} ${y-2} ${z+1} air [] destroy`)
  player.runCommandAsync(`execute if block ${x+1} ${y-2} ${z} ${entity} run setblock ${x+1} ${y-2} ${z} air [] destroy`)
  player.runCommandAsync(`execute if block ${x-1} ${y-2} ${z} ${entity} run setblock ${x-1} ${y-2} ${z} air [] destroy`)
  player.runCommandAsync(`tag @s remove dbaixo`)
}
if (player.hasTag("dcima") == true) {
player.runCommandAsync(`execute if block ${x} ${y+1} ${z} ${entity} run setblock ${x} ${y+1} ${z} air [] destroy`)
  player.runCommandAsync(`execute if block ${x} ${y+2} ${z} ${entity} run setblock ${x} ${y+2} ${z} air [] destroy`)


  player.runCommandAsync(`execute if block ${x} ${y+1} ${z+1} ${entity} run setblock ${x} ${y-1} ${z+1} air [] destroy`)
  player.runCommandAsync(`execute if block ${x} ${y+1} ${z-1} ${entity} run setblock ${x} ${y-1} ${z-1} air [] destroy`)
  player.runCommandAsync(`execute if block ${x} ${y-1} ${z+1} ${entity} run setblock ${x} ${y-1} ${z+1} air [] destroy`)
  player.runCommandAsync(`execute if block ${x+1} ${y-1} ${z} ${entity} run setblock ${x+1} ${y-1} ${z} air [] destroy`)
  player.runCommandAsync(`execute if block ${x-1} ${y-1} ${z} ${entity} run setblock ${x-1} ${y-1} ${z} air [] destroy`)

  player.runCommandAsync(`execute if block ${x} ${y-2} ${z+1} ${entity} run setblock ${x} ${y-2} ${z+1} air [] destroy`)
  player.runCommandAsync(`execute if block ${x} ${y-2} ${z-1} ${entity-2} run setblock ${x} ${y-2} ${z-1} air [] destroy`)
  player.runCommandAsync(`execute if block ${x} ${y-2} ${z+1} ${entity-2} run setblock ${x} ${y-2} ${z+1} air [] destroy`)
  player.runCommandAsync(`execute if block ${x+1} ${y-2} ${z} ${entity-2} run setblock ${x+1} ${y-2} ${z} air [] destroy`)
  player.runCommandAsync(`execute if block ${x-1} ${y-2} ${z} ${entity-2} run setblock ${x-1} ${y-2} ${z} air [] destroy`)
  player.runCommandAsync(`tag @s remove dcima`)
}
if (player.hasTag("norte_sul") == true) {
     player.runCommandAsync(`execute if block ${x} ${y+1} ${z} ${entity} run setblock ${x} ${y+1} ${z} air [] destroy`)
      player.runCommandAsync(`execute if block ${x} ${y-1} ${z} ${entity} run setblock ${x} ${y-1} ${z} air [] destroy`)
      
      player.runCommandAsync(`execute if block ${x+1} ${y} ${z} ${entity} run setblock ${x+1} ${y} ${z} air [] destroy`)
      player.runCommandAsync(`execute if block ${x-1} ${y} ${z} ${entity} run setblock ${x-1} ${y} ${z} air [] destroy`)

      
      player.runCommandAsync(`tag @s remove norte_sul`)
  
}
if (player.hasTag("dsul") == true) {
  player.runCommandAsync(`execute if block ${x} ${y} ${z+1} ${entity} run setblock ${x} ${y} ${z+1} air [] destroy`)
  player.runCommandAsync(`execute if block ${x} ${y} ${z+2} ${entity} run setblock ${x} ${y} ${z+2} air [] destroy`)

  player.runCommandAsync(`execute if block ${x} ${y+1} ${z+1} ${entity} run setblock ${x} ${y+1} ${z+1} air [] destroy`)
   player.runCommandAsync(`execute if block ${x} ${y-1} ${z+1} ${entity} run setblock ${x} ${y-1} ${z+1} air [] destroy`)
  
   player.runCommandAsync(`execute if block ${x+1} ${y} ${z+1} ${entity} run setblock ${x+1} ${y} ${z+1} air [] destroy`)
   player.runCommandAsync(`execute if block ${x-1} ${y} ${z+1} ${entity} run setblock ${x-1} ${y} ${z+1} air [] destroy`)

   player.runCommandAsync(`execute if block ${x} ${y+1} ${z+2} ${entity} run setblock ${x} ${y+1} ${z+2} air [] destroy`)
   player.runCommandAsync(`execute if block ${x} ${y-1} ${z+2} ${entity} run setblock ${x} ${y-1} ${z+2} air [] destroy`)
  
   player.runCommandAsync(`execute if block ${x+1} ${y} ${z+2} ${entity} run setblock ${x+1} ${y} ${z+2} air [] destroy`)
   player.runCommandAsync(`execute if block ${x-1} ${y} ${z+2} ${entity} run setblock ${x-1} ${y} ${z+2} air [] destroy`)
   player.runCommandAsync(`tag @s remove dsul`)

}
if (player.hasTag("dnorte") == true) {
  player.runCommandAsync(`execute if block ${x} ${y} ${z-1} ${entity} run setblock ${x} ${y} ${z-1} air [] destroy`)
  player.runCommandAsync(`execute if block ${x} ${y} ${z-2} ${entity} run setblock ${x} ${y} ${z-2} air [] destroy`)

  player.runCommandAsync(`execute if block ${x} ${y+1} ${z-1} ${entity} run setblock ${x} ${y+1} ${z-1} air [] destroy`)
   player.runCommandAsync(`execute if block ${x} ${y-1} ${z-1} ${entity} run setblock ${x} ${y-1} ${z-1} air [] destroy`)
  
   player.runCommandAsync(`execute if block ${x+1} ${y} ${z-1} ${entity} run setblock ${x+1} ${y} ${z-1} air [] destroy`)
   player.runCommandAsync(`execute if block ${x-1} ${y} ${z-1} ${entity} run setblock ${x-1} ${y} ${z-1} air [] destroy`)

   player.runCommandAsync(`execute if block ${x} ${y+1} ${z-2} ${entity} run setblock ${x} ${y+1} ${z-2} air [] destroy`)
   player.runCommandAsync(`execute if block ${x} ${y-1} ${z-2} ${entity} run setblock ${x} ${y-1} ${z-2} air [] destroy`)
  
   player.runCommandAsync(`execute if block ${x+1} ${y} ${z-2} ${entity} run setblock ${x+1} ${y} ${z-2} air [] destroy`)
   player.runCommandAsync(`execute if block ${x-1} ${y} ${z-2} ${entity} run setblock ${x-1} ${y} ${z-2} air [] destroy`)
   player.runCommandAsync(`tag @s remove dnorte`)

}
if (player.hasTag("leste_oeste") == true) {
     player.runCommandAsync(`execute if block ${x} ${y+1} ${z} ${entity} run setblock ${x} ${y+1} ${z} air [] destroy`)
      player.runCommandAsync(`execute if block ${x} ${y-1} ${z} ${entity} run setblock ${x} ${y-1} ${z} air [] destroy`)
      
      player.runCommandAsync(`execute if block ${x} ${y} ${z+1} ${entity} run setblock ${x} ${y} ${z+1} air [] destroy`)
      player.runCommandAsync(`execute if block ${x} ${y} ${z-1} ${entity} run setblock ${x} ${y} ${z-1} air [] destroy`)
      
      player.runCommandAsync(`tag @s remove leste_oeste`)
  
}
if (player.hasTag("doeste") == true) {
  player.runCommandAsync(`execute if block ${x-1} ${y} ${z} ${entity} run setblock ${x-1} ${y} ${z} air [] destroy`)
  player.runCommandAsync(`execute if block ${x-2} ${y} ${z} ${entity} run setblock ${x-2} ${y} ${z} air [] destroy`)

  player.runCommandAsync(`execute if block ${x-1} ${y+1} ${z} ${entity} run setblock ${x-1} ${y+1} ${z} air [] destroy`)
   player.runCommandAsync(`execute if block ${x-1} ${y-1} ${z} ${entity} run setblock ${x-1} ${y-1} ${z} air [] destroy`)
   
   player.runCommandAsync(`execute if block ${x-1} ${y} ${z+1} ${entity} run setblock ${x-1} ${y} ${z+1} air [] destroy`)
   player.runCommandAsync(`execute if block ${x-1} ${y} ${z-1} ${entity} run setblock ${x-1} ${y} ${z-1} air [] destroy`)

   player.runCommandAsync(`execute if block ${x-2} ${y+1} ${z} ${entity} run setblock ${x-2} ${y+1} ${z} air [] destroy`)
   player.runCommandAsync(`execute if block ${x-2} ${y-1} ${z} ${entity} run setblock ${x-2} ${y-1} ${z} air [] destroy`)
   
   player.runCommandAsync(`execute if block ${x-2} ${y} ${z+1} ${entity} run setblock ${x-2} ${y} ${z+1} air [] destroy`)
   player.runCommandAsync(`execute if block ${x-2} ${y} ${z-1} ${entity} run setblock ${x-2} ${y} ${z-1} air [] destroy`)
   
   player.runCommandAsync(`tag @s remove doeste`)

}
if (player.hasTag("dleste") == true) {
  player.runCommandAsync(`execute if block ${x+1} ${y} ${z} ${entity} run setblock ${x+1} ${y} ${z} air [] destroy`)
  player.runCommandAsync(`execute if block ${x+2} ${y} ${z} ${entity} run setblock ${x+2} ${y} ${z} air [] destroy`)

  player.runCommandAsync(`execute if block ${x+1} ${y+1} ${z} ${entity} run setblock ${x+1} ${y+1} ${z} air [] destroy`)
   player.runCommandAsync(`execute if block ${x+1} ${y-1} ${z} ${entity} run setblock ${x+1} ${y-1} ${z} air [] destroy`)
   
   player.runCommandAsync(`execute if block ${x+1} ${y} ${z+1} ${entity} run setblock ${x+1} ${y} ${z+1} air [] destroy`)
   player.runCommandAsync(`execute if block ${x+1} ${y} ${z-1} ${entity} run setblock ${x+1} ${y} ${z-1} air [] destroy`)

   player.runCommandAsync(`execute if block ${x+2} ${y+1} ${z} ${entity} run setblock ${x+2} ${y+1} ${z} air [] destroy`)
   player.runCommandAsync(`execute if block ${x+2} ${y-1} ${z} ${entity} run setblock ${x+2} ${y-1} ${z} air [] destroy`)
   
   player.runCommandAsync(`execute if block ${x+2} ${y} ${z+1} ${entity} run setblock ${x+2} ${y} ${z+1} air [] destroy`)
   player.runCommandAsync(`execute if block ${x+2} ${y} ${z-1} ${entity} run setblock ${x+2} ${y} ${z-1} air [] destroy`)
   
   player.runCommandAsync(`tag @s remove dleste`)

}

}
})
system.afterEvents.scriptEventReceive.subscribe(data => {
  const player = data.sourceEntity
  if (data.id == "blayy:skbook") {
   book.show(player).then(salada => {
     if (salada.selection == 0) {
       anvil.show(player).then(chinelo => {
         if (chinelo.selection == 0) {
           player.runCommandAsync("scriptevent blayy:skbook")
         }
       })
     }
     if (salada.selection == 1) {
       skills.show(player).then(chinelo => {
         if (chinelo.selection == 0) {
           player.runCommandAsync("scriptevent blayy:skbook")
         }
       })
       
     }
     if (salada.selection == 2) {
       rituals.show(player).then(chinelo => {
         if (chinelo.selection == 0) {
           player.runCommandAsync("scriptevent blayy:skbook")
         }
       })
       
     }
     if (salada.selection == 3) {
       items.show(player).then(chinelo => {
         if (chinelo.selection == 0) {
           player.runCommandAsync("scriptevent blayy:skbook")
         }
       })
       
     }
     if (salada.selection == 4) {
       boss.show(player).then(chinelo => {
         if (chinelo.selection == 0) {
           player.runCommandAsync("scriptevent blayy:skbook")
         }
       })
       
     }
   })

}

})
world.afterEvents.chatSend.subscribe(data => {
  if (data.message == ".dvt") {
    if (data.sender.hasTag("dvt") == true) {
      data.sender.removeTag("dvt")
      data.sender.runCommandAsync("say activated")
    }else{
      data.sender.addTag("dvt")
      data.sender.runCommandAsync("say deactivated")
    }
  }
})