@MaxDu56YT
@Ertonia
J'ai réalisé ce script, il marche pour moi.
Version de mon serveur: 1.11.2
Add-ons:
- TuSKe 1.8.3-PikachuPatch-v1
- Skript 2.2-dev32d
- SkStuff
- skript-yaml
Dans 'plugins/Skript/scripts/'
load:
load yaml "plugins/sS/config.yml" as "sSConfig"
function spawners() :: objects:
loop skript-yaml nodes with keys "GUI.spawners" from "sSConfig" without string checks:
if loop-value is not "global item":
add loop-value to {_S::*}
return {_S::*}
function decorations() :: objects:
set {_R::*} to skript-yaml list "GUI.decoration" from "sSConfig"
return {_R::*}
function d(S:string) :: string:
set {_R} to skript-yaml value "GUI.spawners.%{_S}%.data" from "sSConfig"
return {_R}
function s(S:string) :: number:
set {_R} to skript-yaml value "GUI.spawners.%{_S}%.slot" from "sSConfig"
return {_R}
function p(S:string) :: number:
set {_R} to skript-yaml value "GUI.spawners.%{_S}%.price" from "sSConfig"
return {_R}
function nbt(S:object) :: string:
set {_R} to skript-yaml value "GUI.spawners.%{_S}%.nbt" from "sSConfig"
replace all "$s" with "%s({_S})%" in {_R}
replace all "$p" with "%p({_S})%" in {_R}
replace all "$id" with "%{_S}%" in {_R}
return {_R}
on command:
set {_CMD} to skript-yaml value "command" from "sSConfig"
if command is {_CMD}:
cancel event
set {_NAME} to skript-yaml value "GUI.name" from "sSConfig"
set {_S} to skript-yaml value "GUI.height" from "sSConfig"
set {_B} to "%skript-yaml value ""GUI.spawners.global item"" from ""sSConfig""%" parsed as item
open virtual chest inventory with size {_S} named "%{_NAME}%" to player
loop spawners():
set {_S} to loop-value
format gui slot s({_S}) of player with {_B} with custom nbt "%nbt({_S})%" to run:
if targeted block of player is a mob spawner:
set {_E} to "%nbt of targeted block%"
set {_E::*} to {_E} split by ":{Entity:{id:"""
set {_F} to first element of {_E::2} split by """}"
if d({_S}) is not "%{_F}%":
replace all "%{_F}%" with "%d({_S})%" in {_E}
if money of player is bigger or equal to p({_S}):
remove p({_S}) from money of player
set block at targeted block to mob spawner
add "%{_E}%" to nbt of targeted block
loop decorations():
set {_I} to loop-value
set {_I::*} to {_I} split by "|"
if {_I::4} is "confirmation":
format gui slot {_I::1} parsed as number of player with "%{_I::2}%" parsed as item with custom nbt "%{_I::3}%" to run:
set {_P} to skript-yaml value "GUI.basic spawner.price" from "sSConfig"
set {_NAME} to skript-yaml value "GUI.basic spawner.confirmation.name" from "sSConfig"
set {_S} to skript-yaml value "GUI.basic spawner.confirmation.height" from "sSConfig"
open virtual chest inventory with size {_S} named "%{_NAME}%" to player
set {_I::*} to "GUI.basic spawner.confirmation.accept" and "GUI.basic spawner.confirmation.deny"
set {_I2::*} to "slot", "item" and "nbt"
loop {_I::*}:
loop {_I2::*}:
set {_I3::%loop-value-3%} to skript-yaml value "%loop-value-2%.%loop-value-3%" from "sSConfig"
set {_A} to loop-value-2
format gui slot {_I3::slot} of player with "%{_I3::item}%" parsed as item with custom nbt "%{_I3::nbt}%" to run:
if {_A} is "GUI.basic spawner.confirmation.accept":
if player's money is bigger or equal to {_P}:
remove {_P} from money of player
execute console command "/give %player% mob_spawner 1 0 {BlockEntityTag:{EntityId:minecraft:pig}}"
else:
execute player command "%{_CMD}%"
clear {_I3::*}
loop skript-yaml list "GUI.basic spawner.decoration" from "sSConfig":
set {_F} to loop-value-2
set {_F::*} to {_F} split by "|"
format gui slot {_F::1} parsed as number of player with "%{_F::2}%" parsed as item with custom nbt "%{_F::3}%"
else:
format gui slot {_I::1} parsed as number of player with "%{_I::2}%" parsed as item with custom nbt "%{_I::3}%"
'plugins/sS/config.yml'
command: sS-edit
GUI:
name: '§3Spawners'
height: 6
basic spawner:
price: 50000
confirmation:
name: '§3Spawners'
height: 3 # between 1 and 6
accept:
slot: 15
item: emerald
nbt: '{display:{Name:"§2Valider l''achat"}}'
deny:
slot: 11
item: rose red
nbt: '{display:{Name:"§4Annuler l''achat"}}'
decoration:
- '4|mob spawner|{display:{Name:"§3Achat Spawner Cochon"}}|confirmation'
decoration:
- '53|mob spawner|{display:{Name:"§3Achat Spawner Cochon"}}|confirmation'
# You can add others decoration tools
spawners:
global item: 'spawn egg' # do not edit this
# http://minecraft-ids.grahamedgecombe.com/entities
# $p is price
# $s is slot
# $id is ID, for llama is 'llama'
llama:
slot: 0
data: 'minecraft:llama'
nbt: '{EntityTag:{id:minecraft:llama},display:{Name:"$id",Lore:["$p$"]}}'
price: 5000
enderman:
slot: 1
data: 'minecraft:enderman'
nbt: '{EntityTag:{id:minecraft:enderman},display:{Name:"$id",Lore:["$p$"]}}'
price: 10000
endermite:
slot: 2
data: 'minecraft:endermite'
nbt: '{EntityTag:{id:minecraft:endermite},display:{Name:"$id",Lore:["$p$"]}}'
price: 5000
spider:
slot: 3
data: 'minecraft:spider'
nbt: '{EntityTag:{id:minecraft:spider},display:{Name:"$id",Lore:["$p$"]}}'
price: 2500
blaze:
slot: 4
data: 'minecraft:blaze'
nbt: '{EntityTag:{id:minecraft:blaze},display:{Name:"$id",Lore:["$p$"]}}'
price: 5000
chicken:
slot: 5
data: 'minecraft:chicken'
nbt: '{EntityTag:{id:minecraft:chicken},display:{Name:"$id",Lore:["$p$"]}}'
price: 1000
cow:
slot: 6
data: 'minecraft:cow'
nbt: '{EntityTag:{id:minecraft:cow},display:{Name:"$id",Lore:["$p$"]}}'
price: 2500