Après l'optimisation existe @Yakuro_ :)
Voila , j'ai mis 2 items pour bien te montrer
variables:
{menu.beacon.%player%} = 1
{menu.star.%player%} = 1
command /menu [<text>] [<text>]:
trigger:
if arg 1 is not set:
open chest with 3 rows named "&9➤ &4&lMenu" to player
wait 3 tick
format slot 26 of player with redstone block named "&4Quitter" to close
if {menu.beacon.%player%} = "1":
format slot 0 of player with beacon named "&eBeacon test" with lore "||&a[On]" to run [make player execute command "/menu beacon 2"]
else:
format slot 0 of player with beacon named "&eBeacon test" with lore "||&c[Off]" to run [make player execute command "/menu beacon 1"]
if {menu.star.%player%} = "1":
format slot 2 of player with nether star named "&eBeacon test" with lore "||&a[On]" to run [make player execute command "/menu star 2"]
else:
format slot 2 of player with nether star named "&eBeacon test" with lore "||&c[Off]" to run [make player execute command "/menu star 1"]
else:
if arg 2 is set:
set {menu.%arg 1%.%player%} to "%arg 2%"
close player's inventory
make player execute command "/menu"