Jump to content

Is there any way to simplify this Skript?


Recommended Posts

This is my skript for the blast enchantment. Is there a way to simplify this code?

#                 #
#Blast Enchantment#
#                 #


on break:
	if lore of player's tool contains "&cBlast I":
		cancel event
		loop blocks in radius 1 around the target block:
			if loop-block is yellow concrete:
				set loop-block to air
				drop 1 yellow concrete
			else if loop-block is sponge:
				set loop-block to air
				drop 1 sponge

on break:
	if lore of player's tool contains "&cBlast II":
		cancel event
		loop blocks in radius 2 around the target block:
			if loop-block is yellow concrete:
				set loop-block to air
				drop 1 yellow concrete
			else if loop-block is sponge:
				set loop-block to air
				drop 1 sponge


on break:
	if lore of player's tool contains "&cBlast III":
		cancel event
		loop blocks in radius 3 around the target block:
			if loop-block is yellow concrete:
				set loop-block to air
				drop 1 yellow concrete
			else if loop-block is sponge:
				set loop-block to air
				drop 1 sponge


on break:
	if lore of player's tool contains "&cBlast IV":
		cancel event
		loop blocks in radius 4 around the target block:
			if loop-block is yellow concrete:
				set loop-block to air
				drop 1 yellow concrete
			else if loop-block is sponge:
				set loop-block to air
				drop 1 sponge


on break:
	if lore of player's tool contains "&cBlast V":
		cancel event
		loop blocks in radius 5 around the target block:
			if loop-block is yellow concrete:
				set loop-block to air
				drop 1 yellow concrete
			else if loop-block is sponge:
				set loop-block to air
				drop 1 sponge

#                              #
#Blast Enchantment with Fortune#
#                              #

on break:
	tool of the player is enchanted with fortune 1
	if lore of player's tool contains "&cBlast I":
		cancel event
		loop blocks in radius 1 around the target block:
			if loop-block is yellow concrete:
				set loop-block to air
				drop 2 yellow concrete
			else if loop-block is sponge:
				set loop-block to air
				drop 2 sponge

on break:
	tool of the player is enchanted with fortune 1
	if lore of player's tool contains "&cBlast II":
		cancel event
		loop blocks in radius 2 around the target block:
			if loop-block is yellow concrete:
				set loop-block to air
				drop 2 yellow concrete
			else if loop-block is sponge:
				set loop-block to air
				drop 2 sponge


on break:
	tool of the player is enchanted with fortune 1
	if lore of player's tool contains "&cBlast III":
		cancel event
		loop blocks in radius 3 around the target block:
			if loop-block is yellow concrete:
				set loop-block to air
				drop 2 yellow concrete
			else if loop-block is sponge:
				set loop-block to air
				drop 2 sponge


on break:
	tool of the player is enchanted with fortune 1
	if lore of player's tool contains "&cBlast IV":
		cancel event
		loop blocks in radius 4 around the target block:
			if loop-block is yellow concrete:
				set loop-block to air
				drop 2 yellow concrete
			else if loop-block is sponge:
				set loop-block to air
				drop 2 sponge


on break:
	tool of the player is enchanted with fortune 1
	if lore of player's tool contains "&cBlast V":
		cancel event
		loop blocks in radius 5 around the target block:
			if loop-block is yellow concrete:
				set loop-block to air
				drop 2 yellow concrete
			else if loop-block is sponge:
				set loop-block to air
				drop 2 sponge


#-------#

on break:
	tool of the player is enchanted with fortune 2
	if lore of player's tool contains "&cBlast I":
		cancel event
		loop blocks in radius 1 around the target block:
			if loop-block is yellow concrete:
				set loop-block to air
				drop 3 yellow concrete
			else if loop-block is sponge:
				set loop-block to air
				drop 3 sponge

on break:
	tool of the player is enchanted with fortune 2
	if lore of player's tool contains "&cBlast II":
		cancel event
		loop blocks in radius 2 around the target block:
			if loop-block is yellow concrete:
				set loop-block to air
				drop 3 yellow concrete
			else if loop-block is sponge:
				set loop-block to air
				drop 3 sponge


