Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Código desenvolvido por DanielZinh#7616
- # LoS Skripters - EliteSK
- # Permissões:
- # danielsk.feira.admin - Permissão para usar os comandos de admin
- # danielsk.feira.comprar - Permissão que comprar feiras
- # danielsk.feira.delay.bypass - Permissão que comprar feiras
- # É necessário possuir o plugin HolographicDisplays caso venha usar feiras de hologramas.
- options:
- # Anunciar sempre que uma feira nova for criada, deletada, comprada ou expirada?
- Anunciar: true
- # ------------------------------ #
- # Precisa estar perto para comprar feira
- # Isso evita que pessoas comprem feiras de distâncias longas
- # Não influencia em nada, é apenas um gosto pessoal, haha!
- BlockComprasLonges: false
- # Distância (em blocos) mínima para compra, caso "BlockComprasLonges" esteja como true
- ComprasLongesDistancia: 20
- # ------------------------------ #
- # Poder renovar feiras, isso permitirá com que um jogador
- # fique com a mesma feira enquanto for renovando, fazendo
- # com que players fiquem com feiras por longos e longos tempos.
- BlockRenovações: false
- # Segundos que vai aguardar para poder ir para uma feira, pessoas que possuem
- # a permissão "danielsk.feira.delay.bypass" estão imunes.
- # Deixe "0" caso não queira.
- DelayGoFeira: 5 # Segundos
- on load:
- send "[DanielSK] Código %script% iniciado." to console
- send "[DanielSK] Discord: DanielZinh##7616" to console
- load yaml "plugins/DanielSK/feiras.yml" as "DanielSK.feiras"
- save yaml "DanielSK.feiras"
- on unload:
- save yaml "DanielSK.feiras"
- command /feira [<text>] [<integer>] [<number>] [<integer>] [<text>]:
- trigger:
- if arg 1 is set:
- if arg 1 is "ir", "comprar", "excluir", "renovar", "criar", "deletar" or "expirar":
- if arg 1 is not "ir", "comprar", "excluir" or "renovar":
- player doesn't have permission "danielsk.feira.admin"
- send "&cVocê não possui permissão para fazer isso!"
- stop
- if arg 1 is "ir", "comprar", "excluir", "deletar", "renovar" or "expirar":
- if arg 2 is not set:
- send "&cUse /feira %arg-1% &c(ID)"
- stop
- if yaml value "feiras.%arg-2%" from "DanielSK.feiras" is not set:
- send "&cEssa feira não existe!"
- stop
- if arg 1 is "criar":
- if yaml value "feiras.%arg-2%" from "DanielSK.feiras" is set:
- send "&cEssa feira já existe!"
- else if arg 2, arg 3, arg 4 or arg 5 is not set:
- send "&cUse /feira criar (ID) (Preço) (Expiração (Em dias)) (placa/holograma)"
- else if arg 5 is not "placa" or "holograma":
- send "&cUse /feira criar (ID) (Preço) (Expiração (Em dias)) (placa/holograma)"
- else:
- if arg 5 is "placa":
- if player's target block is a sign:
- loop yaml nodes with keys "feiras" from "DanielSK.feiras":
- yaml value "feiras.%loop-value%.sign-location" from "DanielSK.feiras" is location of target block
- send "&cEssa placa já possui uma feira registrada!"
- stop
- set {_a} to target block's location
- else:
- send "&cVocê precisa estar olhando para a placa!"
- stop
- else:
- set {_b} to true
- set {_id} to abs(arg-2)
- set yaml value "feiras.%arg-2%" from "DanielSK.feiras" to abs(arg-2)
- set {_p::*} to split "owner;0=price;%arg-3%=expiration-days;%abs(arg-4)%=expiration-date;0=type;%arg-5%=local;loc" at "="
- loop {_p::*}:
- set {_p2::*} to split loop-value at ";"
- if {_p2::2} is "loc":
- set {_p2::2} to player's location
- set yaml value "feiras.%{_id}%.%{_p2::1}%" from "DanielSK.feiras" to {_p2::2}
- if {_a} is set:
- set yaml value "feiras.%{_id}%.sign-location" from "DanielSK.feiras" to {_a}
- set line 1 of block at {_a} to "[Feira]"
- set line 2 of block at {_a} to "Dono: Ninguém"
- set line 3 of block at {_a} to "Valor: R$%arg-3%"
- make player execute command "rg define feira-%{_id}%"
- wait 5 tick
- make player execute command "rg setpriority feira-%{_id}% 1"
- make player execute command "rg flag feira-%{_id}% build allow"
- if {@Anunciar} is true:
- wait 1 tick
- broadcast "&6[&fFeiras&6] &7Uma nova feira com o ID &f%{_id}% &7foi criada!"
- if {_b} is set:
- teleport player to block 3.5 above player
- make player execute command "hd create feira-%{_id}% &6[FEIRA]"
- wait 1 tick
- make player execute command "hd addline feira-%{_id}% &eDono: &6Ninguém"
- make player execute command "hd addline feira-%{_id}% &eValor: &6R$%arg-3%"
- make player execute command "hd addline feira-%{_id}% &eExpira: &6Nunca"
- make player execute command "hd addline feira-%{_id}% &5"
- make player execute command "hd addline feira-%{_id}% &6/feira comprar %{_id}%"
- else if arg 1 is "deletar":
- delete yaml value "feiras.%arg-2%" from "DanielSK.feiras"
- make player execute command "rg delete feira-%arg-2%"
- if yaml value "feiras.%arg-2%.type" from "DanielSK.feiras" is not "placa":
- make console execute command "hd delete feira-%arg-2%"
- if {@Anunciar} is true:
- broadcast "&6[&fFeiras&6] &7A feira de ID &f%arg-2% &7foi deletada."
- else if arg 1 is "expirar":
- set {_n} to now
- set yaml value "feiras.%arg-2%.expiration-date" from "DanielSK.feiras" to {_n}
- send "&7Essa feira será expirada em alguns instantes..."
- else if arg 1 is "ir":
- if {@DelayGoFeira} is not 0:
- player doesn't have permission "danielsk.feira.delay.bypass"
- wait "%abs({@DelayGoFeira})% seconds" parsed as timespan
- teleport player to yaml value "feiras.%arg-2%.local" from "DanielSK.feiras"
- send "&7Você foi teleportado para a feira ID &f%arg-2%&7."
- else if arg 1 is "comprar":
- if yaml value "feiras.%arg-2%.owner" from "DanielSK.feiras" is not 0:
- send "&cEssa feira já tem dono."
- else:
- if {@BlockComprasLonges} is true:
- set {_l} to yaml value "feiras.%arg-2%.local" from "DanielSK.feiras"
- distance between player and {_l} > {@ComprasLongesDistancia}
- send "&cVocê precisa estar próximo da feira para compra-la."
- stop
- open chest with 3 rows named "&eComprar Feira" to player
- wait 1 tick
- if name of player's current inventory is "&eComprar Feira":
- set {_price} to yaml value "feiras.%arg-2%.price" from "DanielSK.feiras"
- set slot 12 of player's current inventory to light green wool block named "&aConfirmar" with lore "||&7ID: &6%arg-2%||&7Preço: &6R$%{_price}%||&aClique para comprar...||&5||"
- set slot 14 of player's current inventory to red wool block named "&cCancelar"
- else if arg 1 is "renovar":
- if yaml value "feiras.%arg-2%.owner" from "DanielSK.feiras" is not player:
- send "&cEssa feira não é sua!"
- else if player's balance < yaml value "feiras.%arg-2%.price" from "DanielSK.feiras":
- send "&cVocê não possui dinheiro o suficiente para fazer isso."
- else:
- remove yaml value "feiras.%arg-2%.price" from "DanielSK.feiras" from player's balance
- send "&7Você renovou sua feira com sucesso."
- set {_n} to now
- set {_t} to yaml value "feiras.%arg-2%.expiration-days" from "DanielSK.feiras"
- add "%{_t}% days" parsed as timespan to {_n}
- set yaml value "feiras.%arg-2%.expiration-date" from "DanielSK.feiras" to {_n}
- if yaml value "feiras.%arg-2%.sign-location" from "DanielSK.feiras" is not set:
- make console execute command "hd setline feira-%arg-2% 4 &eExpira: &6%{_n}%"
- else if arg 1 is "excluir":
- if yaml value "feiras.%arg-2%.owner" from "DanielSK.feiras" is not player:
- send "&cEssa feira não é sua!"
- else:
- make console execute command "feira expirar %arg-2%"
- else:
- make player execute command "feira"
- else:
- send "&7Comandos para uso das &fFeiras&7:"
- send "&f/feira ir (ID) &6- &7ir para uma feira"
- send "&f/feira comprar (ID) &6- &7comprar uma feira"
- send "&f/feira excluir (ID) &6- &7exclui sua feira"
- if {@BlockRenovações} is not true:
- send "&f/feira renovar (ID) &6- &7renova sua feira"
- player has permission "danielsk.feira.admin"
- send "&c/feira criar (ID) &6- &4cria uma feira"
- send "&c/feira deletar (ID) &6- &4deleta uma feira"
- send "&c/feira expirar (ID) &6- &4expira uma feira"
- on rightclick on sign:
- loop yaml nodes with keys "feiras" from "DanielSK.feiras":
- if yaml value "feiras.%loop-value%.owner" from "DanielSK.feiras" is 0:
- yaml value "feiras.%loop-value%.sign-location" from "DanielSK.feiras" is location of block
- make player execute command "feira comprar %loop-value%"
- else:
- send "&cEssa feira já possui dono."
- on inventory click:
- if name of player's current inventory is "&eComprar Feira":
- cancel event
- if "%name of item%" is "&cCancelar":
- close player's inventory
- else if "%name of item%" is "&aConfirmar":
- set {_id} to uncolored line 2 of lore of item
- set {_preço} to uncolored line 3 of lore of item
- replace all "Preço: R$" and "ID: " with "" in {_id} and {_preço}
- set {_preço} to {_preço} parsed as number
- if player's balance >= {_preço}:
- close player's inventory
- remove {_preço} from player's balance
- set {_n} to now
- set {_t} to yaml value "feiras.%{_id}%.expiration-days" from "DanielSK.feiras"
- add "%{_t}% days" parsed as timespan to {_n}
- set yaml value "feiras.%{_id}%.expiration-date" from "DanielSK.feiras" to {_n}
- set yaml value "feiras.%{_id}%.owner" from "DanielSK.feiras" to player
- if yaml value "feiras.%{_id}%.sign-location" from "DanielSK.feiras" is set:
- set {_a} to yaml value "feiras.%{_id}%.sign-location" from "DanielSK.feiras"
- set line 1 of block at {_a} to "[Feira]"
- set line 2 of block at {_a} to "Dono: %player%"
- set line 3 of block at {_a} to "Expira:"
- else:
- make console execute command "hd setline feira-%{_id}% 2 &eDono: &6%player%"
- make console execute command "hd setline feira-%{_id}% 4 &eExpira: &6%{_n}%"
- make console execute command "hd setline feira-%{_id}% 6 &6/feira ir %{_id}%"
- if {@Anunciar} is true:
- broadcast "&6[&fFeiras&6] &f%player% &7comprou a feira de ID &f%{_id}%&7."
- else:
- send "&cVocê não possui dinheiro o suficiente."
- on place:
- "%region at block%" contains "feira"
- loop yaml nodes with keys "feiras" from "DanielSK.feiras":
- "%region at block%" contains "feira-%loop-value%"
- if yaml value "feiras.%loop-value%.owner" from "DanielSK.feiras" is not player:
- player is not op
- cancel event
- else:
- add block's location to {feiras::%loop-value%::*}
- on break:
- "%region at block%" contains "feira"
- loop yaml nodes with keys "feiras" from "DanielSK.feiras":
- "%region at block%" contains "feira-%loop-value%"
- if yaml value "feiras.%loop-value%.owner" from "DanielSK.feiras" is not player:
- player is not op
- cancel event
- else:
- add block's location to {feiras::%loop-value%::*}
- every 1 second:
- loop yaml nodes with keys "feiras" from "DanielSK.feiras":
- yaml value "feiras.%loop-value%.owner" from "DanielSK.feiras" is not 0
- set {_re} to yaml value "feiras.%loop-value%.expiration-date" from "DanielSK.feiras"
- if now >= {_re}:
- set yaml value "feiras.%loop-value%.expiration-date" from "DanielSK.feiras" to 0
- set yaml value "feiras.%loop-value%.owner" from "DanielSK.feiras" to 0
- loop {feiras::%loop-value%::*}:
- set block at loop-value-2 to air
- delete {feiras::%loop-value%::*}
- if yaml value "feiras.%loop-value%.sign-location" from "DanielSK.feiras" is set:
- set {_a} to yaml value "feiras.%loop-value%.sign-location" from "DanielSK.feiras"
- set {_price} to yaml value "feiras.%loop-value%.price" from "DanielSK.feiras"
- set line 1 of block at {_a} to "[Feira]"
- set line 2 of block at {_a} to "Dono: Ninguém"
- set line 3 of block at {_a} to "Valor: R$%{_price}%"
- else:
- make console execute command "hd setline feira-%loop-value% 2 &eDono: &6Ninguém"
- make console execute command "hd setline feira-%loop-value% 4 &eExpira: &6Nunca"
- make console execute command "hd setline feira-%loop-value% 6 &6/feira comprar %loop-value%"
- if {@Anunciar} is true:
- broadcast "&6[&fFeiras&6] &7A feira de ID &f%loop-value% &7expirou."
- else:
- set {_e} to yaml value "feiras.%loop-value%.expiration-date" from "DanielSK.feiras"
- set {_x} to "%difference between now and {_e}%"
- loop 99 times:
- replace all ".%(99 - loop-number)%" with "" in {_x}
- replace all " " and "and" with "" in {_x}
- replace all "seconds" and "second" with "s" in {_x}
- replace all "minutes" and "minute" with "m" in {_x}
- replace all "hours" and "hour" with "h" in {_x}
- replace all "days" and "day" with "d" in {_x}
- if yaml value "feiras.%loop-value%.sign-location" from "DanielSK.feiras" is set:
- set {_a} to yaml value "feiras.%loop-value%.sign-location" from "DanielSK.feiras"
- set {_price} to yaml value "feiras.%loop-value%.price" from "DanielSK.feiras"
- set line 3 of block at {_a} to "Expira: %{_x}%"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement