event.sk

Created by SebyHas

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.

#Version: 2.0

Options:
	PermissionError: &c Sorry, but you don't have acces to use that command.
	AddHandMsg: &7&o I added %player's tool%&7&o to the list.
	AddInvMsg: &7&o I added %loop-item%&7&o to the list
	AddNoArg: %nl% &7Use &f/event add hand &7to add the item in your hand, to the gift list.%nl% &7Or  &f/event add inventory &7to add the entire inventory.%nl%%nl%   &4Be careful to have in the inventory only the items you want to add to the gift list
	ListColor: &e
	ListEmptyError: &7 The list is empty.
	CleanMsg: &7Variable was empty now.
	Delay: 1 second
	Particles: mob spawner flames
	Sound: entity.experience_orb.pickup #For every item
	SoundFinish: ENTITY_PLAYER_LEVELUP #For final
	Volume: 0.5
	DropHeight: 5


command /event [<text>] [<text>] [<integer>]:
	permission: sk.event
	permission message: {@PermissionError}
	trigger:
		if arg-1 is not set:
			message " "
			message " &eEvent:%nl%"
			send formatted " &7 /event add <tooltip:&ehand &7to add the hold item%nl%&einventory &7or &einv &7to add all the items you have in your inventory>&f[&esecond-argument&f] &r&oHover with cursor." to player
			send formatted " &7 /event <tooltip:&egive &7to give items to the player%nl%&edrop &7to drop items to the player>&f[&efirst-argument&f] <tooltip:&eall &7to give all items in list to the player%nl%&erandom &7to give random item in list to the player>&f[&esecond-argument&f] <tooltip:&7how many times this action was made>&f[&enumber&f] &r&oHover with cursor." to the player
			message " &7 /event list"
			message " &7 /event cleanall"
		if arg-1 is "add":
			if arg-2 is "hand":
				add player's tool to {eventitems::*}
				message "{@AddHandMsg}" to player
			else if arg-2 is "inv" or "inventory":
				loop all items in the inventory of player:
					add loop-item to {eventitems::*}
					message "{@AddInvMsg}" to player
			else:
				message "{@AddNoArg}" to player
		if arg-1 is "list":
			message " " to player
			if {eventitems::*} is set:
				loop {eventitems::*}:
					message " {@ListColor}%loop-value%" to player
			else:
				message "{@ListEmptyError}" to player
		if arg-1 is "give":
			if arg-2 is not set:
				message " %nl% &eall &7to give all items in list to the player%nl% &erandom &7to give random item in list to the player" to player
			else:
				if arg-2 is "all":
					if arg-3 is not set:
						eventgiveall(1, sender)
					else:
						eventgiveall(arg-3, sender)
				if arg-2 is "random":
					if arg-3 is not set:
						eventgiverandom(1, sender)
					else:
						eventgiverandom(arg-3, sender)
		if arg-1 is "drop":
			if arg-2 is not set:
				message " %nl% &eall &7to give all items in list to the player%nl% &erandom &7to give random item in list to the player" to player
			else:
				if arg-2 is "all":
					if arg-3 is not set:
						eventdropall(1, sender)
					else:
						eventdropall(arg-3, sender)
				if arg-2 is "random":
					if arg-3 is not set:
						eventdroprandom(1, sender)
					else:
						eventdroprandom(arg-3, sender)
		if arg-1 is "cleanall":
			delete {eventitems::*}
			message "{@CleanMsg}"

function eventgiveall(i: integer,s: sender):
	if {eventitems::*} is not set:
		send "&cThe gift list is empty." to {_s}
	else:
		loop all players:
			loop {_i} times:
				loop {eventitems::*}:
					if loop-player is offline:
						stop
					else:
						give loop-value-3 to loop-player
						show {@Particles} at block above loop-player's location
						play sound "{@Sound}" with volume {@Volume} to the loop-player
						wait {@Delay}
			play sound "{@SoundFinish}" with volume {@Volume} to the loop-player

function eventgiverandom(i: integer,s: sender):
	if {eventitems::*} is not set:
		send "&cThe gift list is empty." to {_s}
	else:
		loop all players:
			loop {_i} times:
				if loop-player is offline:
					stop
				else:
					set {_gift} to a random element out of {eventitems::*}
					give {_gift} to loop-player
					show {@Particles} at block {@DropHeight} above loop-player's location
					play sound "{@Sound}" with volume {@Volume} to the loop-player
					wait {@Delay}
			play sound "{@SoundFinish}" with volume {@Volume} to the loop-player


function eventdropall(i: integer,s: sender):
	if {eventitems::*} is not set:
		send "&cThe gift list is empty." to {_s}
	else:
		loop all players:
			loop {_i} times:
				loop {eventitems::*}:
					if loop-player is offline:
						stop
					else:
						drop loop-value-3 at block above loop-player's location
						show {@Particles} at block above loop-player's location
						play sound "{@Sound}" with volume {@Volume} to the loop-player
						wait {@Delay}
			play sound "{@SoundFinish}" with volume {@Volume} to the loop-player

function eventdroprandom(i: integer,s: sender):
	if {eventitems::*} is not set:
		send "&cThe gift list is empty." to {_s}
	else:
		loop all players:
			loop {_i} times:
				if loop-player is offline:
					stop
				else:
					set {_gift} to a random element out of {eventitems::*}
					drop {_gift} at block {@DropHeight} above loop-player's location
					show {@Particles} at block above loop-player's location
					play sound "{@Sound}" with volume {@Volume} to the loop-player
					wait {@Delay}
			play sound "{@SoundFinish}" with volume {@Volume} to the loop-player