on break:
	tool of the player is enchanted with fortune 2
	if lore of player's tool contains "&cBlast III":
		cancel event
		loop blocks in radius 3 around the target block:
			if loop-block is yellow concrete:
				set loop-block to air
				drop 3 yellow concrete
			else if loop-block is sponge:
				set loop-block to air
				drop 3 sponge


on break:
	tool of the player is enchanted with fortune 2
	if lore of player's tool contains "&cBlast IV":
		cancel event
		loop blocks in radius 4 around the target block:
			if loop-block is yellow concrete:
				set loop-block to air
				drop 3 yellow concrete
			else if loop-block is sponge:
				set loop-block to air
				drop 3 sponge


on break:
	tool of the player is enchanted with fortune 2
	if lore of player's tool contains "&cBlast V":
		cancel event
		loop blocks in radius 5 around the target block:
			if loop-block is yellow concrete:
				set loop-block to air
				drop 3 yellow concrete
			else if loop-block is sponge:
				set loop-block to air
				drop 3 sponge


#-------#

on break:
	tool of the player is enchanted with fortune 3
	if lore of player's tool contains "&cBlast I":
		cancel event
		loop blocks in radius 1 around the target block:
			if loop-block is yellow concrete:
				set loop-block to air
				drop 4 yellow concrete
			else if loop-block is sponge:
				set loop-block to air
				drop 4 sponge

on break:
	tool of the player is enchanted with fortune 3
	if lore of player's tool contains "&cBlast II":
		cancel event
		loop blocks in radius 2 around the target block:
			if loop-block is yellow concrete:
				set loop-block to air
				drop 4 yellow concrete
			else if loop-block is sponge:
				set loop-block to air
				drop 4 sponge


on break:
	tool of the player is enchanted with fortune 3
	if lore of player's tool contains "&cBlast III":
		cancel event
		loop blocks in radius 3 around the target block:
			if loop-block is yellow concrete:
				set loop-block to air
				drop 4 yellow concrete
			else if loop-block is sponge:
				set loop-block to air
				drop 4 sponge


on break:
	tool of the player is enchanted with fortune 3
	if lore of player's tool contains "&cBlast IV":
		cancel event
		loop blocks in radius 4 around the target block:
			if loop-block is yellow concrete:
				set loop-block to air
				drop 4 yellow concrete
			else if loop-block is sponge:
				set loop-block to air
				drop 4 sponge


on break:
	tool of the player is enchanted with fortune 3
	if lore of player's tool contains "&cBlast V":
		cancel event
		loop blocks in radius 5 around the target block:
			if loop-block is yellow concrete:
				set loop-block to air
				drop 4 yellow concrete
			else if loop-block is sponge:
				set loop-block to air
				drop 4 sponge





 

Hello, I'm Nolan!


Cool Links

Vote Please - bit.ly/3tMXajE

MC Server - bit.ly/3hqYAOy


Please leave a like if I helped!


 

 

Link to comment
Share on other sites

Alright I'm unsure if I'm wrong here but in theory after the on break you could check if the lore contains "Blast" then you add all the lines into a list loop through them to get the line with the "Blast X". Then you split this line by " " a space that way you can get the number or the enchantment level of blast. After that or before that even you can check the enchantment level of fortune on the players tool with https://skripthub.net/docs/?id=929 and done.

Edit: Why even check for the fortune level is there an effect of it I'm missing?

Edited by Starshinex3
  • Like 1

tumblr_lqahoaPLkC1ql1l0v.gif

Feel free to add me on discord if you:

dc3456c-e0ec58e8-c807-43e3-b986-5224b91a need help with plugins

dc3456c-e0ec58e8-c807-43e3-b986-5224b91a need help with skripts

dc3456c-e0ec58e8-c807-43e3-b986-5224b91a need to vent about something

tumblr_lqahoaPLkC1ql1l0v.gif

>[ ‧₊˚꒰ʚ Starshine ɞ ‧✦ *#2683 ]<

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...