#event entity @e[type=ldz:magic_barrier] despawn

scoreboard objectives remove MagicBarrier
scoreboard objectives remove MagicBarrierDB
scoreboard objectives remove MagicBarrierDM
scoreboard objectives remove MagicBarrierDS
scoreboard objectives remove MagicBarrierDW
scoreboard objectives add MagicBarrier dummy
scoreboard objectives add MagicBarrierDB dummy
scoreboard objectives add MagicBarrierDM dummy
scoreboard objectives add MagicBarrierDS dummy
scoreboard objectives add MagicBarrierDW dummy

summon ldz:magic_barrier ~ ~ ~ 0 0 portal_room_barrier
summon ldz:magic_barrier ~ ~ ~ 0 0 beast_hub_barrier
summon ldz:magic_barrier ~ ~ ~ 0 0 mystic_hub_barrier
summon ldz:magic_barrier ~ ~ ~ 0 0 scourge_hub_barrier
summon ldz:magic_barrier ~ ~ ~ 0 0 wraith_hub_barrier

scoreboard players add @e[type=ldz:magic_barrier,r=2] MagicBarrier 1

summon ldz:magic_barrier ~ ~ ~ 0 0 beast_dungeon_barrier
summon ldz:magic_barrier ~ ~ ~ 0 0 mystic_dungeon_barrier
summon ldz:magic_barrier ~ ~ ~ 0 0 scourge_dungeon_barrier
summon ldz:magic_barrier ~ ~ ~ 0 0 wraith_dungeon_barrier

scoreboard players add @e[type=ldz:magic_barrier,family=beast_dungeon_barrier,r=2] MagicBarrierDB 1
scoreboard players add @e[type=ldz:magic_barrier,family=mystic_dungeon_barrier,r=2] MagicBarrierDM 1
scoreboard players add @e[type=ldz:magic_barrier,family=scourge_dungeon_barrier,r=2] MagicBarrierDS 1
scoreboard players add @e[type=ldz:magic_barrier,family=wraith_dungeon_barrier,r=2] MagicBarrierDW 1


teleport @e[type=ldz:magic_barrier,family=portal_room_barrier] 104 167 53
teleport @e[type=ldz:magic_barrier,family=beast_hub_barrier] 104 149 15
teleport @e[type=ldz:magic_barrier,family=mystic_hub_barrier] 78 157 31
teleport @e[type=ldz:magic_barrier,family=scourge_hub_barrier] 104 149 47
teleport @e[type=ldz:magic_barrier,family=wraith_hub_barrier] 130 157 31
teleport @e[type=ldz:magic_barrier,family=beast_dungeon_barrier] 82 153 -480
teleport @e[type=ldz:magic_barrier,family=mystic_dungeon_barrier] -529 167 -159
teleport @e[type=ldz:magic_barrier,family=scourge_dungeon_barrier] 29 165 446
teleport @e[type=ldz:magic_barrier,family=wraith_dungeon_barrier] 591 166 50

scoreboard objectives remove BeastBarrier
scoreboard objectives remove MysticBarrier
scoreboard objectives remove ScourgeBarrier
scoreboard objectives remove WraithBarrier