Bon voilà je t'ai fait un truc mais bon c'est pas vraiment optimiser et le "walk on blue wool" ne marche pas parfaitement bien:
command /jl <text>:
permission: jl.admin
trigger:
if arg 1 is "start":
if {jl.game} is not set:
set {jl.game} to true
wait 5 minutes
loop {jl.block::*}:
set block at loop-value to blue wool
loop {jl.chest::*}:
set block at loop-value to chest
delete {jl.block::*}
delete {jl.chest::*}
message "BLOCK REGEN" to all players
else:
message "La partie est deja en cours" to player
else if arg 1 is "stop":
if {jl.game} is set:
loop {jl.block::*}:
set block at loop-value to blue wool
delete {jl.game}
delete {jl.block::*}
delete {jl.chest::*}
else:
message "La partie n'a pas commencé" to player
else if arg 1 is "itemlist":
jlitemmodify(player)
on walk on blue wool:
if {jl.game} is set:
if player is in world "world":
if block under player is blue wool: #essay de trouver un autre moyen car c assez buguer
set block under player to stone
add location of block under player to {jl.block::*}
on right click on chest:
if {jl.game} is set:
if player is in world "world":
loop {jl.chest::*}:
if location of clicked block is equal to loop-value:
stop
add location of clicked block to {jl.chest::*}
loop 5 times:
set {_r} to random element out of {jl.itemlist::*}
add a random item out of {_r} to the targeted block's inventory
function jlitemmodify(p: player):
close {_p}'s inventory
open virtual chest inventory with size 6 with name "&lItem dans coffre" to {_p}
set {_i} to 0
loop 45 times:
make a gui slot {_i} of {_p} with {jl.itemlist::%{_i}%} to run:
delete {jl.itemlist::%{_i}%}
jlitemmodify({_p})
add 1 to {_i}
make a gui slot 45, 46, 47, 48, 50, 51, 52 and 53 of {_p} with 1 gray stained glass pane named "&f"
make a gui slot 49 of {_p} with 1 emerald block named "&a&lValider" to run:
delete {jl.itemlist::*}
set {_i} to 0
loop 45 times:
if slot {_i} of {_p}'s current inventory is not a gray stained glass pane or a emerald block or air:
set {jl.itemlist::%{_i}%} to slot {_i} of {_p}'s current inventory
give slot {_i} of {_p}'s current inventory to {_p}
add 1 to {_i}
close {_p}'s inventory
/jl start : commencer le jeu
/jl stop : arrêter le jeu
/jl itemlist : ouvre un gui où tu peux mettre les items qui seront mis aléatoirement quand tu ouvre un coffre
et le "loop 5 times:" c'est le nombre de fois où des items seront rajouter dans un coffre.
Et IMPORTANT il te faut Tuske