Ir para conteúdo

[EliteSK] Integre seu Essentials em seu Skript!


danielzinh

Posts Recomendados

fazer isso com o plugin plotsquared é complicado?
Dei uma olhada nas api's que estavam no github mas não entendi quais deveria importar então eu fiz uns cálculos bem lokos mas no fim deu certo, porém só consegui as informações que estavam nas placas das plotmes então fazer mais functions pra determinar a hora que um player entrar em uma plot iria causar lag na hora de verificar, eu vou deixar uma palinha do porque eu fiz isso.

  • Fiz um skript de /armazem para cada player
    Então cada vez que um item dropar na plot do player tem um evento que verifica se o item tem tem uma tag especial que é dada quando o player dropa algum item, depois barrei as vezes que itens spawnavam por conta de blocos que possuíam inventario quebravam com itens dentro, fiz um menú sincrionizado com a loja do meu servidor, e pronto um /armazem, com itens definidos que poderiam ser vendidos.
     

Bem se quiser dar uma olhada.
Skript:


 

Spoiler
command /pinfo:
	trigger:
		
		set {_player} to player
		
		set {_Id} to GetPlotID(block at player)
		
		send "&6%line 3 of GetPlotSign(GetPlotID(block at player))% &8 %3st element of GetLocations({_id})% %4st element of GetLocations({_id})% %1st element of GetLocations({_id})% %2st element of GetLocations({_id})% &6%GetPlotID(block at player)%" to {_player}
		
		send "&6%GetLoc({_id}, block at player)%"
		
function GetPlotOwner(id: string) :: string:
	
	if "%line 3 of GetPlotSign({_id})%" is not "<none>":
		
		return "%uncolored line 3 of GetPlotSign({_id})%"
	
	else:
		
		return "null"
		
function GetPlotID(location: block) :: string:
	
	set {_x} to x-coord of block at {_location}.getLocation()
	
	set {_z} to z-coord of block at {_location}.getLocation()

#============[Skript é unicamente para meu servidor, para funcionar em um outro terá que dividir (5)=largura da estrada, 16.5 é a distancia entre o centro exato de cada estrada.]=============

	set {_dx} to ceil(({_x}/5)/16.6)
	
	set {_dz} to ceil(({_z}/5)/16.6)
	
	return "%{_dx}%;%{_dz}%" #<---- ID Exato da plot onde o player está
	
function GetPlotSign(id: string) :: block:
	
	set {_ID::*} to split {_id} at ";"
	
	set {_idx} to {_ID::1} parsed as number
	
	set {_idz} to {_ID::2} parsed as number	
	
	set {_x} to (83*{_idx})-77
	
	set {_z} to (83*{_idz})-78
	
	if block at (location at {_x}, 101, {_z} in world "PlotWorld") is not air:
		
		return block at (location at {_x}, 101, {_z} in world "PlotWorld")
		
function GetLocations(id: string) :: objects:
	
	set {_ID::*} to split {_id} at ";"
	
	set {_idx} to {_ID::1} parsed as number
	
	set {_idz} to {_ID::2} parsed as number
	
	set {_return::1} to (83*{_idx})-7
	
	set {_return::2} to (83*{_idz})-7
	
	set {_return::3} to (83*{_idx})-76
	
	set {_return::4} to (83*{_idz})-76
	
	return {_return::*}

