magicwands.sk

Created by JustDylan

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.

#-----------------------------------------------------------------#
#                                                                 #
#                         By _JustDylan_                          #
#                                                                 #
#    Depends on: Skript, SkQuery, skript-mirror, SkDragon.        #
#                                                                 #
#    Be aware that this skript is made for 1.12.2 and requires    #
#    the latest version of the plugins above, that are coded for  #
#    1.12.2                                                       #
#                                                                 #
#            Please don't edit anyting down below                 #
#            When you do you might break the script               #
#                                                                 #
#-----------------------------------------------------------------#

#---Main---#
options:
	version: "2.0.0"

#wand converter for older versions
on click:
	if line 2 of lore of player's tool is "&k®®":
		set line 2 of lore of player's tool to "&k&c&e"
#variable cleanup
on load:
	clear {wands::tool::*}
	clear {wands::loopedentity::*}
on break:
	if {wands::OutOfUse} isn't true:
		if line 2 of lore of player's tool is "&k&c&e":
			cancel event

on death:
	if {wands::dropondeath} is false:
		loop drops:
			if line 2 of lore of loop-item contains "&k&c&e":
				remove loop-item from drops
				
expression invisable value of %number%:
	get:
		set {_text} to "%expr-1%"
		set {_length} to {_text}.length() * 2
		replace all "" in {_text} with "&"
		set {_text} to {_text}.substring(0, {_length})
		return colored {_text}

expression visable value of %text%:
	get:
		set {_lore} to expr-1
		replace all "ยง" in {_lore} with ""
		return {_lore} parsed as number

on drop:
	line 2 of lore of event-item contains "&k&c&e"
	player has 1 of event-item
	set {_item} to event-item
	set {_lore} to line 1 of {_item}'s lore
	add 1 to {wands::amount}
	set {wands::savedwands::&k%{wands::amount}%::spellIndex} to {wands::savedwands::%{_lore}%::spellIndex}
	set {wands::savedwands::&k%{wands::amount}%::savedSpells::*} to {wands::savedwands::%{_lore}%::savedSpells::*}
	set {wands::savedwands::&k%{wands::amount}%::modifiable} to {wands::savedwands::%{_lore}%::modifiable}
	set {wands::savedwands::&k%{wands::amount}%::particles} to {wands::savedwands::%{_lore}%::particles}
	set line 1 of {_item}'s lore to "&k%{wands::amount}%"

import:
    net.md_5.bungee.api.ChatMessageType
    net.md_5.bungee.api.chat.TextComponent
        
effect display actionbar %string% to %player%:
    trigger:
        set {_component} to new TextComponent()
        {_component}.setText(expr-1)
        expr-2.spigot().sendMessage[net.md_5.bungee.api.ChatMessageType, net.md_5.bungee.api.chat.BaseComponent](ChatMessageType.ACTION_BAR!, {_component})

function PlS(s: string, v: number, p: number, l: location, f: players):
	loop {_f::*}:
		if loop-value's world isn't {_l}'s world:
			remove loop-value from {_f::*}
	play sound {_s} with volume {_v} and pitch {_p} at {_l} for {_f::*}

function spellLocation(p: player, range: number = 30) :: location:
	if distance between location of targeted entity of {_p} and location of {_p} is less than {_range} where [targeted entity of {_p} is alive]:
		set {_loc} to location of block at target entity of {_p}
	else:
		loop blocks from the block above {_p} to the block {_range} in front of {_p}:
			set {_loc} to location of block above loop-block 
			if loop-block is solid:
				stop loop
	return {_loc}

function invailidLocation(p: player):
	display actionbar "&c&lNo living entity selected!" to {_p}
	if distance between location of targeted block of {_p} and location of {_p} is more than 10:
		drawDot count 6, particle fireworkspark, speed 0.3, XYZ 0.3, 0.3, 0.3, center location of block above block 10 in front of {_p}, visibleRange 320
	else if targeted block of {_p} is set:
		drawDot count 6, particle fireworkspark, speed 0.3, XYZ 0.3, 0.3, 0.3, center location of block above targeted block of {_p}, visibleRange 320
	else:
		drawDot count 6, particle fireworkspark, speed 0.3, XYZ 0.3, 0.3, 0.3, center location of block above block 10 in front of {_p}, visibleRange 320
		
function damageEffect(n: number, a: living entity, v: living entity, i: item):
	set {_l} to {_a}'s tool
	set {_a}'s tool to {_i}
	make {_a} damage {_v} by {_n} * 2
	delete velocity of {_v}
	set {_a}'s tool to {_l}

#---Commands---#
on command "/sk reload magicwands":
	set {_now} to now
	wait a tick
	message "&8&l[&6&lWands&8&l]&r reloaded in &6%difference between 1 tick and difference between {_now} and now%" to all players where [player input has permission "skript.admin"]

function contains(l: objects, v: object) :: boolean:
	loop {_l::*}:
		if loop-value is {_v}:
			return true
	return false

function createCustomWand(p: player):
	set line 2 of lore of {_p}'s tool to "&k&c&e"
	set {wands::amount} to {wands::amount} + 1
	set {_index} to invisable value of {wands::amount}
	set line 1 of lore of {_p}'s tool to "%{_index}%"
	set {wands::savedwands::%{_index}%::spellIndex} to 1

function clearWand(p: player):
	set {_lore} to line 1 of lore of {_p}'s tool
	clear {wands::savedwands::%{_lore}%::*}
	set lore of {_p}'s tool to ""

function getArtifact(p: player, n: text, l: text, i: item):
	if {_l} is "-1":
		give unbreakable bow of power 2 and infinity 1 named "&cEmpire Bow" with lore "&k-1||&k&c&e" to {_p}
	else:
		give {_p} {_i} named {_n} with lore "&k%{_l}%||&k&c&e"
	set {wands::savedwands::&k%{wands::amount}%::modifiable} to false
	
function getDefaultWand(p: player, i: item):
	set {wands::amount} to {wands::amount} + 1
	set {_index} to invisable value of {wands::amount}
	set {_n} to {_i}'s name
	give {_p} {_i} named {_n} with lore "%{_index}%||&k&c&e"
	if {_n} is "&cEmpire Wand":
		add integers from 1 to 6 to {wands::savedwands::%{_index}%::savedSpells::*}
		set {wands::savedwands::%{_index}%::particles} to "empire"
	if  {_n} is "&cBlood Wand":
		add integers from 7 to 11 to {wands::savedwands::%{_index}%::savedSpells::*}
		set {wands::savedwands::%{_index}%::particles} to "blood"
	if  {_n} is "&cRafg Wand":
		add integers from 12 to 17 and 5 to {wands::savedwands::%{_index}%::savedSpells::*}
		set {wands::savedwands::%{_index}%::particles} to "rafg"
	if  {_n} is "&6Celcrius Wand":
		add integers from 18 to 21, 35 and 36 to {wands::savedwands::%{_index}%::savedSpells::*}
		set {wands::savedwands::%{_index}%::particles} to "celcrius"
	if  {_n} is "&8Dark Wand":
		add integers from 22 to 25 to {wands::savedwands::%{_index}%::savedSpells::*}
		set {wands::savedwands::%{_index}%::particles} to "dark"
	if  {_n} is "&rKaj Wand":
		add integers from 26 to 29 and 37 to {wands::savedwands::%{_index}%::savedSpells::*}
		set {wands::savedwands::%{_index}%::particles} to "kaj"
	if  {_n} is "&2Mephi Wand":
		add integers from 30 to 34 and 5 to {wands::savedwands::%{_index}%::savedSpells::*}
		set {wands::savedwands::%{_index}%::particles} to "mephi"
	set {wands::savedwands::%{_index}%::spellIndex} to 1
	set {wands::savedwands::%{_index}%::modifiable} to false

function WandsCreatorGUI(p: player):
	open chest inventory named "   &8&l[&6&lWands&8&l] creator menu" to {_p}
	if {_p}'s tool isn't a bow:
		set slot 11 of {_p}'s current inventory to a blaze rod named "&dCreate a custom wand" with lore "This type of magic item||allowes you to bind spells||to your custom wand"
		set slot 13 of {_p}'s current inventory to a golden sword named "&dCreate a custom dagger" with lore "This type of magic item||gives you the abilities||that you'd normally have||with the theros dagger"
		set slot 15 of {_p}'s current inventory to iron bars block named "&cLocked" with lore "You need to hold a bow||in order to do this"
	else:
		set slot 11 of {_p}'s current inventory to iron bars block named "&cLocked" with lore "You need to hold something||else than a bow in||order to do this"
		set slot 13 of {_p}'s current inventory to iron bars block named "&cLocked" with lore "You need to hold something||else than a bow in||order to do this"
		set slot 15 of {_p}'s current inventory to a bow named "&cCreate a custom bow" with lore "This type of magic item||allowes you to shoot||cursed arrows"

on inventory click:
	event-item isn't air
	if clicked inventory's display name is "              &8&l[&6&lWands&8&l]":
		cancel event
		name of event-item isn't " "
		PlS("ui.button.click", 1, 1, player, player)
		if event-item's name is "&cEmpire Bow":
			getArtifact(player, "&cEmpire Bow", "-1", bow)
		else if event-item's name is "&8Theros Dagger":
			getArtifact(player, "&8Theros Dagger", "-2", mall music disc)
		else:
			getDefaultWand(player, event-item)
	else if clicked inventory's display name is "   &8&l[&6&lWands&8&l] creator menu":
		cancel event
		if event-item's name isn't "&cLocked":
			PlS("ui.button.click", 1, 1, player, player)
			if event-item's name is "&dCreate a custom wand":
				createCustomWand(player)
			if event-item's name is "&dCreate a custom dagger":
				set lore of player's tool to "&k-2||&k&c&e"
			if event-item's name is "&cCreate a custom bow":
				set lore of player's tool to "&k-1||&k&c&e"
			close player's inventory
	else if clicked inventory's display name is " &8&l[&6&lWands&8&l] unregister wand?":
		cancel event
		PlS("ui.button.click", 1, 1, player, player)
		if event-item's name is "&aYes":
			if line 1 of lore of player's tool is "&k-1" or "&k-2":
				set lore of player's tool to ""
			else:
				clearWand(player)
			WandsCreatorGUI(player)
		else:
			close player's inventory

