FishyHits.sk

Created by MrScopes

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.

# FishyHits by MrScopes

options:

	cmd: /fh # Command needed to do stuff (/fh is default)
	reach: 4.5 # Maximum reach allowed (Prolly shouldn't go lower than 4.5 blocks)
	min cps: 16 # If a user gets more cps than this, it will log it.
	perm: your.permission # Permission to use fishyhits

	prefix: &6&lFH # Prefix for notify messages and /fh
	seperator: &8ยป # Comes right after the prefix

	notify1: &e(%{_d}% blocks) &7%attacker% failed to hit %victim%. # Don't remove the %{_d}% unless you know what you're doing (That is how many blocks away the player is)
	notify2: &7%player% is managing &e%{fh.cps::%player%}% &7cps. # Don't remove the '%{fh.cps::%player%}%' unless you know what you're doing (That's their cps)

	enable notifications: &7You have &a&lEnabled &7notifications. # When they enable notify
	disable notifications: &7You have &c&lDisabled &7notifications. # When they disable notify
	reminder: &7You have notifications disabled. # if you join while notify is off
	lostperm: &7It seems you've lost access to /fh while offline. # When they join with FH notify toggled as a non-staff

	noPerm: &7You don't have access to that. # When they don't have access to /fh commands
	no history: &7That player has no history. # When the player has no history
	deleted history: &7You deleted the history of &e%arg 2% # When you delete someones history

    # Warning: if you choose to keep this option 'True', the file may get big.
	# Note: deleting a player's history does not remove if from the logs.
	log: true # log a player's history in a file in 'Skript/Logs' folder

	# Be careful while editing this. Removing the '%{_d}%' will not log the blocks hit from
	history format reach: &8(&6Hit &e%victim% &6from &e%{_d}% blocks&6.)&7 # The format of how the player's history gets added
	history format cps: &8(&7%{fh.cps::%player%}% cps&8)&7 # The format of how the player's history gets added

# Don't edit unless you know your stuff

on leftclick:
	{fh.cooldown.cps::%player%} is not set
	add 1 to {fh.cps::%player%}
	if {fh.cps::%player%} is greater than or equal to {@min cps}:
		loop all players:
			loop-player has permission "{@perm}"
			{fh.notify::%loop-player%} is not set
			send "" to loop-player
			send " {@prefix} {@seperator} {@notify2}" to loop-player
			send "" to loop-player
		add "{@history format cps}" to {fh.history::%player%::*}
		set {_logState} to "{@log}" parsed as boolean
		if {_logState} is true:
			log "%player% managed %{fh.cps::%player%}% cps" to "FishyHits.log"
		delete {fh.cps::%player%}
		set {fh.cooldown.cps::%player%} to true
		wait 5 seconds
		delete {fh.cooldown.cps::%player%}
	wait 1 seconds
	delete {fh.cps::%player%}

on damage of entity:
	attacker is player
	damage cause is attack
	set {_d} to distance between attacker and victim
	if {_d} is greater than or equal to {@reach}:
		cancel event
		if {fh.cooldown.reach::%attacker%} is not set:
			loop all players:
				loop-player has permission "{@perm}"
				{fh.notify::%loop-player%} is not set
				send "" to loop-player
				send " {@prefix} {@seperator} {@notify1}" to loop-player
				send "" to loop-player
			add "{@history format reach}" to {fh.history::%attacker%::*}
			set {_logState} to "{@log}" parsed as boolean
			if {_logState} is true:
				log "%attacker% hit %victim% from %{_d}% blocks away." to "FishyHits.log"
			set {fh.cooldown.reach::%attacker%} to true
			wait 5 seconds
			delete {fh.cooldown.reach::%attacker%}

on join:
	if {fh.notify::%player%} is set:
		wait 3 ticks
		if player has permission "{@perm}":
			send ""
			send " {@prefix} {@seperator} {@reminder}"
			send ""
		else:
			send ""
			send " {@prefix} {@seperator} {@lostperm}"
			send ""
			delete {fh.notify::%player%}

command {@cmd} [<text>] [<offlineplayer>]:
	trigger:
		if arg 1 is not set:
			send ""
			send "      &6&lFishyHits"
			send "      &eby: MrScopes"
			send ""
			send " &6{@cmd}: &7basic commands for fishyhits."
			send " &6{@cmd} notify: &7toggle notifications from fishyhits."
			send " &6{@cmd} history: &7check the 'history' of a player (blocks away)."
			send " &6{@cmd} delete: &7delete a player's history."
			send ""	
		else:
			if arg 1 is "notify":
				if player has permission "{@perm}":
					if {fh.notify::%player%} is not set:
						send ""
						send " {@prefix} {@seperator} {@disable notifications}"
						send ""
						set {fh.notify::%player%} to false
					else if {fh.notify::%player%} is set:
						send ""
						send " {@prefix} {@seperator} {@enable notifications}"
						send ""
						delete {fh.notify::%player%}
				else:
					send ""
					send " {@prefix} {@seperator} {@noPerm}"
					send ""
			if arg 1 is "history":
				if arg 2 is not set:
					send ""
					send " {@prefix} {@seperator} &7{@cmd} history (player)"
					send ""
				else:
					if {fh.history::%arg 2%::*} is not set:
						send ""
						send " {@prefix} {@seperator} {@no history}"
						send ""
					else:
						send ""
						send "     &6Viewing history of &e%arg 2%"
						send "%{fh.history::%arg 2%::*}%"
						send ""
						set {_logState} to "{@log}" parsed as boolean
						if {_logState} is true:
							send " &7for a better history, check 'Skript/Logs/FishyHits' folder"
							send ""
			if arg 1 is "delete":
				if arg 2 is not set:
					send ""
					send " {@prefix} {@seperator} &7{@cmd} delete (player)"
					send ""
				else:
					if player does not have permission "{@perm}":
						send ""
						send " {@prefix} {@seperator} {@noPerm}"
						send ""
					else:
						if {fh.history::%arg 2%::*} is not set:
							send ""
							send " {@prefix} {@seperator} {@no history}"
							send ""
						else:
							delete {fh.history::%arg 2%::*}
							send ""
							send " {@prefix} {@seperator} {@deleted history}"
							send ""
			else if arg 1 is not "notify", "history" or "delete":
				send ""
				send "      &6&lFishyHits"
				send "      &eby: MrScopes"
				send ""
				send " &6{@cmd}: &7basic commands for fishyhits."
				send " &6{@cmd} notify: &7toggle notifications from fishyhits."
				send " &6{@cmd} history: &7check the 'history' of a player (blocks away)."
				send " &6{@cmd} delete: &7delete a player's history."
				send ""