Just so you know, we don't know the file format for every file. If it's just a bunch of random characters, it's probably a .zip or .jar.
options:
file: "Server/Spawners/config.yml"
data file: Server/Spawners/data.yml
cmd: /spawners
aliases: /ss
load:
if file {@file} does not exists:
set "gui options" to "size: 6 | name: §7Spawners" in yaml file {@file}
set "paquets statut" to "false" in yaml file {@file}
set "pickaxe options" to "name: Nom de la pioche | durability: 1" in yaml file {@file}
set "permission.see another" to "permission" in yaml file {@file}
set "permission.edit" to "permission" in yaml file {@file}
set "error sound" to "note.bass" in yaml file {@file}
set {_monsters} to "Wither/Bat/Witch/Endermite/Guardian/Pig/Sheep/Cow/Chicken/Squid/Wolf/Mushroom/SnowGolem/Ocelot/IronGolem/Horse/Rabbit/Creeper/Skeleton/Spider/Giant/Zombie/Slime/Ghast/Villager/ZombiePigman/Enderman/CaveSpider/Silverfish/Blaze/MagmaCube/EnderDragon"
loop {_monsters} split by "/":
set "monsters.%loop-value%.takeable" to "true" in yaml file {@file}
set "monsters.%loop-value%.takeable pourcent" to "100%%" in yaml file {@file}
function showPanelSS(sender: player,informations: text,section: text = "",page: number = 1,parameter: boolean = false):
close {_sender}'s inventory
set {_name} to single value "gui options" get of {@file}
set {_size} to first element of {_name} split by " | "
replace all "%{_size}% | name: " with "" in {_name}
replace all "size: " with "" in {_size}
set {_size} to {_size} parsed as number
if inventory name of current inventory of {_sender} is not "%{_name}%":
open virtual chest inventory with size "%{_size}%" parsed as number named "%{_name}%" to {_sender}
wait a tick
else:
loop all numbers between 1 and {_size}*9:
create a gui slot loop-number - 1 of {_sender} with air to do nothing
if {_parameter} is false:
set {_edit} to single value "permission.edit" get of {@file}
set {_paquets} to single value "paquets statut" get of {@file}
set {_liste::*} to value list "%{_informations}%" get of "{@data file}"
set {_sound} to single value "error sound" get of {@file}
create a gui slot {_size}*9-5 of {_sender} with sunflower named "§bActualiser" to run function showPanelSS({_sender}, {_informations}, "", 1, false)
if {_sender} has permission "%{_edit}%":
create a gui slot {_size}*9-1 of {_sender} with redstone comparator item named "§4Paramètres" with lore "||§f§nChoisir:||||§f- spawners récupérables||§f- %% de chance||||§7 Ouvrir§c [Clic-Droit]" to run function showPanelSS({_sender}, {_informations}, "", 1, true)
if "%{_paquets}%" is "false":
do [set {_next} to {_page} + 1]->[set {_last} to {_page} - 1]
set {_maxpage} to rounded up (0.1 + size of {_liste::*} / ({_size}*9-9))
if {_page} is not {_maxpage}:
create a gui slot {_size}*9-4 of {_sender} with paper named "§aPage suivante" to run function showPanelSS({_sender}, {_informations}, "", {_next}, false)
else:
create a gui slot {_size}*9-4 of {_sender} with paper named "§aPage suivante" to run:
play raw sound "%{_sound}%" at {_sender} with pitch 1 volume 10
if {_page} is not 1:
create a gui slot {_size}*9-6 of {_sender} with paper named "§aPage précédente" to run function showPanelSS({_sender}, {_informations}, "", {_last}, false)
else:
create a gui slot {_size}*9-6 of {_sender} with paper named "§aPage précédente" to run:
play raw sound "%{_sound}%" at {_sender} with pitch 1 volume 10
set {_index} to 0
loop {_liste::*}:
if {_index} >= {_page} * (({_size} - 1) * 9) - ({_size} - 1) * 9:
if {_index} < {_page} * ({_size} - 1) * 9:
set {_name} to loop-value
create a gui slot {_index}-(({_size} - 1) * 9)*({_page} - 1) of {_sender} with monster spawner named "§f%{_name}%" to run:
execute console command "/give %player% mob_spawner 1 0 {BlockEntityTag:{EntityId:""%{_name}%""}, display:{Name:&f%{_name}%}}"
remove "%{_name}%" from yaml list "%{_informations}%" from "../../../{@data file}"
showPanelSS({_sender}, {_informations}, "", {_page}, false)
else:
exit loop
add 1 to {_index}
else:
if {_size} < 5:
open virtual chest inventory with size 5 named "%{_name}%" to {_sender}
wait a tick
loop {_liste::*}:
if {_value} is not set:
set {_value} to loop-value
add 1 to {_paquets}
else if loop-value is not {_value}:
set {_value} to loop-value
add 1 to {_paquets}
loop {_liste::*}:
add 1 to {_paquets::%loop-value%}
set {_tag.%loop-value%} to loop-value
set {_index} to 0
loop {_paquets::*}:
set {_type} to loop-index
set {_bcl} to loop-value
create a gui slot {_index} of {_sender} with loop-value of monster spawner named "§f%{_tag.%{_type}%}%" with lore "||§6Spawner de §7§o%{_tag.%{_type}%}%||§2Clic:||§f -§a Gauche > 1x||§f -§a Droit > %{_bcl}%x" to run with "left" click:
execute console command "/give %player% mob_spawner 1 0 {BlockEntityTag:{EntityId:""%{_tag.%{_type}%}%""}, display:{Name:&f%{_tag.%{_type}%}%}}"
remove "%{_tag.%{_type}%}%" from yaml list "%{_informations}%" from "../../../{@data file}"
showPanelSS({_sender}, {_informations}, "", {_page}, false)
create a gui slot {_index} of {_sender} with loop-value of monster spawner named "§f%{_tag.%{_type}%}%" with lore "||§6Spawner de §7§o%{_tag.%{_type}%}%||§2Clic:||§f -§a Gauche > 1x||§f -§a Droit > %{_bcl}%x" to run with "right" click:
loop {_bcl} times:
execute console command "/give %player% mob_spawner 1 0 {BlockEntityTag:{EntityId:""%{_tag.%{_type}%}%""}, display:{Name:&f%{_tag.%{_type}%}%}}"
remove "%{_tag.%{_type}%}%" from yaml list "%{_informations}%" from "../../../{@data file}"
showPanelSS({_sender}, {_informations}, "", {_page}, false)
add 1 to {_index}
else if {_parameter} is true:
if {_size} < 5:
open virtual chest inventory with size 5 named "%{_name}%" to {_sender}
wait a tick
set {_size} to 5
set {_monsters} to "Wither/Bat/Witch/Endermite/Guardian/Pig/Sheep/Cow/Chicken/Squid/Wolf/Mushroom/SnowGolem/Ocelot/IronGolem/Horse/Rabbit/Creeper/Skeleton/Spider/Giant/Zombie/Slime/Ghast/Villager/ZombiePigman/Enderman/CaveSpider/Silverfish/Blaze/MagmaCube/EnderDragon"
set {_index} to 0
loop {_monsters} split by "/":
set {_value} to single value "monsters.%loop-value%.takeable" get of {@file}
set {_monster} to loop-value
if "%{_value}%" is "true":
set {_drop} to single value "monsters.%loop-value%.takeable pourcent" get of {@file}
create a gui slot {_index} of {_sender} with shiny paper named "§f%loop-value%" with lore "||§fSatut:§7§o activé||§fTaux de drop:§7§o %{_drop}%||§2Clic:||§f -§a Gauche > Désactiver||§f -§a Droit > Changer taux de drop" to run with "left" click:
set "monsters.%{_monster}%.takeable" to "false" in yaml file {@file}
showPanelSS({_sender}, {_informations}, "", 1, true)
create a gui slot {_index} of {_sender} with shiny paper named "§f%loop-value%" with lore "||§fSatut:§7§o activé||§fTaux de drop:§7§o %{_drop}%||§2Clic:||§f -§a Gauche > Désactiver||§f -§a Droit > Changer taux de drop" to run with "right" click:
close {_sender}'s inventory
send "§aEcrivez dans le chat le§2 pourcentage (§a%%§2) désiré." to {_sender}
set {edit.%{_sender}%} to true
while {edit.%{_sender}%} is true:
if "%{_sender}%" parsed as offline player is offline:
clear {edit.%{_sender}%}
stop
wait a second
send "§aLe pourcentage a bien été changé en %{edit.%{_sender}%}%." to {_sender}
set "monsters.%{_monster}%.takeable pourcent" to "%{edit.%{_sender}%}%%%" in yaml file {@file}
showPanelSS({_sender}, {_informations}, "", 1, true)
else if "%{_value}%" is "false":
create a gui slot {_index} of {_sender} with paper named "§f%loop-value%" with lore "||§fSatut:§7§o désactivé||§aClic pour activer" to run:
set "monsters.%{_monster}%.takeable" to "true" in yaml file {@file}
showPanelSS({_sender}, {_informations}, "", 1, true)
add 1 to {_index}
create a gui slot {_size}*9-5 of {_sender} with nether star named "§cRetour menu principal" with lore "§e- Configuration sauvegardée" to run:
showPanelSS({_sender}, {_informations}, "", 1, false)
on chat:
if {edit.%player%} is true:
cancel event
if "%message%" parsed as number is set:
if "%message%" parsed as number is smaller or equal to 100:
if "%message%" parsed as number is bigger or equal to 0:
set {edit.%player%} to "%message%" parsed as number
else:
send "§cErreur: Entrez un nombre dans le chat." to sender
else:
send "§cErreur: Entrez un nombre dans le chat." to sender
else:
send "§cErreur: Entrez un nombre dans le chat." to sender
command {@cmd} [<text>]:
aliases: {@aliases}
trigger:
set {_liste::*} to value list "%player%" get of "{@data file}"
set {_see} to single value "permission.see another" get of {@file}
set {_edit} to single value "permission.edit" get of {@file}
if argument 1 is not set:
execute player command "{@cmd} %player%"
stop
else if argument 1 is not player:
set {_liste::*} to value list "%argument%" get of "{@data file}"
if player has permission "%{_see}%":
if size of {_liste::*} is 0:
send "§cErreur: Ce joueur n'a pas de spawners en stock." to player
stop
showPanelSS(player, argument 1)
else if size of {_liste::*} is not 0:
showPanelSS(player, "%player%")
stop
else if player has permission "%{_edit}%":
showPanelSS(player, "%player%")
stop
send "§cErreur: Vous n'avez pas de spawners en stock." to player
on break:
if event-block is a monster spawner:
cancel event
set {_parameters} to single value "pickaxe options" get of {@file}
set {_tool} to first element of {_parameters} split by " | "
replace all "item: " with "" in {_tool}
if "%player's tool%" is "%{_tool}%":
replace all "item: %{_tool}% | name: " with "" in {_parameters}
set {_name} to first element of {_parameters} split by " | "
if name of player's tool is "%{_name}%":
set {_statut} to single value "monsters.%entity of spawner event-block%.takeable" get of {@file}
if "%{_statut}%" is "true":
set {_pourcent} to single value "monsters.%entity of spawner event-block%.takeable pourcent" get of {@file}
replace all "%%" with "" in {_pourcent}
set {_pourcent} to {_pourcent} parsed as number
remove player's tool from player's inventory
chance of {_pourcent}%:
send "§aSpawner de§7§o %entity of spawner event-block%§a récupéré." to player
add "%entity of spawner event-block%" to yaml list "%player%" from "../../../{@data file}"
set block at event-block to air
stop
uncancel event
else:
uncancel event
else:
uncancel event
else:
uncancel event