RSDeluxe-Signals.sk

Created by death source

Other available versions. Ordered by newest to oldest versions:

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.

#RedstoneDeluxe - signals
#Made by Death_Source
#Feel free to reach out to me on Spigot or Dicsord.
#Discord: Death_Source (Tag is #9999 or #0336, can change)


options:
	#BLOCK TO BE USED FOR SIGNALS. USE UNCOMMON BLOCKS ONLY. Default is cyan glazed terracotta.
	DefaultBlock: cyan glazed terracotta  
	#AMOUNT OF TICKS PER SIGNAL CHECK. Must be multiple or factor of 16.
	#NOTE: Lower = faster but lags server, Higher = slower but reduces lag. Default is 4.
	Check: 4    
	#PERMISSION NAME. Default is RSDeluxe.
	Permission: RSDeluxe
	#PERMISSION MESSAGE FOR COMMANDS.
	PermMsg: &c▌ &aYou don't have permission to use that command!

command /signal [<text>]:
	permission message: {@PermMsg}
	permission: {@Permission}.signal
	trigger:
		if arg-1 is not set:
			send "&c▌ &aSignals are currently set to &d%{signals}%"
		else:
			if arg-1 = "list":
				loop {signalblocks::*}:
					set {_l1} to {link::%loop-value%}
					send formatted "<command:%scmd({_l1})%><tooltip:&dClick to teleport!>%sformat({_l1})%<reset>"
				stop
			set {signals} to true if arg-1 = "true" or "on"
			if arg-1 = "false" or "off":
				set {signals} to false 
				loop {signalblocks::*}:
					set block at loop-value to {@DefaultBlock} if block at loop-value != {@DefaultBlock} 
			send "&c▌ &aSet signals to &d%{signals}%!"

every {@Check} ticks:
	signalcheck() if {signals} is true

function signalcheck():
	loop {signalblocks::*}:
		if (block at loop-value) != {@DefaultBlock} or redstone block:
			remove loop-value from {signalblocks::*} 
			
		else if (redstone power of block at loop-value) > 0:
			if {link::%loop-value%} is set:
				if block at {link::%loop-value%} is {@DefaultBlock} or redstone block:
					set block at {link::%loop-value%} to redstone block
					
		
		else if (redstone power of block at loop-value) = 0:
			if {link::%loop-value%} is set:
				if block at {link::%loop-value%} is redstone block:
					set block at {link::%loop-value%} to {@DefaultBlock}
					
	

						


					
on left click on {@DefaultBlock}:
	player has permission "{@Permission}.interact"
	tool = air
	player is sneaking
	cancel event
	if {link::%location of event-block%} is set:
		set {_l1} to {link::%location of event-block%}
		send formatted "&c▌ &aLink of specified signal block is currently set at <command:%scmd({_l1})%><tooltip:&dClick to teleport!>%sformat({_l1})%<reset>"
		send "&c▌ &aShift right-click to set a new link."
	else:
		send "&c▌ &aNo link is currently set for the specified signal block!"
on right click on {@DefaultBlock}:
	player has permission "{@Permission}.interact"
	tool = air
	player is sneaking
	if {lastsignal::%player's uuid%} is not set:
		send "&c▌ &aSneak Right-Click on another signal block to set the new link!"
		set {lastsignal::%player's uuid%} to location of event-block
	else:
		if {lastsignal::%player's uuid%} = location of event-block:
			send "&c▌ &aYou can't set a link for a signal block to itself."
			stop
		set {link::%{lastsignal::%player's uuid%}%} to location of event-block
		set {_l1} to {lastsignal::%player's uuid%}
		set {_l2} to location of event-block

		send formatted "&c▌ &aSet the link for signal block at <command:%scmd({_l1})%><tooltip:&dClick to teleport!>%sformat({_l1})%<reset> &ato signal block at <command:%scmd({_l2})%><tooltip:&dClick to teleport!>%sformat({_l2})%<reset>"
		clear {lastsignal::%player's uuid%}

function scmd(l: location) :: text:
	return "/signaltp %x-coordinate of {_l}% %y-coordinate of {_l}% %z-coordinate of {_l}% %world of {_l}%"
command /signaltp [<number>] [<number>] [<number>] [<world>]:
	permission: {@Permission}.signaltp
	permission message: {@PermMsg}
	trigger:
		teleport player to location(arg-1, arg-2, arg-3, arg-4)
function sformat(l: location) :: text:
	return "&d[&b%x-coordinate of {_l}% %y-coordinate of {_l}% %z-coordinate of {_l}%&d]"

on place of {@DefaultBlock}:
	player has permission "{@Permission}.interact"
	set {_n} to ((size of {signalblocks::*}) + 1)
	set {signalblocks::%{_n}%} to location of event-block
on break of {@DefaultBlock}:
	player has permission "{@Permission}.interact"
	remove location of event-block from {signalblocks::*}