## RUN BY ldz:dungeon_lever
## RUN FROM animation.dungeon_lever.duplication_check

#scoreboard objectives setdisplay sidebar DungeonLever

execute as @s[family=portal_room_lever] run scoreboard players add @e[family=portal_room_lever] DungeonLever 0
execute as @s[family=beast_lever_hub] run scoreboard players add @e[family=beast_lever_hub] DungeonLever 0
execute as @s[family=mystic_lever_hub] run scoreboard players add @e[family=mystic_lever_hub] DungeonLever 0
execute as @s[family=scourge_lever_hub] run scoreboard players add @e[family=scourge_lever_hub] DungeonLever 0
execute as @s[family=wraith_lever_hub] run scoreboard players add @e[family=wraith_lever_hub] DungeonLever 0
execute as @s[family=beast_lever_dungeon] run scoreboard players add @e[family=beast_lever_dungeon] DungeonLever 0
execute as @s[family=mystic_lever_dungeon] run scoreboard players add @e[family=mystic_lever_dungeon] DungeonLever 0
execute as @s[family=scourge_lever_dungeon] run scoreboard players add @e[family=scourge_lever_dungeon] DungeonLever 0
execute as @s[family=wraith_lever_dungeon] run scoreboard players add @e[family=wraith_lever_dungeon] DungeonLever 0

execute as @e[type=ldz:dungeon_lever,scores={DungeonLever=0}] run event entity @s despawn

scoreboard players add @s[scores={DungeonLever=1..}] DungeonLever 1
execute as @s[scores={DungeonLever=3..}] run event entity @s remove_duplication_check_toggle

setblock ~ ~ ~ air

execute at @s[family=beast_lever_dungeon] run setblock ~ ~-1 ~ ldz:ender_copper
execute at @s[family=mystic_lever_dungeon] run setblock ~ ~-1 ~ ldz:ender_copper
execute at @s[family=scourge_lever_dungeon] run setblock ~ ~-1 ~ ldz:ender_copper
execute at @s[family=wraith_lever_dungeon] run setblock ~ ~-1 ~ ldz:ender_copper