Et voila !
Bref je t'explique :
J'ai une commande générale /randomchest avec la permission : randomchest.use
Il y a 6 premiers arguments : "Additem" pour ajouter une item
"Addchest" pour ajouter une position de coffre
"Removeliste" pour supprimer les items et positions des coffres
"View" pour voir les items (dans un gui)
"SpawnChest" pour forcer le spawn d'un chest
"Info" pour avoir toute les infos, nombre de coffre et nombre d'item de chaque serie
Il y a 5 argument 2 : normal, A, medicals, rare, militaire
Voila ! Tu dois à chaque fois rentrer l'argument 1 (L'action à faire) et l'argument 2 (La serie de coffre visée) à part pour "info" il n'y a pas besoin de mettre une second argument !
Bref , Optimisation au top <3 ! Aucun bug chez moi ! Addons basique (SkQuery,Umbaska)
Au moindre problème , appelle moi !
command /randomchest [<text>] [<text>]:
permission: randomchest.use
trigger:
if arg 1 is not set:
message "&8[&cRandomChest&8] &3/randomchest &3<additem>&7/&3<removelist>&7/&3<addchest>&7/&3<view>&7/&3<spawnchest>&7/&3<info>"
else:
if arg 1 is not "additem" or "addchest" or "view" or "removelist" or "info" or "spawnchest":
message "&8[&cRandomChest&8] &3/randomchest &3<additem>&7/&3<removelist>&7/&3<addchest>&7/&3<view>&7/&3<spawnchest>&7/&3<info>"
stop
else:
if arg 1 is "info":
message "&8[&cRandomChest&8] &eVoici les informations sur les &c5 &elistes !"
set {_list::*} to "a" and "militaire" and "rare" and "medicals" and "normal"
loop {_list::*}:
set {_info1} to size of {RandomChest.%loop-value%::*}
if {_info1} is not set:
set {_info1} to "Aucun"
set {_info2} to size of {randomchest.location.%loop-value%::*}
if {_info2} is not set:
set {_info2} to "Aucun"
message "&e- &c%loop-value% &9➤ &c%{_info1}% &eitem(s) &7| &c%{_info2}% &ecoffre(s)"
stop
if arg 2 is "normal" or "medicals" or "rare" or "militaire" or "A":
if arg 1 is "additem":
if player's tool is not air:
set {_p} to player's tool
set {_nbr} to amount of the tool of the player
message "&8[&cRandomChest&8] &3Vous avez ajouté &c%{_p}% &3à la liste &c%arg 2%"
add {_p} to {RandomChest.%arg 2%::*}
else:
message "&8[&cRandomChest&8] &cVous devez tenir un item en main !"
if arg 1 is "view":
open chest with 6 rows named "&cChest &9➤ &c%arg 2%" to player
wait 3 tick
set {_nbr} to 0
loop {RandomChest.%arg 2%::*}:
format slot {_nbr} of player with loop-value named "&3%loop-value%" to be unstealable
add 1 to {_nbr}
if arg 1 is "addchest":
add location of player to {randomchest.location.%arg 2%::*}
set {_size} to size of {randomchest.location.%arg 2%::*}
message "&8[&cRandomChest&8] &3Vous avez ajouté votre position pour les coffres &c%arg 2% &3 !"
message "&8[&cRandomChest&8] &3La liste &c%arg 2% &3a maintenant &c%{_size}% coffre(s) !"
if arg 1 is "removelist":
clear {randomchest.location.%arg 2%::*}
clear {RandomChest.%arg 2%::*}
message "&8[&cRandomChest&8] &eLes &ccoffres &eet les &citems &ede la liste &c%arg 2% &eont été reset !"
if arg 1 is "spawnchest":
loop {randomchest.location.%arg 2%::*}:
set block at loop-value to air
clear drops
wait 2 tick
set block at loop-value to chest
set {_liste::*} to {RandomChest.%arg 2%::*}
loop (a random integer between 1 and 4) times:
set {_random} to a random element out of {_liste::*}
remove {_random} from {_liste::*}
add {_random} to inventory of block at loop-value-1
message "&8[&cRandomChest&8] &eLes coffres &c%arg 2% &eont bien été remplient !"
else:
message "&8[&cRandomChest&8] &cQuels listes ?"
message "&8[&cRandomChest&8] &3/randomchest %arg 1% &3<normal>&7/&3<Medicals>&7/&3<rare>&7/&3<militaire>&7/&3<A>"
every 1 minutes:
if {RandomChest.a::*} is set:
make console execute command "/randomchest spawnchest a"
broadcast "&8[&cRandomChest&8] &eLes coffres de type &cA &eont spawnent !"
every 2 minutes:
if {RandomChest.medicals::*} is set:
make console execute command "/randomchest spawnchest medicals"
broadcast "&8[&cRandomChest&8] &eLes coffres de type &cMedicals &eont spawnent !"
every 3 minutes:
if {RandomChest.normal::*} is set:
make console execute command "/randomchest spawnchest normal"
broadcast "&8[&cRandomChest&8] &eLes coffres de type &cNormal &eont spawnent !"
every 5 minutes:
if {RandomChest.rare::*} is set:
make console execute command "/randomchest spawnchest rare"
broadcast "&8[&cRandomChest&8] &eLes coffres de type &cRare &eont spawnent !"
every 8 minutes:
if {RandomChest.militaire::*} is set:
make console execute command "/randomchest spawnchest militaire"
broadcast "&8[&cRandomChest&8] &eLes coffres de type &cMilitaire &eont spawnent !"