function GetLoc(id: string, block: block) :: boolean:
	
	set {_x.1} to "%(3st element of GetLocations({_id}))%" parsed as number
	
	set {_z.1} to "%(4st element of GetLocations({_id}))%" parsed as number
	
	set {_x.2} to "%(1st element of GetLocations({_id}))%" parsed as number
	
	set {_z.2} to "%(2st element of GetLocations({_id}))%" parsed as number
	
	if {_x.1} <= floor({_block}'s x-coord):
		
		add 1 to {_verf}
	
	if {_z.1} <= floor({_block}'s z-coord):
		
		add 1 to {_verf}
	
	if {_x.2} >= floor({_block}'s x-coord):
		
		add 1 to {_verf}
	
	if {_z.2} >= floor({_block}'s z-coord):
		
		add 1 to {_verf}
	
	if {_verf} = 4:
		
		return true
	
	else:
		
		return false
		
	
on place:
	
	set {_Id} to GetPlotID(block at player)
	
	if GetLoc({_id}, event-block) is false:
		
		if player have permission "plot.RoadPass":
			
			send "" to {_}
			
		else:
			
			cancel event
			
on break:
	
	set {_Id} to GetPlotID(block at player)
	
	if GetLoc({_id}, event-block) is false:
		
		if player have permission "plot.RoadPass":
			
			send "" to {_}
			
		else:
			
			cancel event
			
on item spawn:
	
	if event-world is "PlotWorld":
		
		if tag "Thrower" of event-entity's nbt is not set:
			
			if "%amount of event-item%" is "1":
				
				set {_block} to block at event-entity's location
				
				if {_block}'s metadata "Dropped" is not set:
				
					set {_Items::*} to wheat item, carrot, potato, pumpkin, melon slice, cocoa beans, cactus, sugar cane item, nether wart item and seeds
					
					if {_items::*} contains type of event-item:
					
						set {_Id} to GetPlotID(block at event-entity)
						
						if GetLoc({_id}, block at event-entity) is true:
							
							if GetPlotOwner({_id}) is not "null":
								
								set {_player} to GetPlotOwner({_id}) #<---- string = "MaiconJh"
								
								cancel event
								
								if {PlotStorage::%{_player}%::*} contains event-item:
									set {_} to 0
								else:
									add event-item to {PlotStorage::%{_player}%::*}
									
								add 1 to {PlotStorage::%{_player}%::%event-item%.amount}
								
								send action bar "&b(%{PlotStorage::%{_player}%::%event-item%.amount}%) &6%event-item% foi adicionado para seu armazém." to {_player} parsed as player
								
command /armazem:
	
	trigger:
		
		ArmazemPickup(player)
		
function AmountOfItemsInVar(List: objects) :: objects:
	
	loop {_List::*}:
		
		set {_i} to "%loop-value%"
		
		replace "0", "1", "2", "3", "4", "5", "6", "7", "8" and "9" with "" in {_i}
		
		set {_i} to "%{_i}%" parsed as item type
		
		if "%{_i}%" = "<none>":
			
			set {_i} to 1 of loop-value
			
		set {_n} to number of "%loop-value%" parsed as number
		
		if {_items::*} contains {_i}:
			
			set {_} to "ok"
			
		else:
			
			add {_i} to {_items::*}
			
		if {_n} > 0:
			
			add {_n} to {_amount-%{_i}%}
			
		if {_n} is not set:
			
			add 1 to {_amount-%{_i}%}
			
	loop {_items::*}:
		
		if "%{_amount-%loop-value%}%" = "<none>":
			
			set {_amount-%loop-value%} to 1
			
		add "%{_amount-%loop-value%}%.%loop-value%" to {_return::*}
		
	return {_return::*}
	
function ArmazemPickup(player: player):
	
	set {_chest} to chest with 5 rows named "§8Armazém"
	
	set {_slot} to 10
	
	set {_Items::*} to wheat item, carrot, potato, pumpkin, melon slice, cocoa beans, cactus, sugar cane item, nether wart item and seeds
	
	if {PlotStorage::%{_player}%::*} is set:
		
		set slot 40 of {_chest} to golden nugget named "&aVender tudo" with lore "&8Vender tudo que está no seu armazém." with nbt "{sell.all:true}"
		
	loop {PlotStorage::%{_player}%::*}:
		
		set {_item} to ("%loop-value%" parsed as item)
		
		if "%{_item}%" is not "<none>":
			
			set {_n} to {PlotStorage::%{_player}%::%{_item}%.amount}
			
			set slot {_slot} of {_chest} to {_item} named "&a%{_n}%&7x &a%{_item}%" with lore "%nl%&f⎛&b⊆&r⋂⊃&f⎞&a 64&7x%nl%&e%nl%&f⎛⊂⋂&b⊇&f⎞&e &a2304&7x%nl%&7" with nbt "{pickup:%{_n}%}"
			
			add 1 to {_slot}
	
	if {PlotStorage::%{_player}%::*} is not set:
		
		set slot 22 of {_chest} to barrier named "&cNão há nada por aqui." with lore "&7Todos os items que colher virá para seu armazém."
		
	open {_chest} to {_player}
	
on inventory click:
	
	if display name of player's current inventory is "§8Armazém":
		
		cancel event
		
		set {_player} to player
		
		if tag "sell.all" of (clicked item)'s nbt is set:
			
			loop {PlotStorage::%{_player}%::*}:
		
				set {_item} to ("%loop-value%" parsed as item)
				
				if "%{_item}%" is not "<none>":
					
					set {_id} to "%{_item}%"
					
					replace all " " with "." in {_id}
					
					if {SellPrice::%{_id}%} is set:
						
						set {_amount} to {PlotStorage::%{_player}%::%{_item}%.amount}
						
						set {_price} to GetPrice({_id}, "Sell")
						
						set {_total} to {_price}*{_amount}
						
						add {_total} to player's balance
						
						clear {PlotStorage::%{_player}%::%{_item}%.amount}
						
						remove {_item} from {PlotStorage::%{_player}%::*}
						
						send "&7[&6Loja&7] &7Vendido &a%{_amount}%&7x &f%{_item}% &7por &6%{_total}% coins"
						
			play sound "ENTITY_ARROW_HIT_PLAYER" with volume 1 with pitch 0 for player
			
			ArmazemPickup(player)
			
		if tag "pickup" of (clicked item)'s nbt > 0:
			
			set {_item} to "%type of clicked item%" parsed as item
			
			if "%click type%" contains "right":
				
				set {_pickup} to (tag "pickup" of (clicked item)'s nbt)
				
				if {_pickup} > 2304:
					
					set {_pickup} to 2304
					
			if "%click type%" contains "left":
				
				if (tag "pickup" of (clicked item)'s nbt) >= 64:
					
					set {_pickup} to 64
					
				if (tag "pickup" of (clicked item)'s nbt) < 64:
					
					set {_pickup} to (tag "pickup" of (clicked item)'s nbt)
					
			if player's inventory has space for {_pickup} of {_item}:
				
				set {_} to true
				
			else:
				
				if space for {_item} in player's inventory = 0:
					
					send "&cNão há mais espaço em seu inventário." to {_player}
					
					stop
					
				else:
					
					set {_pickup} to space for {_item} in player's inventory
					
			remove {_pickup} from {PlotStorage::%{_player}%::%{_item}%.amount}
			
			if {PlotStorage::%{_player}%::%{_item}%.amount} <= 0:
				
				clear {PlotStorage::%{_player}%::%{_item}%.amount}
				
				remove {_item} from {PlotStorage::%{_player}%::*}
				
			give {_pickup} of {_item} to player
			
			send "&eRecolhido &a%{_pickup}%&7x &a%{_item}% &edo seu armazém." to player
			
			wait 1 tick
			
			ArmazemPickup(player)
			
command /tes:
	trigger:
		
		set {_player} to player
		
		loop {PlotStorage::%{_player}%::*}:
			
			clear {PlotStorage::%{_player}%::%loop-value%}
		
		clear {PlotStorage::%{_player}%::*}
		
on break:
	
	if event-world is "PlotWorld":
		
		if "%event-block%" contains "dropper", "hopper", "dispenser", "chest" or "furnace":
			
			set event-block's metadata "Dropped" to true
			
			wait 3 ticks
			
			clear event-block's metadata "Dropped"
			
on dispense:
	
	if event-world is "PlotWorld":
		
		if "%event-block%" contains "dispenser" or "dropper":
			
			cancel event
			

 

 

Editado por ꧁RXZ꧂(ƸMaiconJHansenƷ)
Link para o comentário
Compartilhar em outros sites

Em 19/01/2022 em 16:14, ꧁RXZ꧂(ƸMaiconJHansenƷ) disse:

fazer isso com o plugin plotsquared é complicado?
Dei uma olhada nas api's que estavam no github mas não entendi quais deveria importar então eu fiz uns cálculos bem lokos mas no fim deu certo, porém só consegui as informações que estavam nas placas das plotmes então fazer mais functions pra determinar a hora que um player entrar em uma plot iria causar lag na hora de verificar, eu vou deixar uma palinha do porque eu fiz isso.

  • Fiz um skript de /armazem para cada player
    Então cada vez que um item dropar na plot do player tem um evento que verifica se o item tem tem uma tag especial que é dada quando o player dropa algum item, depois barrei as vezes que itens spawnavam por conta de blocos que possuíam inventario quebravam com itens dentro, fiz um menú sincrionizado com a loja do meu servidor, e pronto um /armazem, com itens definidos que poderiam ser vendidos.
     

Bem se quiser dar uma olhada.
Skript:


 

  Mostrar conteúdo oculto
command /pinfo:
	trigger:
		
		set {_player} to player
		
		set {_Id} to GetPlotID(block at player)
		
		send "&6%line 3 of GetPlotSign(GetPlotID(block at player))% &8 %3st element of GetLocations({_id})% %4st element of GetLocations({_id})% %1st element of GetLocations({_id})% %2st element of GetLocations({_id})% &6%GetPlotID(block at player)%" to {_player}
		
		send "&6%GetLoc({_id}, block at player)%"
		
function GetPlotOwner(id: string) :: string:
	
	if "%line 3 of GetPlotSign({_id})%" is not "<none>":
		
		return "%uncolored line 3 of GetPlotSign({_id})%"
	
	else:
		
		return "null"
		
function GetPlotID(location: block) :: string:
	
	set {_x} to x-coord of block at {_location}.getLocation()
	
	set {_z} to z-coord of block at {_location}.getLocation()

#============[Skript é unicamente para meu servidor, para funcionar em um outro terá que dividir (5)=largura da estrada, 16.5 é a distancia entre o centro exato de cada estrada.]=============

	set {_dx} to ceil(({_x}/5)/16.6)
	
	set {_dz} to ceil(({_z}/5)/16.6)
	
	return "%{_dx}%;%{_dz}%" #<---- ID Exato da plot onde o player está
	
function GetPlotSign(id: string) :: block:
	
	set {_ID::*} to split {_id} at ";"
	
	set {_idx} to {_ID::1} parsed as number
	
	set {_idz} to {_ID::2} parsed as number	
	
	set {_x} to (83*{_idx})-77
	
	set {_z} to (83*{_idz})-78
	
	if block at (location at {_x}, 101, {_z} in world "PlotWorld") is not air:
		
		return block at (location at {_x}, 101, {_z} in world "PlotWorld")
		
function GetLocations(id: string) :: objects:
	
	set {_ID::*} to split {_id} at ";"
	
	set {_idx} to {_ID::1} parsed as number
	
	set {_idz} to {_ID::2} parsed as number
	
	set {_return::1} to (83*{_idx})-7
	
	set {_return::2} to (83*{_idz})-7
	
	set {_return::3} to (83*{_idx})-76
	
	set {_return::4} to (83*{_idz})-76
	
	return {_return::*}

function GetLoc(id: string, block: block) :: boolean:
	
	set {_x.1} to "%(3st element of GetLocations({_id}))%" parsed as number
	
	set {_z.1} to "%(4st element of GetLocations({_id}))%" parsed as number
	
	set {_x.2} to "%(1st element of GetLocations({_id}))%" parsed as number
	
	set {_z.2} to "%(2st element of GetLocations({_id}))%" parsed as number
	
	if {_x.1} <= floor({_block}'s x-coord):
		
		add 1 to {_verf}
	
	if {_z.1} <= floor({_block}'s z-coord):
		
		add 1 to {_verf}
	
	if {_x.2} >= floor({_block}'s x-coord):
		
		add 1 to {_verf}
	
	if {_z.2} >= floor({_block}'s z-coord):
		
		add 1 to {_verf}
	
	if {_verf} = 4:
		
		return true
	
	else:
		
		return false
		
	
on place:
	
	set {_Id} to GetPlotID(block at player)
	
	if GetLoc({_id}, event-block) is false:
		
		if player have permission "plot.RoadPass":
			
			send "" to {_}
			
		else:
			
			cancel event
			
on break:
	
	set {_Id} to GetPlotID(block at player)
	
	if GetLoc({_id}, event-block) is false:
		
		if player have permission "plot.RoadPass":
			
			send "" to {_}
			
		else:
			
			cancel event
			
on item spawn:
	
	if event-world is "PlotWorld":
		
		if tag "Thrower" of event-entity's nbt is not set:
			
			if "%amount of event-item%" is "1":
				
				set {_block} to block at event-entity's location
				
				if {_block}'s metadata "Dropped" is not set:
				
					set {_Items::*} to wheat item, carrot, potato, pumpkin, melon slice, cocoa beans, cactus, sugar cane item, nether wart item and seeds
					
					if {_items::*} contains type of event-item:
					
						set {_Id} to GetPlotID(block at event-entity)
						
						if GetLoc({_id}, block at event-entity) is true:
							
							if GetPlotOwner({_id}) is not "null":
								
								set {_player} to GetPlotOwner({_id}) #<---- string = "MaiconJh"
								
								cancel event
								
								if {PlotStorage::%{_player}%::*} contains event-item:
									set {_} to 0
								else:
									add event-item to {PlotStorage::%{_player}%::*}
									
								add 1 to {PlotStorage::%{_player}%::%event-item%.amount}
								
								send action bar "&b(%{PlotStorage::%{_player}%::%event-item%.amount}%) &6%event-item% foi adicionado para seu armazém." to {_player} parsed as player
								
command /armazem:
	
	trigger:
		
		ArmazemPickup(player)
		
function AmountOfItemsInVar(List: objects) :: objects:
	
	loop {_List::*}:
		
		set {_i} to "%loop-value%"
		
		replace "0", "1", "2", "3", "4", "5", "6", "7", "8" and "9" with "" in {_i}
		
		set {_i} to "%{_i}%" parsed as item type
		
		if "%{_i}%" = "<none>":
			
			set {_i} to 1 of loop-value
			
		set {_n} to number of "%loop-value%" parsed as number
		
		if {_items::*} contains {_i}:
			
			set {_} to "ok"
			
		else:
			
			add {_i} to {_items::*}
			
		if {_n} > 0:
			
			add {_n} to {_amount-%{_i}%}
			
		if {_n} is not set:
			
			add 1 to {_amount-%{_i}%}
			
	loop {_items::*}:
		
		if "%{_amount-%loop-value%}%" = "<none>":
			
			set {_amount-%loop-value%} to 1
			
		add "%{_amount-%loop-value%}%.%loop-value%" to {_return::*}
		
	return {_return::*}
	
function ArmazemPickup(player: player):
	
	set {_chest} to chest with 5 rows named "§8Armazém"
	
	set {_slot} to 10
	
	set {_Items::*} to wheat item, carrot, potato, pumpkin, melon slice, cocoa beans, cactus, sugar cane item, nether wart item and seeds
	
	if {PlotStorage::%{_player}%::*} is set:
		
		set slot 40 of {_chest} to golden nugget named "&aVender tudo" with lore "&8Vender tudo que está no seu armazém." with nbt "{sell.all:true}"
		
	loop {PlotStorage::%{_player}%::*}:
		
		set {_item} to ("%loop-value%" parsed as item)
		
		if "%{_item}%" is not "<none>":
			
			set {_n} to {PlotStorage::%{_player}%::%{_item}%.amount}
			
			set slot {_slot} of {_chest} to {_item} named "&a%{_n}%&7x &a%{_item}%" with lore "%nl%&f⎛&b⊆&r⋂⊃&f⎞&a 64&7x%nl%&e%nl%&f⎛⊂⋂&b⊇&f⎞&e &a2304&7x%nl%&7" with nbt "{pickup:%{_n}%}"
			
			add 1 to {_slot}
	
	if {PlotStorage::%{_player}%::*} is not set:
		
		set slot 22 of {_chest} to barrier named "&cNão há nada por aqui." with lore "&7Todos os items que colher virá para seu armazém."
		
	open {_chest} to {_player}
	
on inventory click:
	
	if display name of player's current inventory is "§8Armazém":
		
		cancel event
		
		set {_player} to player
		
		if tag "sell.all" of (clicked item)'s nbt is set:
			
			loop {PlotStorage::%{_player}%::*}:
		
				set {_item} to ("%loop-value%" parsed as item)
				
				if "%{_item}%" is not "<none>":
					
					set {_id} to "%{_item}%"
					
					replace all " " with "." in {_id}
					
					if {SellPrice::%{_id}%} is set:
						
						set {_amount} to {PlotStorage::%{_player}%::%{_item}%.amount}
						
						set {_price} to GetPrice({_id}, "Sell")
						
						set {_total} to {_price}*{_amount}
						
						add {_total} to player's balance
						
						clear {PlotStorage::%{_player}%::%{_item}%.amount}
						
						remove {_item} from {PlotStorage::%{_player}%::*}
						
						send "&7[&6Loja&7] &7Vendido &a%{_amount}%&7x &f%{_item}% &7por &6%{_total}% coins"
						
			play sound "ENTITY_ARROW_HIT_PLAYER" with volume 1 with pitch 0 for player
			
			ArmazemPickup(player)
			
		if tag "pickup" of (clicked item)'s nbt > 0:
			
			set {_item} to "%type of clicked item%" parsed as item
			
			if "%click type%" contains "right":
				
				set {_pickup} to (tag "pickup" of (clicked item)'s nbt)
				
				if {_pickup} > 2304:
					
					set {_pickup} to 2304
					
			if "%click type%" contains "left":
				
				if (tag "pickup" of (clicked item)'s nbt) >= 64:
					
					set {_pickup} to 64
					
				if (tag "pickup" of (clicked item)'s nbt) < 64:
					
					set {_pickup} to (tag "pickup" of (clicked item)'s nbt)
					
			if player's inventory has space for {_pickup} of {_item}:
				
				set {_} to true
				
			else:
				
				if space for {_item} in player's inventory = 0:
					
					send "&cNão há mais espaço em seu inventário." to {_player}
					
					stop
					
				else:
					
					set {_pickup} to space for {_item} in player's inventory
					
			remove {_pickup} from {PlotStorage::%{_player}%::%{_item}%.amount}
			
			if {PlotStorage::%{_player}%::%{_item}%.amount} <= 0:
				
				clear {PlotStorage::%{_player}%::%{_item}%.amount}
				
				remove {_item} from {PlotStorage::%{_player}%::*}
				
			give {_pickup} of {_item} to player
			
			send "&eRecolhido &a%{_pickup}%&7x &a%{_item}% &edo seu armazém." to player
			
			wait 1 tick
			
			ArmazemPickup(player)
			
command /tes:
	trigger:
		
		set {_player} to player
		
		loop {PlotStorage::%{_player}%::*}:
			
			clear {PlotStorage::%{_player}%::%loop-value%}
		
		clear {PlotStorage::%{_player}%::*}
		
on break:
	
	if event-world is "PlotWorld":
		
		if "%event-block%" contains "dropper", "hopper", "dispenser", "chest" or "furnace":
			
			set event-block's metadata "Dropped" to true
			
			wait 3 ticks
			
			clear event-block's metadata "Dropped"
			
on dispense:
	
	if event-world is "PlotWorld":
		
		if "%event-block%" contains "dispenser" or "dropper":
			
			cancel event
			

 

 

Olá, na verdade não... É até que bem simples integrar Skript com PlotSquared porquê a API é simples, me chama no discord que te passo mais informações.

 

Porém esse plugin de /armazem complicaria por conta do desempenho.

Link para o comentário
Compartilhar em outros sites

ANÁLISE DE CONTEÚDO DESATUALIZADO

Este tópico foi automaticamente arquivado devido à falta de atualizações recentes ou ao fato de o conteúdo estar desatualizado em relação às práticas ou informações atuais. Para manter a qualidade e relevância das discussões na comunidade, tópicos sem novas atualizações ou com informações obsoletas são periodicamente arquivados.

Se houver novos dados ou atualizações pertinentes ao tema, sinta-se à vontade para criar um novo tópico com as informações atualizadas.

Equipe de Moderação
Gamer's Board
Link para o comentário
Compartilhar em outros sites

Visitante
Este tópico está impedido de receber novos posts.
×
×
  • Criar Novo...