command /wands [<text>] [<text>] [<text>] [<text>]:
	usage: &6wands [<arguments>]
	description: &6The main command for the Wands skript
	trigger:
		if arg 1 isn't set:
			if player has permission "wands.get":
				open chest inventory named "              &8&l[&6&lWands&8&l]" to player
				loop integers from 6 to 8:
					set slot loop-number of player's current inventory to iron bars block named " "
				loop integers from 9 to 17:
					set slot loop-number of player's current inventory to gray glass named " "
				loop integers from 20 to 26:
					set slot loop-number of player's current inventory to iron bars block named " "
				set slot 0 of player's current inventory to blaze rod named "&cEmpire Wand" with lore "click to obtain"
				set slot 1 of player's current inventory to nether wart item named "&cBlood Wand" with lore "click to obtain"
				set slot 2 of player's current inventory to stick named "&cRafg Wand" with lore "click to obtain"
				set slot 3 of player's current inventory to blaze powder named "&6Celcrius Wand" with lore "click to obtain"
				set slot 4 of player's current inventory to stick named "&8Dark Wand" with lore "click to obtain"
				set slot 5 of player's current inventory to blaze rod named "&rKaj Wand" with lore "click to obtain"
				set slot 6 of player's current inventory to iron hoe named "&2Mephi Wand" with lore "click to obtain"
				set slot 18 of player's current inventory to unbreakable bow of power 2 and infinity 1 named "&cEmpire Bow" with lore "click to obtain"
				set slot 19 of player's current inventory to mall music disc named "&8Theros Dagger" with lore "click to obtain"
			else: 
				message "&8&l[&6&lWands&8&l]&c You need the permission &ewands.get&c to do that!"
		else if arg 1 is "set":
			if arg 2 is "cooldown" or "particles" or "customcooldown":
				if arg-2 is "cooldown":
					if sender has permission "wands.configure":
						if arg-3 is "all":
							if arg-4 parsed as a number is set:
								set {_seconds} to round(arg-4 parsed as number)
								set {wands::cooldown::&cEmpire Wand} to "%{_seconds}% seconds" parsed as an timespan
								set {wands::cooldown::&cEmpire Bow} to "%{_seconds}% seconds" parsed as an timespan
								set {wands::cooldown::&cBlood Wand} to "%{_seconds}% seconds" parsed as an timespan
								set {wands::cooldown::&cRafg Wand} to "%{_seconds}% seconds" parsed as an timespan
								set {wands::cooldown::&6Celcrius Wand} to "%{_seconds}% seconds" parsed as an timespan
								set {wands::cooldown::&8Dark Wand} to "%{_seconds}% seconds" parsed as an timespan
								set {wands::cooldown::&rKaj Wand} to "%{_seconds}% seconds" parsed as an timespan
								set {wands::cooldown::&8Theros Dagger} to "%{_seconds}% seconds" parsed as an timespan
								set {wands::cooldown::&2Mephi Wand} to "%{_seconds}% seconds" parsed as an timespan
								message "&8&l[&6&lWands&8&l]&r all the cooldowns of the default wands are set to &a%{_seconds}%&r."
							else:
								message "&8&l[&6&lWands&8&l]&c your fourth argument must be a number!"
						else if arg-3 is "hand":
							if arg-4 parsed as number is set:
								if arg 4 doesn't contain ".":
									set {wands::cooldown::%name of player's tool%} to "%arg 4% seconds" parsed as an timespan
									message "&8&l[&6&lWands&8&l]&r Cooldown of %name of player's tool%&8: &d%arg 4% second(s)"
								else:
									message "&8&l[&6&lWands&8&l]&c your fourth argument can't contain decimals!"
							else:
								message "&8&l[&6&lWands&8&l]&c your fourth argument must be a number!"
						else:
							message "&8&l[&6&lWands&8&l]&c Invailid argument!"
					else:
						message "&8&l[&6&lWands&8&l]&c You need the permission &ewands.configure&c to do that!"
				if arg-2 is "customcooldown":
					if sender has permission "wands.customize":
						if arg 3 is set:
							if modifiable(player) is true:
								if registered(player) is true:
									message "&8&l[&6&lWands&8&l]&r Cooldown is set to &a%arg 3% seconds"
									set {wands::cooldown::%name of player's tool%} to "%arg 3% seconds" parsed as timespan
						else:
							message "&8&l[&6&lWands&8&l]&c Invailid number!"
					else:
						message "&8&l[&6&lWands&8&l]&c You need the permission &ewands.customize&c to do that!"
				if arg-2 is "particles":
					if sender has permission "wands.customize":
						if modifiable(player) is true:
							if registered(player) is true:
								if typeID(player) is "wand":
									if arg 3 is "empire" or "blood" or "rafg" or "celcrius" or "dark" or "kaj" or "mephi":
										set {wands::savedwands::%line 1 of lore of player's tool%::particles} to arg 3
										message "&8&l[&6&lWands&8&l]&r particles are set to &a%{wands::savedwands::%line 1 of lore of player's tool%::particles}%"
									else:
										message "&8&l[&6&lWands&8&l]&c Invailid particle type"
								else:
									message "&8&l[&6&lWands&8&l]&c Particles can only be set for custom wands!"
					else:
						message "&8&l[&6&lWands&8&l]&c You need the permission &ewands.customize&c to do that!"
			else:
				message "&8&l[&6&lWands&8&l]&c This cannot be set!"
		else if arg 1 is "disable":
			if sender has permission "wands.configure":
				set {wands::OutOfUse} to true
				message "&8&l[&6&lWands&8&l]&r Status: &cdisabled"
			else:
				message "&8&l[&6&lWands&8&l]&c You need the permission &ewands.configure&c to do that!"
		else if arg 1 is "enable":
			if sender has permission "wands.configure":
				clear {wands::OutOfUse}
				message "&8&l[&6&lWands&8&l]&r Status: &aenabled"
			else:
				message "&8&l[&6&lWands&8&l]&c You need the permission &ewands.configure&c to do that!"
		else if arg 1 is "dropondeath":
			if sender has permission "wands.configure":
				if arg 2 is set:
					set {wands::dropondeath} to arg 2 parsed as boolean
					message "&8&l[&6&lWands&8&l]&r Drop wands on death: &7%{wands::dropondeath}%"
				else:
					message "&6Correct format: &r/wands dropondeath <yes|no>"
			else:
				message "&8&l[&6&lWands&8&l]&c You need the permission &ewands.configure&c to do that!"
		else if arg 1 is "permission":
			if sender has permission "wands.configure":
				if arg-2 parsed as boolean is set:
					set {wands::permission} to arg-2 parsed as boolean
					message "&8&l[&6&lWands&8&l]&r Enable player's to require wands.use for wand usage: %arg-2%"
				else:
					message "&6Correct format: &r/wands permission <yes|no>"
			else:
				message "&8&l[&6&lWands&8&l]&c You need the permission &ewands.configure&c to do that!"
		else if arg 1 is "spells":
			if sender has permission "wands.customize":
				loop {wands::spellID::*}:
					if loop-index parsed as number is more than 0:
						add loop-value to {_text::*}
				message "&6Spells (%size of {_text::*}%):&r %{_text::*}%"
			else:
				message "&8&l[&6&lWands&8&l]&c You need the permission &ewands.customize&c to do that!"
		else if arg 1 is "register":
			if sender has permission "wands.customize":
				if player's tool isn't air:
					if name of player's tool is set:
						if line 2 of lore of player's tool isn't "&k&c&e":
							WandsCreatorGUI(player)
						else:
							if modifiable(player) is true:
								open chest inventory named " &8&l[&6&lWands&8&l] unregister wand?" to player
								if line 1 of lore of player's tool is "&k-1" or "&k-2":
									set slot 12 of player's current inventory to light green glass named "&aYes"
								else:
									set slot 12 of player's current inventory to light green glass named "&aYes"
								set slot 14 of player's current inventory to red glass named "&cNo"
					else:
						message "&8&l[&6&lWands&8&l] &cYou have to give your wand a name!"
				else:
					message "&8&l[&6&lWands&8&l] &cYou aren't holding anything!"
		else if arg 1 is "help":
			message "&e ---- &6Help: Wands&e -- &6Page &c1&6/&c1&e ----"
			message "&6/wands info&r: Info about the wands script."
			if sender has permission "wands.get":
				message "&6/wands&r: Creates a gui that contains all the wands."
			if sender has permission "wands.configure":
				message "&6/wands set cooldown <wand name|all> <number>&r: Sets the cooldown on the wand."
				message "&6/wands disable&r: Disables all wand usage."
				message "&6/wands enable&r: Enables all wand usage."
				message "&6/wands dropondeath <yes|no>&r: Prevents all the wands from being used if enabled."
				message "&6/wands permission&r: Enable/disable permission requirement for wand usage."
			if sender has permission "wands.customize":
				message "&6/wands spells&r: Shows the player a list of all available spells."
				message "&6/wands register&r: Use this command to create a custom wand."
				message "&6/wands set particles <vailid particle>&r: Allowes you to set the particles that appear when using the spell selector."
				message "&6/wands set customcooldown <number>&r: This command sets the cooldown of the custom item in your hand"
				message "&6/bind <spell name|all>&r: This command is used to bind spells to a wand."
				message "&6/unbind <spell name|all>&r This command is used to remove spells from the wand."
					
		else if arg 1 is "info":
			set {_v} to {@version}
			message "&e ---- &6Wands&e ----"
			message "&6Created by: &e_JustDylan_"
			message "&6Current version:&e %{_v}%"
			message "&6Resource page:&r <url:https://forums.skunity.com/resources/magic-wands.525/>&n&olink"
			
		else:
			message "&8&l[&6&lWands&8&l]&c Unknown arguments"
			message "&8&l[&6&lWands&8&l]&r Try &e/wands help"

command /bind [<text>]:
	trigger:
		if sender has permission "wands.customize":
			if arg 1 is set:
				if modifiable(player) is true:
					if registered(player) is true:
						if arg 1 isn't "all":
							loop {wands::spellID::*}:
								if loop-value is arg 1:
									if loop-index parsed as number > 0:
										if contains({wands::savedwands::%line 1 of lore of player's tool%::savedSpells::*}, loop-index parsed as number) is false:
											add loop-index parsed as number to {wands::savedwands::%line 1 of lore of player's tool%::savedSpells::*}
											message "&8&l[&6&lWands&8&l] &r%{wands::spellID::%loop-index%}% is &asuccessfully&r bound"
											stop
										else:
											message "&8&l[&6&lWands&8&l] &cThis spell is already bound!"
											stop
							message "&8&l[&6&lWands&8&l] &cThis spell doesn't exist!"
						else:
							clear {wands::savedwands::%line 1 of lore of player's tool%::savedSpells::*}
							loop {wands::spellID::*}:
								if loop-index parsed as number > 0:
									add loop-index parsed as number to {wands::savedwands::%line 1 of lore of player's tool%::savedSpells::*}
							message "&8&l[&6&lWands&8&l] &asuccessfully&r bound all spells"
			else:
				message "&6/bind&r <spell name|all>"
		else:
			message "&8&l[&6&lWands&8&l]&c You need the permission &cwands.customize&e to do that!"
			
command /unbind [<text>]:
	trigger:
		if sender has permission "wands.customize":
			if arg 1 is set:
				if modifiable(player) is true:
					if registered(player) is true:
						if {wands::savedwands::%line 1 of lore of player's tool%::savedSpells::*} > 0:
							if arg 1 is "all":
								clear {wands::savedwands::%line 1 of lore of player's tool%::savedSpells::*}
								message "&8&l[&6&lWands&8&l] &rAll spells are &asuccessfully&r unbound"
							else:
								loop {wands::spellID::*}:
									if loop-value is arg 1:
										remove loop-index parsed as number from {wands::savedwands::%line 1 of lore of player's tool%::savedSpells::*}
										message "&8&l[&6&lWands&8&l] &aSuccessfully&r unbound %loop-value%"
										stop
								message "&8&l[&6&lWands&8&l] &cThis spells is not bound"
						else:
							message "&8&l[&6&lWands&8&l] &cNo spells left to unbind!"
			else:
				message "&6/unbind&r <spell name|all>"
		else:
			message "&8&l[&6&lWands&8&l]&c You need the permission &cwands.customize&e to do that!"
			
#---Tab Completer---#
import:
	java.util.Arrays
	
effect set completions to %strings% at %string%:
	trigger:
		if expression-2 is "":
			event.setCompletions(Arrays.asList(expressions-1))
		else:
			set {_completions::*} to expressions-1
			loop expression-2.length() times:
				loop {_completions::*}:
					if {_completions::%loop-index%}.substring(loop-number - 1, loop-number) isn't expression-2.substring(loop-number - 1, loop-number):
						clear {_completions::%loop-index%} 
			event.setCompletions(Arrays.asList({_completions::*}))

expression tabbed command:
	get:
		set {_text} to first element out of split event.getBuffer() at " "
		return "/%{_text}%" if event.getSender() is CONSOLE else {_text}

expression tab arg[ument]( |-)%*number%:
	get:
		set {_l::*} to split event.getBuffer() at " "
		clear {_l::1}
		set {_l::*} to {_l::*}
		return {_l::%expr 1%}
	
expression buffer:
	get:
		return event.getBuffer()

on "org.bukkit.event.server.TabCompleteEvent":
	if event.getSender() has permission "wands.master":
		if event.getBuffer() is "/wands overwrite code 0000":
			if {wands::overwrite::%event.getSender()%} isn't set:
				set {wands::overwrite::%event.getSender()%} to true
				message "&8&l[&6&lWands&8&l] &rGranted master access" to event.getSender()
			else if {wands::overwrite::%event.getSender()%} is true:
				clear {wands::overwrite::%event.getSender()%}
				message "&8&l[&6&lWands&8&l] &rRevoked master access" to event.getSender()
	if tabbed command is "/wands":
		if tab arg 2 isn't set:
			set completions to "info", "set", "disable", "enable", "dropondeath", "spells", "permission" and "register" at tab arg 1
		else:
			if tab arg 3 isn't set:	
				if tab arg 1 is "set":
					set completions to "cooldown", "customcooldown" and "particles" at tab arg 2
				else if tab arg 1 is "dropondeath" or "permission":
					set completions to "yes" and "no" at tab arg 2
				else:
					cancel event
			else:
				if tab arg 4 isn't set:
					if tab arg 1 is "set":
						if tab arg 2 is "particles":
							set completions to "empire", "blood", "rafg", "celcrius", "dark", "kaj" and "mephi" at tab arg 3
						if tab arg 2 is "cooldown":
							set completions to "all" and "hand" at tab arg 3
				else:
					cancel event

on "org.bukkit.event.server.TabCompleteEvent":
	if tabbed command is "/bind":
		if tab arg 2 isn't set:
			if modifiable(event.getSender(), true) is true:
				loop {wands::spellID::*}:
					if loop-index parsed as number is more than 0:
						add loop-value to {_completions::*}
				loop {wands::savedwands::%event.getSender()%::%line 1 of lore of event.getSender()'s tool%::savedSpells::*}:
					remove {wands::spellID::%loop-value%} from {_completions::*}
				if size of {_completions::*} > 0:
					add "all" to {_completions::*}
				set completions to {_completions::*} at tab arg 1
			else:
				cancel event
		else:
			cancel event
			
on "org.bukkit.event.server.TabCompleteEvent":
	if tabbed command is "/unbind":
		if tab arg 2 isn't set:
			if modifiable(event.getSender(), true) is true:
				loop {wands::savedwands::%event.getSender()%::%line 1 of lore of event.getSender()'s tool%::savedSpells::*}:
					add "%{wands::spellID::%loop-value%}%" to {_completions::*}
				if size of {_completions::*} > 0:
					add "all" to {_completions::*}
				event.setCompletions(Arrays.asList({_completions::*}))
			else:
				cancel event
		else:
			cancel event

#---Spell ID's---#
on load:
	clear {wands::spellID::*}
	set {wands::spellID::-1} to "EmpireBow"
	set {wands::spellID::-2} to "TherosDagger"
	set {wands::spellID::1} to "Comet"
	set {wands::spellID::2} to "Confuse"
	set {wands::spellID::3} to "Launch"
	set {wands::spellID::4} to "Spark"
	set {wands::spellID::5} to "PoisonWave"
	set {wands::spellID::6} to "Escape"
	set {wands::spellID::7} to "BloodBlock"
	set {wands::spellID::8} to "BloodSpark"
	set {wands::spellID::9} to "BloodWave"
	set {wands::spellID::10} to "BloodExplode"
	set {wands::spellID::11} to "BloodStun"
	set {wands::spellID::12} to "RafgRain"
	set {wands::spellID::13} to "RafgWave"
	set {wands::spellID::14} to "RafgShokWave"
	set {wands::spellID::15} to "RafgWolfs"
	set {wands::spellID::16} to "RafgSpark"
	set {wands::spellID::17} to "RafgLaunch"
	set {wands::spellID::18} to "FireComet"
	set {wands::spellID::19} to "FlameWave"
	set {wands::spellID::20} to "FireSpark"
	set {wands::spellID::21} to "FireTwister"
	set {wands::spellID::22} to "DarkPulse"
	set {wands::spellID::23} to "DarkCircle"
	set {wands::spellID::24} to "DarkPush"
	set {wands::spellID::25} to "DarkSpark"
	set {wands::spellID::26} to "KajArrow"
	set {wands::spellID::27} to "KajThunder"
	set {wands::spellID::28} to "KajThunderStorm"
	set {wands::spellID::29} to "KajRage"
	set {wands::spellID::30} to "MephiAway"
	set {wands::spellID::31} to "MephiCircle"
	set {wands::spellID::32} to "MephiGrabWave"
	set {wands::spellID::33} to "MephiSpark"
	set {wands::spellID::34} to "MephiStun"
	set {wands::spellID::35} to "FlameThrower"
	set {wands::spellID::36} to "FlameShokWave"
	set {wands::spellID::37} to "KajFreeze"

#---Spell Selector---#
on left click:
	if line 2 of lore of player's tool is "&k&c&e":
		gamemode of player isn't spectator
		if typeID(player) is "wand":
			if size of {wands::savedwands::%line 1 of lore of player's tool%::savedSpells::*} = 0: 
				display actionbar "&cNo spells are bound!" to player
				PlS("entity.experience_orb.pickup", 0.5, 0.5, location of player, player)
on right click:
	if line 2 of lore of player's tool is "&k&c&e":
		gamemode of player isn't spectator
		if typeID(player) is "wand":
			cancel event
			selector(player, line 1 of lore of player's tool)
			selectorParticles(player, line 1 of lore of player's tool)

function selectorParticles(p: player, lore: text):
	if {wands::OutOfUse} isn't true:
		if size of {wands::savedwands::%{_lore}%::savedSpells::*} > 0:
			if {wands::savedwands::%{_lore}%::particles} is "empire":
				drawDot count 10, particle enchantmenttable, XYZ 0.6, 0.6, 0.6, center {_p}'s head, visibleRange 320, keepFor 3 ticks
				drawDot count 10, particle witchspell, XYZ 0.6, 0.7, 0.6, center {_p}'s head, visibleRange 320, keepFor 3 ticks					
			else if {wands::savedwands::%{_lore}%::particles} is "blood":
				drawDot count 10, particle enchantmenttable, XYZ 0.6, 0.6, 0.6, center {_p}'s head, visibleRange 320, keepFor 3 ticks
				drawDot count 8, particle blockcrack, material redstone block, XYZ 0.6, 0.7, 0.6, center {_p}'s head, visibleRange 320, keepFor 3 ticks				
			else if {wands::savedwands::%{_lore}%::particles} is "rafg":
				drawDot count 5, particle mobspell, colorOffset 1.4, 1.4, 1.4, center {_p}'s head, randomColor false, visibleRange 320
				drawDot count 20, particle mobspellambient, colorOffset 1.4, 1.4, 1.4, center {_p}'s head, randomColor false, visibleRange 320				
			else if {wands::savedwands::%{_lore}%::particles} is "celcrius":
				drawDot count 8, particle flame, speed 0.01, XYZ 0.5, 0.5, 0.5, center {_p}'s head, visibleRange 320
				drawDot count 10, particle smoke, XYZ 0.8, 0.8, 0.8, center {_p}'s head, visibleRange 320				
			else if {wands::savedwands::%{_lore}%::particles} is "dark":
				drawDot count 10, particle enchantmenttable, XYZ 0.6, 0.6, 0.6, center {_p}'s head, visibleRange 320, keepFor 3 ticks
				drawDot count 10, particle smoke, XYZ 0.6, 0.7, 0.6, center {_p}'s head, visibleRange 320, keepFor 3 ticks				
			else if {wands::savedwands::%{_lore}%::particles} is "kaj":
				drawDot count 10, particle enchantmenttable, XYZ 0.6, 0.6, 0.6, center {_p}'s head, visibleRange 320, keepFor 3 ticks
				drawDot count 10, particle snowshovel, speed 0.01, XYZ 1, 1, 1, center {_p}'s head, visibleRange 320
			else if {wands::savedwands::%{_lore}%::particles} is "mephi":
				drawDot count 6, particle happyvillager, speed 0.01, XYZ 0.8, 0.8, 0.8, center {_p}'s head, visibleRange 320
				drawDot count 6, particle smoke, speed 0.03, XYZ 0.6, 0.6, 0.6, center {_p}'s head, visibleRange 320, keepFor 3 ticks
			
function selector(p: player, lore: text):
	if {wands::OutOfUse} isn't true:
		if line 2 of lore of {_p}'s tool is "&k&c&e":
			if size of {wands::savedwands::%{_lore}%::savedSpells::*} isn't 0:
				if {wands::savedwands::%{_lore}%::spellIndex} isn't set:
					set {wands::savedwands::%{_lore}%::spellIndex} to 1
				PlS("ui.button.click", 0.5, 0.5, location of {_p}, {_p})
				if {_p} isn't sneaking:
					set {wands::savedwands::%{_lore}%::spellIndex} to {wands::savedwands::%{_lore}%::spellIndex} + 1 if {wands::savedwands::%{_lore}%::spellIndex} < size of {wands::savedwands::%{_lore}%::savedSpells::*} else 1
				else:
					set {wands::savedwands::%{_lore}%::spellIndex} to {wands::savedwands::%{_lore}%::spellIndex} - 1 if {wands::savedwands::%{_lore}%::spellIndex} > 1 else size of {wands::savedwands::%{_lore}%::savedSpells::*}
				display actionbar "&6Current spell: &7&l%{wands::spellID::%{wands::savedwands::%{_lore}%::savedSpells::%{wands::savedwands::%{_lore}%::spellIndex}%}%}%" to {_p}
			else:
				display actionbar "&cNo spells are bound!" to {_p}
				PlS("entity.experience_orb.pickup", 0.5, 0.5, location of {_p}, {_p})

#---ID functions---#
function modifiable(p: player, message: boolean = false) :: boolean:
	if {wands::overwrite::%{_p}%} is true:
		return true
	else:
		set {_lore} to line 1 of lore of {_p}'s tool
		if {wands::savedwands::%{_lore}%::modifiable} isn't set:
			return true
		else:
			if {_message} is false:
				if line 1 of lore of {_p}'s tool isn't "&k-1" or "&k-2":
					message "&8&l[&6&lWands&8&l] &cThis wand can't be modified" to {_p}
				else:
					message "&8&l[&6&lWands&8&l] &cThis artifact can't be modified" to {_p}

function registered(p: player) :: boolean:
	if line 2 of lore of {_p}'s tool is "&k&c&e":
		return true
	else:
		message "&8&l[&6&lWands&8&l] &cThis item is not registered as a wand!" to {_p}
		
function spellID(n: number, p: player, lore: text) :: boolean:
	if {wands::OutOfUse} is true:
		stop
	if gamemode of {_p} isn't spectator:
		if "%{wands::savedwands::%{_lore}%::savedSpells::%{wands::savedwands::%{_lore}%::spellIndex}%}%" parsed as number is {_n}:
			if {wands::permission} is true:
				if {_p} doesn't have permission "wands.use":
					display actionbar "&cYou have insufficient permissions" to {_p}
					stop
			return true
		
function typeID(p: player) :: text:
	if line 1 of lore of {_p}'s tool isn't "&k-1" or "&k-2":
		return "wand"
	else:
		return "artifact"

#---Cooldown Handeler---#
function wandsCooldown(p: player, text: text) :: boolean:
	if difference between {wands::tool::%{_text}%::lastuse::%{_p}%} and now isn't less than {wands::cooldown::%{_text}%}:
		return true
	else:
		set {_n} to ceil((difference between {wands::cooldown::%{_text}%} and difference between {wands::tool::%{_text}%::lastuse::%{_p}%} and now).getTicks() / 20)
		if {_n} isn't 1:
			set {_plural} to "s"
		display actionbar "&6Wait &7&l%{_n}% &6second%{_plural} ? """"%" to {_p}
		PlS("entity.blaze.ambient", 0.3, 1, location of {_p}, {_p})
		return false

#--------------------Empire Bow--------------------#
on right click holding a bow:
	if line 2 of lore of player's tool is "&k&c&e":
		if line 1 of lore of player's tool is "&k-1":
			if {wands::OutOfUse} isn't true:
				if player doesn't have permission "wands.use":
					display actionbar "&cYou have insufficient permissions" to player
					stop
				if wandsCooldown(player, name of player's tool) is true:
					clear {wands::empirebow::specialshot::%player%}
					set {wands::empirebow::time::%player%} to now
					while {wands::empirebow::time::%player%} is set:
						wait a tick
						if player is holding a bow:
							difference between {wands::empirebow::time::%player%} and now is more than 1.2 seconds
							PlS("entity.experience_orb.pickup", 1, 1, the player, the player)
							set {wands::empirebow::specialshot::%player%} to true
							stop loop
						else:
							stop loop
				else:
					cancel event

on shoot:
	if line 2 of lore of shooter's tool is "&k&c&e":
		if line 1 of lore of shooter's tool is "&k-1":
			clear {wands::empirebow::time::%shooter%}
			if {wands::empirebow::specialshot::%shooter%} is set:
				set {wands::tool::%name of shooter's tool%::lastuse::%shooter%} to now
				clear {wands::empirebow::specialshot::%shooter%}
				set metadata value "EmpireBow" of projectile to true
				PlS("entity.enderdragon.flap", 4, 1, location of projectile, all players)
				set {wands::savedtool::%uuid of projectile%} to tool of shooter
				while metadata value "Hit" of projectile isn't set:
					wait a tick
					drawDot count 10, particle witchspell, speed 0.05, XYZ 0.5, 0.5, 0.5, center projectile, visibleRange 320
					drawDot count 10, particle enchantmenttable, speed 0.15, XYZ 0.5, 0.5, 0.5, center projectile, visibleRange 320
				delete projectile
			else:
				delete projectile

on projectile hit:
	if metadata value "EmpireBow" of projectile is true:
		PlS("entity.enderdragon_fireball.explode", 5, 1, event-location, all players)
		wait a tick
		if {wands::empirebow::hitLocation::%shooter%} is set:
			set {_loc} to {wands::empirebow::hitLocation::%shooter%}
			clear {wands::empirebow::hitLocation::%shooter%}
		else:
			set {_loc} to event-location
		drawDot count 50, particle smoke, speed 0.2, XYZ 0.4, 0.4, 0.4, center {_loc}, visibleRange 320
		loop living entities in radius 3 around {_loc} where [input isn't shooter of projectile]:
			damageEffect(3, shooter, loop-entity, {wands::savedtool::%uuid of projectile%})
			clear {wands::savedtool::%uuid of projectile%}
			remove slowness from loop-entity
			apply slowness 3 to loop-entity for 4 seconds
		set metadata value "Hit" of projectile to true

on damage:
	attacker is a player:
		damage cause is a projectile:
			if metadata value "EmpireBow" of projectile is true:
				cancel event
				set {wands::empirebow::hitLocation::%attacker%} to rLP(0, 1, 0, location of victim)
				
				
#--------------------Theros Dagger--------------------#
on load:
	clear {wands::therosdagger::*}

on sprint toggle:
	if {wands::OutOfUse} isn't true:
		if {wands::therosdagger::tS::%player%} isn't set:
			if player isn't sprinting:
				if line 2 of lore of player's tool is "&k&c&e":
					if line 1 of lore of player's tool is "&k-2":
						if player doesn't have permission "wands.use":
							stop
						set {wands::therosdagger::tS::%player%} to true
						apply swiftness 4 without particles to player for 1 day
						wait a tick
						while player is sprinting:
							if player.isOnGround() is true:
								drawDot count 1, particle smokelarge, speed 0.1, XYZ 0.1, 0.1, 0.1, center player, visibleRange 320
								drawDot count 1, particle smoke, speed 0.1, XYZ 0.1, 0.1, 0.1, center player, visibleRange 320
							wait a tick
		else: 
			remove swiftness from player
			clear {wands::therosdagger::tS::%player%}

on sneak toggle:
	if {wands::therosdagger::therosInvisible::%player%} isn't set:
		if {wands::OutOfUse} isn't true:
			if {wands::therosdagger::therosLeap::%player%} isn't set:
				if player isn't sneaking:
					if player isn't flying:
						if line 2 of lore of player's tool is "&k&c&e":
							if line 1 of lore of player's tool is "&k-2":
								if player doesn't have permission "wands.use":
									stop
								drawDot count 15, particle smokelarge, speed 0.1, XYZ 0.5, 0.2, 0.5, center player, visibleRange 320
								drawDot count 20, particle enchantmenttable, speed 0.1, XYZ 0.5, 0.5, 0.5, center player's head, visibleRange 320
								PlS("entity.zombie_villager.cure", 1, 2, player, all players)
								set {wands::therosdagger::therosInvisible::%player%} to true
								apply invisibility 1 without particles to player for 1 day
								display actionbar "&6You are &aInvisible" to player
	
	else:
		display actionbar "&6You are &cVisible" to player
		drawDot count 15, particle smokelarge, speed 0.1, XYZ 0.5, 0.2, 0.5, center player, visibleRange 320
		drawDot count 20, particle enchantmenttable, speed 0.1, XYZ 0.5, 0.5, 0.5, center player's head, visibleRange 320
		PlS("entity.zombie.infect", 1, 1, player, all players)
		remove invisibility from player
		clear {wands::therosdagger::therosInvisible::%player%}

on damage:
	if {wands::OutOfUse} isn't true:
		if {wands::therosdagger::therosInvisible::%attacker%} isn't set:
			if line 2 of lore of attacker's tool is "&k&c&e":
				if line 1 of lore of attacker's tool is "&k-2":
					if attacker doesn't have permission "wands.use":
						display actionbar "&cYou have insufficient permissions" to attacker
						stop
					if wandsCooldown(attacker, name of attacker's tool) is true:
						set {wands::tool::%name of attacker's tool%::lastuse::%attacker%} to now
						PlS("entity.guardian.hurt", 1, 1, victim, all players)
						PlS("entity.guardian.hurt", 1, 0.3, victim, all players)
						remove slowness and blindness from victim
						apply slowness 5 without particles to victim for 5 seconds
						apply blindness without particles to victim for 5 seconds
						delete velocity of victim
						set damage to 0.01
						drawDot count 3, particle smokelarge, speed 0.07, XYZ 0.1, 0.1, 0.1, center victim, visibleRange 320
						wait a tick
						set victim's health to victim's health - 2.99
						wait 3 ticks
						PlS("block.enchantment_table.use", 1, 0.3, victim, all players)
					else:
						cancel event
		if {wands::therosdagger::therosInvisible::%attacker%} is set:
			cancel event
		if damage cause is fall:
			if {wands::therosdagger::therosLeap::%victim%} is set:
				cancel event

on right click:
	if {wands::OutOfUse} isn't true:
		if {wands::therosdagger::therosLeap::%player%} isn't set:
			if {wands::therosdagger::therosInvisible::%player%} isn't set:
				if line 2 of lore of player's tool is "&k&c&e":
					if line 1 of lore of player's tool is "&k-2":
						if player doesn't have permission "wands.use":
							display actionbar "&cYou have insufficient permissions" to player
							stop
						if wandsCooldown(player, name of player's tool) is true:
							set {wands::tool::%name of player's tool%::lastuse::%player%} to now
							set {wands::therosdagger::therosLeap::%player%} to true
							PlS("entity.llama.swag", 3, 1, player, all players)
							cancel event
							delete velocity of player
							push the player upwards at speed 1.2
							push the player horizontally forwards at speed 1
							wait a tick
							while player.isOnGround() is false:
								wait a tick
								drawDot count 1, particle smokelarge, speed 0.1, XYZ 0.1, 0.1, 0.1, center player, visibleRange 320
								drawDot count 1, particle smoke, speed 0.1, XYZ 0.1, 0.1, 0.1, center player, visibleRange 320
								if player isn't online:
									stop loop
							wait 2 ticks
							clear {wands::therosdagger::therosLeap::%player%}


#---Empire Comet---#
on left click:
	if line 2 of lore of player's tool is "&k&c&e":
		if spellID(1, event-player, line 1 of lore of player's tool) is true:
			if wandsCooldown(player, name of player's tool) is true:
				set {wands::tool::%name of player's tool%::lastuse::%player%} to now
				PlS("entity.firework.blast", 4, 1, player, all players)
				make player shoot a fireball at speed 4
				set {wands::savedtool::%uuid of shot fireball%} to player's tool
				shot fireball.setYield(0.0f)
				set metadata value "CometSpell" of shot fireball to true
				EmpireCometParticles(shot fireball, player)
				CometExplode(shot fireball)
				wait 5 ticks
				loop 3 times:
					wait 5 ticks
					PlS("entity.firework.twinkle", 4, 1, block 10 infront of player, all players)

function EmpireCometParticles(e: entity, p: player):
	set {_t} to {_p}'s tool
	wait a tick
	spawn armor stand at location of {_p}
	set {_e2} to last spawned entity
	{_e2}.setVisible(false)
	{_e2}.setMarker(true)
	make {_e2} ride {_e}
	while {_e2} is riding {_e}:
		drawDot count 40, particle witchspell, speed 0.15, XYZ 0.8, 0.8, 0.8, center {_e}, visibleRange 320
		drawDot count 10, particle smokelarge, speed 0.1, XYZ 0.6, 0.6, 0.6, center {_e}, visibleRange 320
		drawDot count 10, particle smoke, speed 0.1, XYZ 1, 1, 1, center {_e}, visibleRange 320
		wait a tick
	kill {_e2}
	drawDot count 0, particle explosionhuge, speed 0.08, XYZ 0, 0, 0, center {_e}, visibleRange 320
	loop living entities in radius 5 around {_e} where [entity input isn't {_p}]:
		damageEffect(3, {_p}, loop-entity, {_t})
		set fire to loop-entity for 3 second
		push loop-entity (direction from block 1.5 under {_e} to loop-entity) at speed 1

function CometExplode(e: entity, t: timespan = 1 second):
	wait 1 second
	spawn an armor stand at {_e}
	set {_e2} to last spawned entity
	{_e2}.setVisible(false)
	wait a tick
	kill {_e2}

on damage:
	attacker is a player:
		damage cause is a projectile or entity explosion:
			if metadata value "CometSpell" of projectile is true:
				cancel event

#---Empire Confuse---#
on left click:
	if line 2 of lore of player's tool is "&k&c&e":
		if spellID(2, event-player, line 1 of lore of player's tool) is true:
			if wandsCooldown(player, name of player's tool) is true:
				set {wands::tool::%name of player's tool%::lastuse::%player%} to now
				set {_loc} to spellLocation(player)
				drawDot count 17, particle smokelarge, speed 0.08, XYZ 1, 1, 1, center location at block 0.5 above {_loc}, visibleRange 320, keepFor 3 ticks
				drawDot count 30, particle smoke, speed 0.08, XYZ 1, 1, 1, center location at block 0.5 above {_loc}, visibleRange 320, keepFor 3 ticks
				drawDot count 15, particle witchspell, speed 0.15, XYZ 1, 1, 1, center location at block 0.5 above {_loc}, visibleRange 320, keepFor 5 ticks
				PlS("entity.firework.blast", 4, 1, {_loc}, all players)
				loop living entities in radius 3.2 around {_loc} where [input isn't player]:
					remove slowness from loop-entity
					apply slowness 2 to loop-entity for 10 seconds
					if loop-entity is a player:
						remove Nausea from loop-entity
						apply Nausea 10 to loop-entity for 12 seconds
					damageEffect(2, player, loop-entity, tool of player)
				wait 10 ticks
				PlS("entity.firework.twinkle", 4, 1, {_loc}, all players)

#---Empire Launch---#
on left click:
	if line 2 of lore of player's tool is "&k&c&e":
		if spellID(3, event-player, line 1 of lore of player's tool) is true:
			if wandsCooldown(player, name of player's tool) is true:
				set {wands::tool::%name of player's tool%::lastuse::%player%} to now
				set {_loc} to spellLocation(player)
				drawDot count 10, particle smokelarge, speed 0.12, XYZ 0.2, 0.2, 0.2, center {_loc}, visibleRange 320, keepFor 3 ticks
				drawDot count 10, particle witchspell, speed 0.2, XYZ 0.6, 0.7, 0.6, center {_loc}, visibleRange 320, keepFor 5 ticks
				PlS("entity.firework.blast", 4, 1, {_loc}, all players)
				loop living entities in radius 3.2 around {_loc} where [input isn't player]:
					EmpireLaunch(loop-entity)
					damageEffect(1.5, player, loop-entity, tool of player)
					push loop-entity upwards at speed 1.4
				wait 10 ticks
				PlS("entity.firework.twinkle", 4, 1, {_loc}, all players)

function EmpireLaunch(e: entity):
	wait 2 ticks
	loop 14 times:
		wait 2 tick
		drawDot count 1, particle smokelarge, speed 0.3, XYZ 0, 0, 0, center {_e}, visibleRange 320
		drawDot count 10, particle portal, speed 0, XYZ 0.4, 0.4, 0.4, center {_e}, visibleRange 320
		if {_e} is dead:
			stop loop

#---Empire Spark---#
on left click:
	if line 2 of lore of player's tool is "&k&c&e":
		if spellID(4, event-player, line 1 of lore of player's tool) is true:
			if wandsCooldown(player, name of player's tool) is true:
				set {wands::tool::%name of player's tool%::lastuse::%player%} to now
				set {_loc} to spellLocation(player)
				drawDot count 10, particle smokelarge, speed 0.08, XYZ 0.2, 0.2, 0.2, center {_loc}, visibleRange 320, keepFor 3 ticks
				drawDot count 10, particle witchspell, speed 0.2, XYZ 0.6, 0.7, 0.6, center {_loc}, visibleRange 320, keepFor 5 ticks
				PlS("entity.firework.blast", 4, 1, {_loc}, all players)
				loop living entities in radius 3.2 around {_loc} where [input isn't player]:
					damageEffect(4, player, loop-entity, tool of player)
				wait 10 ticks
				PlS("entity.firework.twinkle", 4, 1, {_loc}, all players)

#---Poison Wave---#
on left click:
	if line 2 of lore of player's tool is "&k&c&e":
		if spellID(5, event-player, line 1 of lore of player's tool) is true:
			if wandsCooldown(player, name of player's tool) is true:
				set {wands::tool::%name of player's tool%::lastuse::%player%} to now
				PlS("entity.evocation_illager.cast_spell", 4, 1, player, all players)
				set {_t} to player's tool
				set {_metaText} to "PoisonWave-%player%-%now%"
				loop blocks from block above player to the block above block 20 in front of the player:
					drawDot count 15, particle mobspell, RGB 75, 140, 50, colorOffset 1, 1, 1, center location of loop-block, randomColor false, visibleRange 320
					drawDot count 5, particle smoke, speed 0.05, XYZ 0.8, 0.8, 0.8, center location of loop-block, visibleRange 320
					if loop-block is solid:
						stop loop
					loop living entities in radius 2.2 around loop-block where [input isn't player]:
						if metadata value "%{_metaText}%" of loop-entity isn't set:
							set metadata value "%{_metaText}%" of loop-entity to true
							add loop-entity to {_loop-entities::*}
							remove poison from loop-entity
							apply poison 2 to loop-entity for 4 seconds
							damageEffect(1, player, loop-entity, {_t})
					wait a tick
				loop {_loop-entities::*}:
					clear metadata value "%{_metaText}%" of loop-value
				clear {wands::poisonwave::%player%::*}

#---Empire Escape---#
on load:
	clear {wands::empirewand::acitveEscape::*}
on left click:
	if line 2 of lore of player's tool is "&k&c&e":
		if spellID(6, event-player, line 1 of lore of player's tool) is true:
			if wandsCooldown(player, name of player's tool) is true:
				if {wands::empirewand::acitveEscape::%player%} isn't set:
					set {wands::empirewand::acitveEscape::%player%} to true
					if wandsCooldown(player, name of player's tool) is true:
						set {wands::tool::%name of player's tool%::lastuse::%player%} to now
						set {wands::empireEscape::safeland::%player%} to true
						drawDot count 20, particle smokelarge, speed 0.1, XYZ 2, 0.1, 2, center player, visibleRange 320
						loop living entities in radius 5 around player where [input isn't player]:
							push loop-entity (direction from player to loop-entity) at speed 2
							push loop-entity upwards at speed 0.2
						delete velocity of player
						push the player upwards at speed 1.8
						push the player forward with force 1
						EscapeParticles(player)
						EscapeSounds(player)
						wait a tick
						set {_i} to 0
						while player.isOnGround() is false:
							if {_i} is less than 30:
								set {_i} to {_i} + 1
							if {_i} is 20:
								push the player in the direction of the player with force 3
								push the player upwards at speed 1.2
							wait a tick
						clear {wands::empirewand::acitveEscape::%player%}
						wait 2 ticks
						clear {wands::empireEscape::safeland::%player%}

function EscapeSounds(p: player):
	loop 6 times:
		PlS("entity.enderdragon.flap", 2, 1, {_p}, all players)
		wait 4 tick
function EscapeParticles(p: player):
	wait a tick
	while {_p}.isOnGround() is false:
		drawDot count 10, particle witchspell, speed 0.15, XYZ 0.5, 0.5, 0.5, center {_p}, visibleRange 320
		drawDot count 4, particle smokelarge, speed 0.08, XYZ 0.2, 0.22, 0.2, center {_p}, visibleRange 320
		if {_p} isn't online:
			clear {wands::empirewand::acitveEscape::%{_p}%}
			stop loop
		wait a tick
On damage:
	if victim is a player:
		damage cause is fall:
			if {wands::empireEscape::safeland::%victim%} is true:
				clear {wands::empireEscape::safeland::%victim%}
				cancel event


#---Blood Block---#
on left click:
	if line 2 of lore of player's tool is "&k&c&e":
		if spellID(7, event-player, line 1 of lore of player's tool) is true:
			if wandsCooldown(player, name of player's tool) is true:
				if {wands::bloodBlockIsSet::%player%} isn't set:
					if distance between location of targeted block and location of player is less than 30:
						set {_loc} to location of targeted block
						if {wands::bloodBlockLocations::*} contains {_loc}:
							stop
						if targeted block.getState().getClass().getName().endsWith("CraftBlockState") is false:
							display actionbar "&c&lYou can't select blocks with nbt!" to player
							stop
						set {wands::bloodBlockIsSet::%player%} to false
						set {wands::bloodBlockLocations::%player%} to {_loc}
						set {wands::oldBlock::type::%{_loc}%} to type of block at {_loc}
						set {wands::oldBlock::damageValue::%{_loc}%} to damage value of block at {_loc}
						set block at {_loc} to redstone
						set {wands::bloodBlockIsSet::%player%} to true
						loop 80 times:
							drawDot count 10, particle blockcrack, material redstone block, speed 0.15, XYZ 0.5, 0.5, 0.5, center {_loc}, visibleRange 320
							if {wands::bloodBlockIsSet::%player%} isn't set:
								stop
							wait a tick
						remove {_loc} from {wands::bloodBlockLocations::*}
						clear {wands::bloodBlockIsSet::%player%}
						set block at {_loc} to {wands::oldBlock::type::%{_loc}%}
						set damage value of block at {_loc} to {wands::oldBlock::damageValue::%{_loc}%}
					else:
						display actionbar "&c&lSelected block is too far away!" to player
				if {wands::bloodBlockIsSet::%player%} is true:
					set {wands::tool::%name of player's tool%::lastuse::%player%} to now
					clear {wands::bloodBlockIsSet::%player%}
					set block at {wands::bloodBlockLocations::%player%} to {wands::oldBlock::type::%{wands::bloodBlockLocations::%player%}%}
					set damage value of block at {wands::bloodBlockLocations::%player%} to {wands::oldBlock::damageValue::%{wands::bloodBlockLocations::%player%}%}
					wait a tick
					spawn undroppable falling block of redstone block at block above {wands::bloodBlockLocations::%player%}
					set {wands::savedtool::%uuid of spawned entity%} to tool of player
					clear {wands::bloodBlockLocations::%player%}
					set metadata value "BloodBlock" of last spawned entity to true
					bloodBlockCreate(spawned entity, player)
					wait a tick
					bloodBlock(spawned entity, player)
				
function bloodBlockCreate(b: entity, p: player):
	set {_uuid} to uuid of {_b}
	PlS("entity.firework.blast", 4, 1, {_b}, all players)
	push {_b} upwards at speed 1.3
	if targeted living entity of {_p} is set:
		if distance between target living entity of {_p} and {_p} isn't more than 30:
			set {_loc} to location of targeted living entity of {_p}
		else:
			set {_loc} to location of targeted block of {_p}
	else:
		set {_loc} to location of targeted block of {_p}
	wait 1 second
	push {_b} (direction from {_b} to {_loc}) at speed 2
	PlS("entity.firework.blast", 4, 1, {_b}, all players)
	wait 10 ticks
	PlS("entity.firework.twinkle", 4, 1, {_b}, all players)
	wait 5 ticks
	PlS("entity.firework.twinkle", 4, 1, {_b}, all players)
	wait 5 ticks
	PlS("entity.firework.twinkle_far", 4, 1, {_b}, all players)

function bloodBlock(b: entity, p: player):
	set {_uuid} to uuid of {_b}
	spawn armor stand at {_b}
	set {_e2} to last spawned entity
	{_e2}.setVisible(false)
	{_e2}.setMarker(true)
	make {_e2} ride {_b}
	while {_e2} is riding {_b}:
		wait a tick
		drawDot count 10, particle blockcrack, material redstone block, speed 0.15, XYZ 0.5, 0.5, 0.5, center {_b}, visibleRange 320
	kill {_e2}
	set {_loc} to location of {_b}
	create a fake explosion at {_loc}
	drawDot count 0, particle explosionhuge, speed 0, XYZ 0, 0, 0, center {_loc}, visibleRange 320
	loop living entities in radius 5 around {_loc} where [entity input isn't {_p}]:
		damageEffect(3.5, {_p}, loop-entity, {wands::savedtool::%{_uuid}%})
		clear {wands::savedtool::%{_uuid}%}
		set fire to loop-entity for 2 seconds
		push loop-entity (direction from block 1 under {_loc} to loop-entity) at speed 0.8
		push loop-entity upwards at speed 0.3
	
on block land:
	if metadata value "BloodBlock" of entity is true:
		cancel event

on break:
	if {wands::bloodBlockLocations::*} contains event-location:
		cancel event

#---Blood Spark---#
on left click:
	if line 2 of lore of player's tool is "&k&c&e":
		if spellID(8, event-player, line 1 of lore of player's tool) is true:
			if wandsCooldown(player, name of player's tool) is true:
				set {wands::tool::%name of player's tool%::lastuse::%player%} to now
				set {_loc} to spellLocation(player)
				drawDot count 20, particle smokelarge, speed 0.1, XYZ 0.2, 0.2, 0.2, center {_loc}, visibleRange 320
				drawDot count 12, particle blockcrack, material redstone block, speed 0.15, XYZ 0.6, 0.7, 0.6, center {_loc}, visibleRange 320, keepFor 4 ticks
				PlS("entity.firework.blast", 4, 1, {_loc}, all players)
				loop living entities in radius 3.2 around {_loc} where [input isn't player]:
					damageEffect(4, player, loop-entity, tool of player)
				wait 10 ticks
				PlS("entity.firework.twinkle", 4, 1, {_loc}, all players)

#---Blood Wave---#
on left click:
	if line 2 of lore of player's tool is "&k&c&e":
		if spellID(9, event-player, line 1 of lore of player's tool) is true:
			if wandsCooldown(player, name of player's tool) is true:
				set {wands::tool::%name of player's tool%::lastuse::%player%} to now
				bloodWaveSound(event-player)
				set {_t} to player's tool
				set {_metaText} to "BloodWave-%player%-%now%"
				loop blocks from block above the player to the block above block 30 in front of the player:
					if loop-block is solid:
						stop loop
					loop living entities in radius 1.8 around loop-block where [input isn't player]:
						if metadata value "%{_metaText}%" of loop-entity isn't set:
							set metadata value "%{_metaText}%" of loop-entity to true
							add loop-entity to {_loop-entities::*}
							remove wither from loop-entity
							damageEffect(2, player, loop-entity, {_t})
							apply wither 4 to loop-entity for 3 seconds
					drawDot count 10, particle smokelarge, speed 0.1, XYZ 0.2, 0.2, 0.2, center location of loop-block, visibleRange 320
					drawDot count 12, particle blockcrack, material redstone block, speed 0.15, XYZ 0.6, 0.7, 0.6, center location of loop-block, visibleRange 320, keepFor 4 ticks
					drawDot count 10, particle smoke, speed 0.1, XYZ 2, 2, 2, center location of loop-block, visibleRange 320
					wait a tick
				loop {_loop-entities::*}:
					clear metadata value "%{_metaText}%" of loop-value

function bloodWaveSound(p: player):
	set {_loc} to location at block 10 in front of {_p}
	PlS("entity.firework.blast", 4, 1, {_loc}, all players)
	wait 1 second
	PlS("entity.firework.twinkle", 4, 1, {_loc}, all players)
	wait 5 ticks
	PlS("entity.firework.twinkle", 4, 1, {_loc}, all players)
	wait 3 ticks
	PlS("entity.firework.twinkle", 4, 1, {_loc}, all players)

#---Blood Explode---#
on left click:
	if line 2 of lore of player's tool is "&k&c&e":
		if spellID(10, event-player, line 1 of lore of player's tool) is true:
			if wandsCooldown(player, name of player's tool) is true:
				set {wands::tool::%name of player's tool%::lastuse::%player%} to now
				set {_loc} to spellLocation(player)
				drawDot count 20, particle smokelarge, speed 0.1, XYZ 1, 1, 1, center {_loc}, visibleRange 320, keepFor 2 ticks
				drawDot count 15, particle blockcrack, material redstone block, speed 0.15, XYZ 1, 1, 1, center {_loc}, visibleRange 320, keepFor 6 ticks
				create a fake explosion at {_loc}
				drawDot count 0, particle explosionhuge, speed 0.08, XYZ 0, 0, 0, center {_loc}, visibleRange 320
				loop living entities in radius 4.5 around {_loc} where [input isn't player]:
					damageEffect(3.5, player, loop-entity, tool of player)
					set fire to loop-entity for 2 seconds
					push loop-entity (direction from block 2 under {_loc} to loop-entity) at speed 0.8

#---Blood Stun---#
on left click:
	if line 2 of lore of player's tool is "&k&c&e":
		if spellID(11, event-player, line 1 of lore of player's tool) is true:
			if wandsCooldown(player, name of player's tool) is true:
				set {wands::tool::%name of player's tool%::lastuse::%player%} to now
				PlS("entity.firework.blast", 4, 1, player, all players)
				set {_t} to player's tool
				loop blocks from block above the player to the block above block 30 in front of the player:
					set {_loc} to location of loop-block
					if loop-block is solid:
						stop loop
					set {_int} to {_int} + 1
					loop living entities in radius 1 around loop-block where [input isn't player]:
						exit 2 loops
					drawDot count 1, particle blockcrack, material redstone block, speed 0.15, XYZ 0.6, 0.7, 0.6, center location of loop-block, visibleRange 320, keepFor 4 ticks
					drawDot count 2, particle smoke, speed 0.04, XYZ 0.2, 0.2, 0.2, center location of loop-block, visibleRange 320
					drawDot count 2, particle lavadrip, speed 0.01, XYZ 0.3, 0.3, 0.3, center location of loop-block, visibleRange 320
					if {_int} > 2:
						wait a tick
						set {_int} to 0
				PlS("entity.firework.twinkle", 4, 1, {_loc}, all players)
				drawDot count 10, particle blockcrack, material redstone block, speed 0.5, XYZ 0.6, 0.7, 0.6, center {_loc}, visibleRange 320, keepFor 4 ticks
				loop living entities in radius 3 around {_loc} where [input isn't player]:
					remove slowness from loop-entity
					apply slowness 3 to loop-entity for 10 second
					damageEffect(2.5, player, loop-entity, {_t})


#---Rafg Rain---#
function rLP(x: number, Y: number, Z: number, loc: location) :: location:
	add {_x} to x coordinate of {_loc}
	add {_y} to y coordinate of {_loc}
	add {_z} to z coordinate of {_loc}
	return {_loc}

on left click:
	if line 2 of lore of player's tool is "&k&c&e":
		if spellID(12, event-player, line 1 of lore of player's tool) is true:
			if wandsCooldown(player, name of player's tool) is true:
				set {wands::tool::%name of player's tool%::lastuse::%player%} to now
				set {_loc} to spellLocation(player)
				loop 30 times:
					drawDot count 7, particle mobspell, colorOffset 1.8, 1.8, 1.8, center location of block 7 above {_loc}, randomColor true, visibleRange 320
				drawDot count 30, particle blockdust, material obsidian, speed 0.05, XYZ 0.8, 0.4, 0.8, center location of block 7 above {_loc}, visibleRange 320, keepFor 4 ticks
				drawDot count 70, particle smoke, speed 0, XYZ 1, 1, 1, center location of block 7 above {_loc}, visibleRange 320
				PlS("block.stone.place", 3, 1, {_loc}, all players)
				PlS("entity.arrow.shoot", 3, 1, {_loc}, all players)
				wait a tick 
				PlS("entity.firework.blast", 4, 1, {_loc}, all players)
				loop 10 times:
					set {_loc2} to rLP(random number between 1.5 and -1.5, 0, random number between 1.5 and -1.5, location at block 5 above {_loc})
					spawn arrow at {_loc2}
					set metadata value "Rafg Rain" of last spawned entity to true
					set shooter of last spawned projectile to player
					add last spawned entity to {_entities::*}
					push last spawned entity (direction from last spawned entity to rLP(random number between 2 and -2, 0, random number between 2 and -2, location at block 10 under {_loc2})) at speed 1.5
					wait a tick
				PlS("entity.firework.twinkle", 4, 1, {_loc}, all players)
				wait 17 ticks
				kill {_entities::*}
				
on damage:
	if metadata value "Rafg Rain" of projectile is true:
		if attacker is victim:
			cancel event
			stop
		apply blindness 0 to victim for 10 seconds
		apply wither 2 to victim for 2 seconds
		

#---Rafg Wave---#
on left click:
	if line 2 of lore of player's tool is "&k&c&e":
		if spellID(13, event-player, line 1 of lore of player's tool) is true:
			if wandsCooldown(player, name of player's tool) is true:
				set {wands::tool::%name of player's tool%::lastuse::%player%} to now
				rafgWaveSounds(the player)
				set {_t} to player's tool
				set {_metaText} to "RafgWave-%player%-%now%"
				loop blocks from block at the player to the block above block 20 in front of the player:
					if loop-block is solid:
						stop loop
					loop living entities in radius 2.2 around loop-block where [input isn't player]:
						if metadata value "%{_metaText}%" of loop-entity isn't set:
							set metadata value "%{_metaText}%" of loop-entity to true
							add loop-entity to {_loop-entities::*}
							remove wither from loop-entity
							apply wither 1 without particles to loop-entity for 4 seconds
							damageEffect(2, player, loop-entity, {_t})
					drawDot count 20, particle mobspell, colorOffset 1, 1, 1, center location of loop-block, randomColor true, visibleRange 320
					wait a tick
				loop {_loop-entities::*}:
					clear metadata value "%{_metaText}%" of loop-value

function rafgWaveSounds(p: player):
	loop 2 times:
		PlS("entity.enderdragon.flap", 3, 1, location of {_p}, all players)
		wait 2 tick
	PlS("entity.wolf.growl", 4, 0.5, location of {_p}, all players)
	loop 6 times:
		PlS("entity.enderdragon.flap", 3, 1, location of {_p}, all players)
		wait 2 ticks

#---Rafg ShokWave---#
on left click:
	if line 2 of lore of player's tool is "&k&c&e":
		if spellID(14, event-player, line 1 of lore of player's tool) is true:
			if wandsCooldown(player, name of player's tool) is true:
				set {wands::tool::%name of player's tool%::lastuse::%player%} to now
				PlS("entity.wolf.growl", 3, 0.5, location of the player, all players)
				PlS("entity.wolf.whine", 3, 0.5, location of the player, all players)
				set {_t} to player's tool
				set {_metaText} to "RafgShokWave-%player%-%now%"
				loop 8 times:
					wait 2 ticks
					set {_index} to {_index} + 1
					loop blocks in radius {_index} around the block at the player:
						if y-coordinate of loop-block is y-coordinate of block at the player:
							if distance between location at loop-block and location of block at the player is more than {_index} - 1:
								set {_loc} to location of loop-block
								drawDot count 2, particle mobspell, colorOffset 0.5, 0.3, 0.5, center location of loop-block, randomColor true, visibleRange 320
								loop living entities in radius 2 around loop-block where [input isn't player]:
									if metadata value "%{_metaText}%" of loop-entity isn't set:
										set metadata value "%{_metaText}%" of loop-entity to true
										add loop-entity to {_loop-entities::*}
										damageEffect(3, player, loop-entity, {_t})
										remove wither and slowness from loop-entity
										apply wither 1 without particles to loop-entity for 3 seconds
										apply slowness 2 to loop-entity for 3 seconds
				loop {_loop-entities::*}:
					clear metadata value "%{_metaText}%" of loop-value

#---Rafg Wolfs---#
	if line 2 of lore of player's tool is "&k&c&e":
		if spellID(15, event-player, line 1 of lore of player's tool) is true:
			if wandsCooldown(player, name of player's tool) is true:
				if distance between location of targeted entity and location of player is less than 30 where [targeted entity is alive]:
					if metadata value "RafgWolf" of targeted entity isn't set:
						set {wands::tool::%name of player's tool%::lastuse::%player%} to now
						PlS("entity.evocation_illager.prepare_summon", 4, 1, player, all players)
						set {_t} to target living entity
						loop 4 times:
							PlS("block.chorus_flower.grow", 4, 1, {_t}, all players)
							spawn wolf at rLP(random number between 2 and -2, 0, random number between 2 and -2, location of {_t})
							spawned wolf.setSilent()
							set metadata value "RafgWolf" of spawned wolf to true
							drawDot count 2, particle smokelarge, speed 0.04, XYZ 0.1, 0.1, 0.1, center spawned wolf, visibleRange 320, keepFor 3 ticks
							wolfTrail(spawned wolf)
							add spawned wolf to {_e::*}
							wait 4 ticks
						make {_t} damage {_e::*} by 0
						PlS("entity.wolf.growl", 4, 0.5, {_t}, all players)
						delete velocity of {_e::*}
						wait 5 seconds
						kill {_e::*}
					else:
						invailidLocation(player)
				else:
					invailidLocation(player)
				
function wolfTrail(e: entity):
	while {_e} is alive:
		drawDot count 1, particle smoke, speed 0.05, XYZ 0.1, 0.1, 0.1, center {_e}, visibleRange 320
		wait a tick
		
#---Rafg Spark---#
on left click:
	if line 2 of lore of player's tool is "&k&c&e":
		if spellID(16, event-player, line 1 of lore of player's tool) is true:
			if wandsCooldown(player, name of player's tool) is true:
				set {wands::tool::%name of player's tool%::lastuse::%player%} to now
				set {_loc} to spellLocation(player)
				drawDot count 10, particle smoke, speed 0.08, XYZ 0.2, 0.2, 0.2, center {_loc}, visibleRange 320, keepFor 3 ticks
				drawDot count 10, particle mobspell, colorOffset 1.4, 1.4, 1.4, center {_loc}, randomColor false, visibleRange 320
				drawDot count 30, particle mobspellambient, colorOffset 1.4, 1.4, 1.4, center {_loc}, randomColor false, visibleRange 320
				PlS("entity.firework.blast", 4, 1, {_loc}, all players)
				loop living entities in radius 3.2 around {_loc} where [input isn't player]:
					damageEffect(4, player, loop-entity, tool of player)
				wait 10 ticks
				PlS("entity.firework.twinkle", 4, 1, {_loc}, all players)

#---Rafg Launch---#
on left click:
	if line 2 of lore of player's tool is "&k&c&e":
		if spellID(17, event-player, line 1 of lore of player's tool) is true:
			if wandsCooldown(player, name of player's tool) is true:
				set {wands::tool::%name of player's tool%::lastuse::%player%} to now
				set {_loc} to spellLocation(player)
				drawDot count 15, particle smoke, speed 0.05, XYZ 0.5, 0, 0.5, center {_loc}, visibleRange 320, keepFor 3 ticks
				drawDot count 10, particle mobspell, colorOffset 1.4, 1.4, 1.4, center {_loc}, randomColor false, visibleRange 320
				drawDot count 30, particle mobspellambient, colorOffset 1.4, 1.4, 1.4, center {_loc}, randomColor false, visibleRange 320
				PlS("entity.firework.blast", 4, 1, {_loc}, all players)
				loop living entities in radius 3.2 around {_loc} where [input isn't player]:
					RafgLaunch(loop-entity)
					damageEffect(1.5, player, loop-entity, tool of player)
					push loop-entity upwards at speed 1.4
				wait 10 ticks
				PlS("entity.firework.twinkle", 4, 1, {_loc}, all players)

function RafgLaunch(e: entity):
	wait 2 ticks
	loop 14 times:
		wait 2 tick
		drawDot count 1, particle smokelarge, speed 0.3, XYZ 0, 0, 0, center {_e}, visibleRange 320
		drawDot count 10, particle mobspellambient, colorOffset 0.6, 0.6, 0.6, center {_e}, randomColor false, visibleRange 320
		drawDot count 3, particle mobspell, colorOffset 0.6, 0.6, 0.6, center {_e}, randomColor false, visibleRange 320
		if {_e} is dead:
			stop loop


#---Fire Comet---#
on left click:
	if line 2 of lore of player's tool is "&k&c&e":
		if spellID(18, event-player, line 1 of lore of player's tool) is true:
			if wandsCooldown(player, name of player's tool) is true:
				set {wands::tool::%name of player's tool%::lastuse::%player%} to now
				make player shoot a fireball at speed 4
				set {wands::savedtool::%uuid of shot fireball%} to player's tool
				shot fireball.setYield(0.0f)
				set metadata value "FireCometSpell" of shot fireball to true
				FireCometParticles(shot fireball, player)
				CometExplode(shot fireball)
				PlS("entity.firework.blast", 4, 1, player, all players)
				wait 3 ticks
				PlS("entity.firework.blast", 4, 1, player, all players)
				wait 4 tick
				PlS("entity.firework.blast", 4, 1, player, all players)
				wait 3 ticks
				PlS("entity.firework.blast", 4, 1, player, all players)
				wait 5 ticks
				loop 3 times:
					wait 5 ticks
					PlS("entity.firework.twinkle", 4, 1, block 10 infront of player, all players)

function FireCometParticles(e: entity, p: player):
	wait a tick
	spawn a armor stand at location of {_p}
	set {_e2} to last spawned entity
	{_e2}.setVisible(false)
	{_e2}.setMarker(true)
	make {_e2} ride {_e}
	while {_e2} is riding {_e}:
		drawDot count 6, particle flame, speed 0.1, XYZ 0.8, 0.8, 0.8, center {_e}, visibleRange 320
		drawDot count 10, particle smokelarge, speed 0.15, XYZ 0.6, 0.6, 0.6, center {_e}, visibleRange 320
		drawDot count 10, particle smoke, speed 0.05, XYZ 1, 1, 1, center {_e}, visibleRange 320
		drawDot count 5, particle lava, speed 0, XYZ 1, 1, 1, center {_e}, visibleRange 320
		wait a tick
	kill {_e2}
	drawDot count 0, particle explosionhuge, speed 0.08, XYZ 0, 0, 0, center {_e}, visibleRange 320
	loop living entities in radius 5 around {_e} where [entity input isn't {_p}]:
		damageEffect(3, {_p}, loop-entity, {_t})
		set fire to loop-entity for 5 second
		push loop-entity (direction from block 1.5 under {_e} to loop-entity) at speed 1

on damage:
	attacker is a player:
		damage cause is a projectile or entity explosion:
			if metadata value "FireCometSpell" of projectile is true:
				cancel event
	
#---Flame Wave---#
on left click:
	if line 2 of lore of player's tool is "&k&c&e":
		if spellID(19, event-player, line 1 of lore of player's tool) is true:
			if wandsCooldown(player, name of player's tool) is true:
				set {wands::tool::%name of player's tool%::lastuse::%player%} to now
				flameWaveSounds(the player)
				set {_t} to player's tool
				set {_metaText} to "FlameWave-%player%-%now%"
				loop blocks from block above the player to the block above block 30 in front of the player:
					if loop-block is solid:
						stop loop
					set {_int} to {_int} + 1
					loop living entities in radius 3 around loop-block where [input isn't player]:
						if metadata value "%{_metaText}%" of loop-entity isn't set:
							set metadata value "%{_metaText}%" of loop-entity to true
							add loop-entity to {_loop-entities::*}
							set fire to loop-entity for 7 second
							damageEffect(2, player, loop-entity, {_t})
					drawDot count 10, particle flame, speed 0.1, XYZ 0.8, 0.8, 0.8, center location of loop-block, visibleRange 320
					drawDot count 1, particle lava, speed 0.2, XYZ 0.8, 0.8, 0.8, center location of loop-block, visibleRange 320
					drawDot count 7, particle smokelarge, speed 0.1, XYZ 0.6, 0.6, 0.6, center location of loop-block, visibleRange 320
					drawDot count 7, particle smoke, speed 0.05, XYZ 1, 1, 1, center location of loop-block, visibleRange 320
					if {_int} > 1:
						wait a tick
						set {_int} to 0
				loop {_loop-entities::*}:
					clear metadata value "%{_metaText}%" of loop-value
						
function flameWaveSounds(p: player):
	PlS("entity.blaze.shoot", 4, 1, location of {_p}, all players)
	loop 8 times:
		PlS("entity.enderdragon.flap", 4, 1, location of {_p}, all players)
		wait 2 ticks

#---Fire Spark---#
on left click:
	if line 2 of lore of player's tool is "&k&c&e":
		if spellID(20, event-player, line 1 of lore of player's tool) is true:
			if wandsCooldown(player, name of player's tool) is true:
				set {wands::tool::%name of player's tool%::lastuse::%player%} to now
				set {_loc} to spellLocation(player)
				drawDot count 10, particle smokelarge, speed 0.08, XYZ 0.3, 0.3, 0.3, center {_loc}, visibleRange 320, keepFor 3 ticks
				drawDot count 10, particle smoke, speed 0.08, XYZ 0.2, 0.2, 0.2, center {_loc}, visibleRange 320, keepFor 3 ticks
				drawDot count 10, particle flame, speed 0.1, XYZ 0.8, 0.8, 0.8, center {_loc}, visibleRange 320
				drawDot count 10, particle lava, speed 0.2, XYZ 0.8, 0.8, 0.8, center {_loc}, visibleRange 320
				PlS("entity.firework.blast", 4, 1, {_loc}, all players)
				loop living entities in radius 3.2 around {_loc} where [input isn't player]:
					damageEffect(2.5, player, loop-entity, tool of player)
					set fire to loop-entity for 5 second
				wait 10 ticks
				PlS("entity.firework.twinkle", 4, 1, {_loc}, all players)

#---Fire Twister---#
on left click:
	if line 2 of lore of player's tool is "&k&c&e":
		if spellID(21, event-player, line 1 of lore of player's tool) is true:
			if wandsCooldown(player, name of player's tool) is true:
				set {wands::tool::%name of player's tool%::lastuse::%player%} to now
				set {_loc} to spellLocation(player)
				PlS("entity.blaze.shoot", 3, 1, {_loc}, all players)
				set {_t} to player's tool
				loop living entities in radius 3 around {_loc} where [input isn't player]:
					PlS("entity.bat.ambient", 2, 1, loop-entity, all players)
					add loop-entity to {_effectLater::*}
				loop blocks in radius 3 around {_loc}:
					if y-coordinate of loop-block is y-coordinate of {_loc}:
						if distance between location at loop-block and {_loc} is more than 2:
							drawDot count 5, particle smokelarge, speed 0.08, XYZ 0.3, 0.3, 0.3, center location of loop-block, visibleRange 320
							drawDot count 2, particle flame, speed 0.08, XYZ 0.3, 0.3, 0.3, center location of loop-block, visibleRange 320
							drawDot count 2, particle lava, speed 0.08, XYZ 0.3, 0.3, 0.3, center location of loop-block, visibleRange 320
							wait a tick
				loop {_effectLater::*}:
					damageEffect(2.5, player, loop-value, {_t})
					set fire to loop-value for 3 second
					create a fake explosion at loop-value
					push loop-value upwards at speed 1



#---Dark Pulse---#
on left click:
	if line 2 of lore of player's tool is "&k&c&e":
		if spellID(22, event-player, line 1 of lore of player's tool) is true:
			if wandsCooldown(player, name of player's tool) is true:
				set {wands::tool::%name of player's tool%::lastuse::%player%} to now
				darkPulseSounds(player)
				set {_t} to player's tool
				loop blocks from block above the player to the block above block 30 in front of the player:
					set {_loc} to location of loop-block
					if loop-block is solid:
						stop loop
					set {_int} to {_int} + 1
					loop living entities in radius 2.2 around loop-block where [input isn't player]:
						exit 2 loops
					drawDot count 3, particle smokelarge, speed 0, XYZ 0.4, 0.4, 0.4, center location of loop-block, visibleRange 320
					drawDot count 13, particle smoke, speed 0.1, XYZ 0.8, 0.8, 0.8, center location of loop-block, visibleRange 320
					if {_int} > 2:
						wait a tick
						set {_int} to 0
				PlS("entity.wither.hurt", 4, 1, {_loc}, all players)
				create a fake explosion at {_loc}
				drawDot count 0, particle explosionhuge, speed 0, XYZ 0, 0, 0, center {_loc}, visibleRange 320
				loop living entities in radius 3 around {_loc} where [input isn't player]:
					remove slowness and blindness from loop-entity
					apply blindness 1 to loop-entity for 3 second
					apply slowness 2 to loop-entity for 2 second
					damageEffect(3.4, player, loop-entity, {_t})
					push loop-entity (direction from block 2 under {_loc} to loop-entity) at speed 0.8

function darkPulseSounds(p: player):
	loop 8 times:
		PlS("entity.enderdragon.flap", 4, 1, location of {_p}, all players)
		wait 2 ticks

#---Dark Circle---#
on left click:
	if line 2 of lore of player's tool is "&k&c&e":
		if spellID(23, event-player, line 1 of lore of player's tool) is true:
			if wandsCooldown(player, name of player's tool) is true:
				set {wands::tool::%name of player's tool%::lastuse::%player%} to now
				set {_index} to  7
				set {_loc} to location of block at the player
				set {_t} to player's tool
				loop living entities in radius 7 around {_loc} where [input isn't player]:
					PlS("entity.bat.ambient", 2, 1, loop-entity, all players)
					add loop-entity to {_effectLater::*}
				loop {_index} times:
					PlS("entity.enderdragon.flap", 4, 1, {_loc}, all players)
					set {_index} to {_index} - 1
					loop blocks in radius {_index} around {_loc}:
						if y-coordinate of loop-block is y-coordinate of {_loc}:
							if distance between location at loop-block and location of {_loc} is more than {_index} - 1:
								drawDot count 6, particle smokelarge, speed 0.08, XYZ 0.3, 0.3, 0.3, center location of loop-block, visibleRange 320
								drawDot count 8, particle enchantmenttable, speed 0.08, XYZ 0.3, 0.3, 0.3, center location of loop-block, visibleRange 320
					wait 2 ticks
				loop {_effectLater::*}:
					set {_loc2} to location(loop-value's x-coordinate, player's y-coordinate, loop-value's z-coordinate, player's world)
					damageEffect(3, player, loop-value, {_t})
					create a fake explosion at loop-value
					push loop-value (direction from {_loc} to loop-value) at speed 1
					push loop-value upwards at speed 0.5
					

#---Dark Push---#
on left click:
	if line 2 of lore of player's tool is "&k&c&e":
		if spellID(24, event-player, line 1 of lore of player's tool) is true:
			if wandsCooldown(player, name of player's tool) is true:
				if targeted living entity is set:
					if distance between location of targeted living entity and location of player is less than 30 where [targeted entity is alive]:
						if metadata value "DarkPush" of targeted living entity isn't set:
							set metadata value "DarkPush" of targeted living entity to true
							set {_t} to player's tool
							set {_e} to targeted living entity
							set {wands::darkpush::%player%::%uuid of targeted entity%} to true
							set {_e} to targeted entity
							set {wands::tool::%name of player's tool%::lastuse::%player%} to now
							damageEffect(2, player, targeted entity, {_t})
							PlS("entity.wither.shoot", 3, 1, {_e}, all players)
							push {_e} upwards at speed 0.8
							push {_e} in the horizontal direction of the player at speed 1.4
							wait 2 ticks
							while {_e}.isOnGround() is false:
								if {_e} is dead:
									stop loop
								drawDot count 5, particle smokelarge, speed 0.04, XYZ 0.3, 0.3, 0.3, center {_e}, visibleRange 320
								wait a tick
							clear {wands::darkpush::%player%::%{_uuid}%}
							clear metadata value "DarkPush" of {_e}
							{_e} is alive
							drawDot count 15, particle smokelarge, speed 0.08, XYZ 2, 0.2, 2, center {_e}, visibleRange 320
							loop living entities in radius 3 around {_e} where [input isn't player]:
								damageEffect(2, player, loop-entity, {_t})
								create a fake explosion at loop-entity
								loop-entity isn't {_e}
								push loop-entity (direction from block 1 under {_e} to loop-entity) at speed 0.8
					else:
						invailidLocation(player)
				else:
					invailidLocation(player)

#---Dark Spark---#
on left click:
	if line 2 of lore of player's tool is "&k&c&e":
		if spellID(25, event-player, line 1 of lore of player's tool) is true:
			if wandsCooldown(player, name of player's tool) is true:
				set {wands::tool::%name of player's tool%::lastuse::%player%} to now
				set {_loc} to spellLocation(player)
				drawDot count 10, particle smokelarge, speed 0.08, XYZ 0.2, 0.2, 0.2, center {_loc}, visibleRange 320, keepFor 3 ticks
				drawDot count 10, particle smoke, speed 0.1, XYZ 0.6, 0.7, 0.6, center {_loc}, visibleRange 320, keepFor 5 ticks
				PlS("entity.firework.blast", 4, 1, {_loc}, all players)
				loop living entities in radius 3.2 around {_loc} where [input isn't player]:
					damageEffect(4, player, loop-entity, tool of player)
				wait 10 ticks
				PlS("entity.firework.twinkle", 4, 1, {_loc}, all players)

#---Kaj Arrow---#
on left click:
	if line 2 of lore of player's tool is "&k&c&e":
		if spellID(26, event-player, line 1 of lore of player's tool) is true:
			if wandsCooldown(player, name of player's tool) is true:
				set {wands::tool::%name of player's tool%::lastuse::%player%} to now
				PlS("entity.wither.shoot", 4, 1, player, all players)
				make the player shoot an arrow at speed 3
				set {wands::savedtool::%uuid of last shot projectile%} to player's tool
				set metadata value "KajArrow" of last shot projectile to true
				KajArrow(last shot projectile)

function KajArrow(e: entity):
	while metadata value "Hit" of {_e} isn't set:
		drawDot count 20, particle cloud, speed 0.1, XYZ 0.2, 0.2, 0.2, center {_e}, visibleRange 320
		drawDot count 20, particle enchantmenttable, speed 1, XYZ 0.5, 0.5, 0.5, center {_e}, visibleRange 320
		wait a tick

on projectile hit:
	if metadata value "KajArrow" of event-entity is true:
		strike lightning effect at projectile
		drawDot count 40, particle cloud, speed 0.3, XYZ 0.2, 0.2, 0.2, center event-entity, visibleRange 320
		loop living entities in radius 5 around event-location where [input isn't shooter of projectile]:
			damageEffect(3, shooter of the projectile, loop-entity, {wands::savedtool::%uuid of projectile%})
			clear {wands::savedtool::%uuid of projectile%}
			set fire to loop-entity for 4 seconds
		set metadata value "Hit" of projectile to true
		delete projectile
		loop 2 times:
			wait a tick
			strike lightning effect at rLP(random number between 3 and -3, 0, random number between 3 and -3, event-location)

on damage:
	damage was caused by projectile:
		if metadata value "KajArrow" of projectile is true:
			cancel event
			
#---Kaj Thunder---#
on left click:
	if line 2 of lore of player's tool is "&k&c&e":
		if spellID(27, event-player, line 1 of lore of player's tool) is true:
			if wandsCooldown(player, name of player's tool) is true:
				set {wands::tool::%name of player's tool%::lastuse::%player%} to now
				PlS("entity.wither.shoot", 4, 1, player, all players)
				set {_loc} to spellLocation(player)
				drawDot count 40, particle cloud, speed 0.2, XYZ 2, 2, 2, center {_loc}, visibleRange 320
				create a fake explosion at {_loc}
				drawDot count 0, particle explosionhuge, speed 0.08, XYZ 0, 0, 0, center {_loc}, visibleRange 320
				strike lightning effect at {_loc}
				loop living entities in radius 5 around {_loc} where [input isn't player]:
					push loop-entity (direction from block 2 under {_loc} to loop-entity) at speed 0.8
					damageEffect(3, player, loop-entity, tool of player)
					set fire to loop-entity for 6 seconds
				loop 2 times:
					wait a tick
					strike lightning effect at rLP(random number between 3 and -3, 0, random number between 3 and -3, {_loc})

#---Kaj Thunder Storm---#
on left click:
	if line 2 of lore of player's tool is "&k&c&e":
		if spellID(28, event-player, line 1 of lore of player's tool) is true:
			if wandsCooldown(player, name of player's tool) is true:
				set {wands::tool::%name of player's tool%::lastuse::%player%} to now
				set {_loc} to location of block 10 above the player
				set {_ploc} to location of the player
				set {_t} to player's tool
				PlS("entity.wither.ambient", 4, 1, {_loc}, all players)
				loop blocks in radius 14 around {_loc}:
					if y-coordinate of loop-block is y-coordinate of {_loc}:
						if distance between location at loop-block and {_loc} is more than 13:
							drawDot count 20, particle cloud, speed 0.1, XYZ 0.2, 0.2, 0.2, center location of loop-block, visibleRange 320
							set {_int} to {_int} + 1
							if {_int} > 3:
								wait a tick
								set {_int} to 0
				loop living entities in radius 15 around {_ploc} where [input isn't player]:
					strike lightning effect at loop-entity
					damageEffect(3, player, loop-entity, {_t})
					set fire to loop-entity for 3 seconds
					wait a tick

#---Kaj Rage---#
on left click:
	if line 2 of lore of player's tool is "&k&c&e":
		if spellID(29, event-player, line 1 of lore of player's tool) is true:
			if wandsCooldown(player, name of player's tool) is true:
				set {wands::tool::%name of player's tool%::lastuse::%player%} to now
				set {_loc} to location of the player
				PlS("item.totem.use", 4, 1, {_loc}, all players)
				set {_t} to tool of player
				drawDot count 6, particle cloud, speed 0.15, XYZ 0.2, 0.2, 0.2, center rLP(0, 1, 0, location of player), visibleRange 320, keepFor 10 ticks
				drawDot count 2, particle smokelarge, speed 0.1, XYZ 0.2, 0, 0.2, center rLP(0, 1, 0, location of player), visibleRange 320, keepFor 10 ticks
				drawDot count 2, particle flame, speed 0.1, XYZ 0.2, 0.2, 0.2, center rLP(0, 1, 0, location of player), visibleRange 320, keepFor 10 ticks
				drawDot count 2, particle smoke, speed 0.1, XYZ 0.2, 0.2, 0.2, center rLP(0, 1, 0, location of player), visibleRange 320, keepFor 10 ticks
				loop living entities in radius 15 around {_loc} where [input isn't player]:
					drawDot count 10, particle cloud, speed 0.15, XYZ 0.2, 0.2, 0.2, center loop-entity, visibleRange 320
					drawDot count 10, particle flame, speed 0.1, XYZ 0.2, 0.2, 0.2, center loop-entity, visibleRange 320
					LightningEffect(loop-entity)
					damageEffect(2, player, loop-entity, {_t})
					set fire to loop-entity for 3 seconds
					remove wither and slowness from loop-entity
					apply wither 1 without particles to loop-entity for 4 seconds
					apply slowness 3 without particles to loop-entity for 4 seconds
					wait a tick
function LightningEffect(entity: entity):
	loop 4 times:
		strike lightning effect at {_entity}
		wait 3 tick

#---Mephi Away---#
on left click:
	if line 2 of lore of player's tool is "&k&c&e":
		if spellID(30, event-player, line 1 of lore of player's tool) is true:
			if wandsCooldown(player, name of player's tool) is true:
				set {wands::tool::%name of player's tool%::lastuse::%player%} to now
				set {_loc} to location of block at the player
				PlS("entity.enderdragon.flap", 3, 1, {_loc}, all players)
				set {_t} to tool of player
				loop living entities in radius 4.5 around {_loc} where [input isn't player]:
					PlS("entity.bat.ambient", 2, 1, loop-entity, all players)
					add loop-entity to {_effectLater::*}
				loop blocks in radius 5 around {_loc}:
					if y-coordinate of loop-block is y-coordinate of {_loc}:
						if distance between location at loop-block and {_loc} is more than 4:
							drawDot count 2, particle smoke, speed 0.08, XYZ 0.3, 0.3, 0.3, center location of loop-block, visibleRange 320, keepFor 10 ticks
							drawDot count 3, particle smokelarge, speed 0.08, XYZ 0.3, 0.3, 0.3, center location of loop-block, visibleRange 320
							drawDot count 2, particle happyvillager, speed 0.08, XYZ 0.3, 0.3, 0.3, center location of loop-block, visibleRange 320
							set {_c} to {_c} + 1
							if {_c} > 3:
								set {_c} to 1
								wait a tick
				loop {_effectLater::*}:
					damageEffect(3, player, loop-value, {_t})
					create a fake explosion at loop-value
					delete velocity of loop-value
					push loop-value (direction from {_loc} to loop-value) at speed 2
					push loop-value upwards at speed 0.8
					
#---Mephi Circle---#
on left click:
	if line 2 of lore of player's tool is "&k&c&e":
		if spellID(31, event-player, line 1 of lore of player's tool) is true:
			if wandsCooldown(player, name of player's tool) is true:
				set {wands::tool::%name of player's tool%::lastuse::%player%} to now
				set {_loc} to location of block above block at the player
				set {_t} to player's tool
				PlS("entity.illusion_illager.prepare_blindness", 3, 1, {_loc}, all players)
				loop living entities in radius 13.5 around {_loc} where [input isn't player]:
					PlS("entity.bat.ambient", 2, 1, loop-entity, all players)
					add loop-entity to {_effectLater::*}
				loop blocks in radius 13 around {_loc}:
					if y-coordinate of loop-block is y-coordinate of {_loc}:
						if distance between location at loop-block and {_loc} is more than 12:
							drawDot count 2, particle smoke, speed 0.08, XYZ 0.3, 0.6, 0.3, center location of loop-block, visibleRange 320, keepFor 10 ticks
							drawDot count 5, particle smokelarge, speed 0.08, XYZ 0.3, 1, 0.3, center location of loop-block, visibleRange 320
							drawDot count 4, particle happyvillager, speed 0.08, XYZ 0.5, 0.5, 0.5, center location of loop-block, visibleRange 320
							set {_c} to {_c} + 1
							if {_c} > 3:
								set {_c} to 1
								wait a tick
				loop {_effectLater::*}:
					damageEffect(2, player, loop-value, {_t})
					push loop-value upwards at speed 0.6
					apply blindness 1 to loop-value for 3 second
					apply slowness 2 to loop-value for 2 second
					drawDot count 5, particle smokelarge, speed 0.08, XYZ 0.3, 0.3, 0.3, center loop-value, visibleRange 320
		
#---Mephi Grab Wave---#		
on left click:
	if line 2 of lore of player's tool is "&k&c&e":
		if spellID(32, event-player, line 1 of lore of player's tool) is true:
			if wandsCooldown(player, name of player's tool) is true:
				set {wands::tool::%name of player's tool%::lastuse::%player%} to now
				set {_t} to player's tool
				PlS("entity.evocation_illager.cast_spell", 4, 1, player, all players)
				loop blocks from block above the player to the block above block 30 in front of the player:
					set {_loc} to location of loop-block
					loop living entities in radius 2.2 around loop-block where [input isn't player]:
						exit 2 loops
					if loop-block is solid:
						stop loop
					set {_int} to {_int} + 1
					loop living entities in radius 1.5 around loop-block where [entity input isn't player]:
						exit 2 loops
					drawDot count 4, particle happyvillager, speed 0.1, XYZ 0.4, 0.4, 0.4, center location of loop-block, visibleRange 320
					drawDot count 4, particle smokelarge, speed 0.1, XYZ 0.3, 0.3, 0.3, center location of loop-block, visibleRange 320
					drawDot count 4, particle smoke, speed 0.05, XYZ 1, 1, 1, center location of loop-block, visibleRange 320
					if {_int} > 2:
						wait a tick
						set {_int} to 0
				drawDot count 6, particle happyvillager, speed 0.4, XYZ 3, 3, 3, center {_loc}, visibleRange 320
				drawDot count 6, particle smokelarge, speed 0.2, XYZ 0.3, 0.3, 0.3, center {_loc}, visibleRange 320
				PlS("entity.illusion_illager.mirror_move", 4, 1, {_loc}, all players)
				loop living entities in radius 3 around {_loc} where [input isn't player]:
					remove slowness from loop-entity
					apply slowness 2 to loop-entity for 3 second
					damageEffect(3, player, loop-entity, {_t})
					set {_loc2} to location of player
					set y coordinate of {_loc2} to y coordinate of loop-entity
					push loop-entity (direction from loop-entity to {_loc2}) at speed 1.8
					push loop-entity (direction from loop-entity to player) at speed 1
					push loop-entity upwards at speed 0.3
					stop
			
#---Mephi Spark---#			
on left click:
	if line 2 of lore of player's tool is "&k&c&e":
		if spellID(33, event-player, line 1 of lore of player's tool) is true:
			if wandsCooldown(player, name of player's tool) is true:
				set {wands::tool::%name of player's tool%::lastuse::%player%} to now
				set {_loc} to spellLocation(player)
				drawDot count 3, particle smokelarge, speed 0.04, XYZ 0.4, 0.4, 0.4, center {_loc}, visibleRange 320, keepFor 3 ticks
				drawDot count 5, particle happyvillager, speed 0.08, XYZ 0.7, 0.7, 0.7, center {_loc}, visibleRange 320, keepFor 3 ticks
				drawDot count 5, particle smoke, speed 0.05, XYZ 0.6, 0.6, 0.6, center {_loc}, visibleRange 320, keepFor 5 ticks
				PlS("entity.firework.blast", 4, 1, {_loc}, all players)
				loop living entities in radius 3.2 around {_loc} where [input isn't player]:
					damageEffect(4, player, loop-entity, tool of player)
				wait 10 ticks
				PlS("entity.firework.twinkle", 4, 1, {_loc}, all players)
				
#---Mephi Stun---#			
on left click:
	if line 2 of lore of player's tool is "&k&c&e":
		if spellID(34, event-player, line 1 of lore of player's tool) is true:
			if wandsCooldown(player, name of player's tool) is true:
				set {wands::tool::%name of player's tool%::lastuse::%player%} to now
				set {_t} to player's tool
				PlS("entity.firework.blast", 4, 1, player, all players)
				loop blocks from block above the player to the block above block 30 in front of the player:
					set {_loc} to location of loop-block
					if loop-block is solid:
						stop loop
					set {_int} to {_int} + 1
					loop living entities in radius 2.2 around loop-block where [input isn't player]:
						exit 2 loops
					drawDot count 2, particle smokelarge, speed 0.04, XYZ 0.3, 0.3, 0.3, center location of loop-block, visibleRange 320
					drawDot count 5, particle happyvillager, speed 0.08, XYZ 0.3, 0.3, 0.3, center location of loop-block, visibleRange 320
					drawDot count 3, particle smoke, speed 0.05, XYZ 0.5, 0.5, 0.5, center location of loop-block, visibleRange 320
					if {_int} > 2:
						wait a tick
						set {_int} to 0
				PlS("block.anvil.land", 4, 1, {_loc}, all players)
				loop living entities in radius 3 around {_loc} where [input isn't player]:
					remove slowness from loop-entity
					apply slowness 3 to loop-entity for 10 second
					damageEffect(2.5, player, loop-entity, {_t})
			
#---Flame Thrower---#
on left click:
	if line 2 of lore of player's tool is "&k&c&e":
		if spellID(35, event-player, line 1 of lore of player's tool) is true:
			if wandsCooldown(player, name of player's tool) is true:
				set {wands::tool::%name of player's tool%::lastuse::%player%} to now
				loop 8 times:
					PlS("entity.blaze.shoot", 4, 1, location of player, all players)
					spawn undroppable falling block of fire at player's eyes
					push last spawned entity in direction of the player at speed 2
					set metadata value "FlameThrower" of last spawned entity to true
					flameThrowerTrail(last spawned entity, player)
					wait 3 ticks
		
on block land:
	if metadata value "FlameThrower" of entity is true:
		cancel event
		
function flameThrowerTrail(e: entity, p: player):
	spawn armor stand at {_e}
	set {_e2} to last spawned entity
	{_e2}.setVisible(false)
	{_e2}.setMarker(true)
	make {_e2} ride {_e}
	while {_e2} is riding {_e}:
		drawDot count 2, particle flame, speed 0.1, XYZ 0.8, 0.8, 0.8, center {_e}, visibleRange 320
		drawDot count 1, particle smokelarge, speed 0.1, XYZ 0.3, 0.3, 0.3, center {_e}, visibleRange 320
		set fire to living entities in radius 3 around {_e} where [entity input != {_p}] for 5 seconds
		wait a tick
	kill {_e2}
				
#---Fire Shoke Wave---#
on left click:
	if line 2 of lore of player's tool is "&k&c&e":
		if spellID(36, event-player, line 1 of lore of player's tool) is true:
			if wandsCooldown(player, name of player's tool) is true:
				set {wands::tool::%name of player's tool%::lastuse::%player%} to now
				set fire to living entities in radius 14 around player where [entity input != player] for 6 seconds
				PlS("entity.blaze.shoot", 1, 1, location of player, all players)
				set {_loc} to the block above player
				loop 10 times:
					wait 2 tick
					loop blocks in radius loop-number around the block at {_loc}:
						if y-coordinate of loop-block is y-coordinate of {_loc}:
							if distance between location at loop-block and {_loc} is more than loop-number - 1:
								drawDot count 1, particle lava, speed 0, XYZ 1, 1, 1, center location of loop-block, visibleRange 320
								drawDot count 1, particle flame, speed 0.1, XYZ 1, 1, 1, center location of loop-block, visibleRange 320
							
#---Kaj Freeze---#
on left click:
	if line 2 of lore of player's tool is "&k&c&e":
		if spellID(37, event-player, line 1 of lore of player's tool) is true:
			if wandsCooldown(player, name of player's tool) is true:
				set {wands::tool::%name of player's tool%::lastuse::%player%} to now
				set {_t} to player's tool
				set {_e} to player #this should prevent type warns
				PlS("entity.llama.swag", 4, 1, player, all players)
				loop blocks from block above the player to the block above block 30 in front of the player:
					add 1 to {_i}
					set {_loc} to location of loop-block
					loop living entities in radius 2.2 around loop-block where [entity input isn't player]:
						exit 2 loops
					if loop-block is solid:
						stop loop
					drawDot count 8, particle cloud, speed 0.02, XYZ 0.1, 0.1, 0.1, center location of loop-block, visibleRange 320
					drawDot count 10, particle enchantmenttable, speed 0.1, XYZ 0.3, 0.3, 0.3, center location of loop-block, visibleRange 320
					if mod({_i}, 2) = 0:
						wait 1 tick
				loop living entities in radius 2.2 around {_loc} where [entity input isn't player]:
					remove slowness from loop-entity
					apply slowness 4 to loop-entity for 6 seconds
					damageEffect(3, player, loop-entity, {_t})
					loop 60 times:
						if loop-entity isn't alive:
							stop loop
						drawDot count 6, particle snowshovel, speed 0.01, XYZ 0.5, 0.5, 0.5, center location of block 3 above loop-entity, visibleRange 320
						drawDot count 6, particle cloud, speed 0, XYZ 0.4, 0.3, 0.4, center location of block 4 above loop-entity, visibleRange 320
						wait 2 ticks
					stop