Security Gate

A Security Gate that you can use to ensure no players come with scary items!

Supported Versions:

1.21.10+26.1+

Commands by Row:

Row 1

1. [repeat] /execute as @e[type=item] at @s if entity @e[tag=itemSecurity,distance=..0.75] run tp @s ~ ~ ~.1
2. [chain] /execute as @e[type=item] at @s if entity @e[tag=itemSecurityCatcher,distance=..0.75] if items entity @s container.* #minecraft:enchantable/weapon run tp @s ~-3 ~ ~

Row 2

3. [repeat] /execute as @a at @s if entity @e[tag=playerSecurity,distance=..1] if data entity @s Inventory[] run execute as @e[tag=playerSecurity,distance=..1] at @s run setblock ^ ^ ^-1 minecraft:barrier
4. [chain] /execute as @a at @s if entity @e[tag=playerSecurity,distance=..1] if data entity @s equipment{} run execute as @e[tag=playerSecurity,distance=..1] at @s run setblock ^ ^ ^-1 minecraft:barrier
5. [chain] /execute as @e[tag=playerSecurity] at @s unless entity @p[distance=..1] unless block ^ ^ ^-1 air run setblock ^ ^ ^-1 air

Preview

repeat
chain
repeat
chain
chain

Video

Too lazy to copy and paste each command?