Cryantic.sk

Created by frogsmasha

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.

# Cryantic AntiCheat
# By frogsmasha

# Warning for best acurracy please change this in config.sk
# number accuracy: 4-8
# 4 will do just fine, 8 is just for coolness lmao
# Note This just changes the variable max count, If you don't want to do this or is conflicting with other things
# its ok, It woun't affect the effectiveness of the anticheat, just the looks ;O

# Dependencies
# Skript 2.2-dev37c
# SkQuery 3.6.2-Lime
# Skellet 1.9.6

Variables:
	{%player%.notify.OF} = false	

# CONFIG (OPTIMIZED ON DOWNLOAD)
options:
	# Purge Config
	# PurgeViolations: true
	# PurgeMaxViolations: 620
	# UpdateAPI
	Version: 1.2 # 1.1
	CryanticAPIWeb: https://pastebin.com/raw/uz4XzvwL
	CryanticAPIVer: {Cryantic.Update.API}
	CryanticUptodate: &d&lCryantic &7// &aCryantic AntiCheat Fully up to date! &7[Ver: &3%{Cryantic.UPDATE.API}%&7]
	CryanticNotUptodate: &d&lCryantic &7// &cCryantic AntiCheat is out of date! &7[New: &3%{Cryantic.UPDATE.API}%&7]
	# Notification Message
	NotifcationPerm: Cryantic.Notify
	SneakDetection: &d&lCryantic &7// %player% // [&6&lSneak&7] // [&6Reason: %{%player%.Sneak.Reason}%&7]
	InvManagerDetection: &d&lCryantic &7// %player% // [&6&lInvManager&7] // [&6Reason: %{%player%.InvManager.Reason}%&7]
	InvalidMoveDetection: &d&lCryantic &7// %player% // [&6&lInvalidMove&7] // [&6Reason: %{%player%.InvalidMove.Reason}%&7] // [&5VL 1&7]
	KillauraDetection: &d&lCryantic &7// %attacker% // [&6&lKillaura&7] // &7[&7Reason: &b%{%attacker%.Killaura.Reason}%&7] // [&5VL 2&7]
	KillauraAutoBDetection: &d&lCryantic &7// %attacker% // [&6&lKillaura AutoBlock&7] // &7[&7Reason: &b%{%attacker%.Killaura.autoblock.Reason}%&7] // [&5VL &7]
	SpeedXDetection: &d&lCryantic &7// %loop-player% // [&6&lSpeed&7] // &7[&5Type: &3X&7] // [&5VL 2&7]
	SpeedZDetection: &d&lCryantic &7// %loop-player% // [&6&lSpeed&7] // &7[&5Type: &3Z&7] // [&5VL 2&7]
	SpeedXDetectionSensitive: &d&lCryantic &7// %loop-player-1% // [&6&lSensitive Speed&7] // &7[&5Type: &3X&7] // [&5VL %{%UUID of loop-player-1%.Violations.add}%&7]
	SpeedZDetectionSensitive: &d&lCryantic &7// %loop-player-1% // [&6&lSensitive Speed&7] // &7[&5Type: &3Z&7] // [&5VL %{%UUID of loop-player-1%.Violations.add}%&7]
	ReachDetection: &d&lCryantic &7// %attacker% // [&6&lReach&7] // &7[&5Range: &3%{_dvaMinus}%&7] // [&5VL %{_Reach.Rounded.%UUID of attacker%}%&7]
	FlightSDetection: &d&lCryantic &7// %loop-player-1% // [&6&lFlight&7] // &7[&5Type: &3Speed&7] // [&5VL 2&7]
	FlightFloat: &d&lCryantic &7// %loop-player-2% // [&6&lFlight&7] // &7[&5Type: &3Float&7] // [&5VL 8&7]
	KillauraBDetection: &d&lCryantic &7// %attacker% // [&6&lKillaura&7] // &7[&7Reason: &bSnap&7] // [&5VL 1&7]
	ScaffoldDetection: &d&lCryantic &7// %player% // [&6&lScaffold&7] // &7[&5Type: &b%{Scaffold.Current.Mode.%player's uuid%}%&7] // [&5VL 4&7]
	NoFallDetection: &d&lCryantic &7// %player% // [&6&lNoFall&7] // &7[&5Type: &bOnGround&7] // [&5VL 4&7]
	AngleDetection: &d&lCryantic &7// %attacker% // [&6&lAngle&7] // &7[&5Type: &bImposible&7] // [&5VL 2&7]
	# Detection Configs
	#Flight
	FlightGreater: 0.88
	IceFlightSpeed: 1.35 # 1.2p
	NormalFlightSpeed: 1.2
	#Speed
	SpeedGreater: 0.92
	#YPort
	YPortGreater: 0.03
	#SensitiveSpeed
	SensitiveSpeed: 0.975 #1.675 # 0.895 # 0.905
	#SensitiveSpeedAbove
	SensitiveSpeedAbove: 1.355 #
	#Killaura
	KillauraDIF: 3.78
	KillauraReach: 0.4782 # Best for 1.12.2 and 1.8
	#Reach
	ReachHalfBlocks: 4.2
	Reach: 3.95 #4.3
	#Angle
	Angle: 1.155
	#LagBack Lags The player back when cheating (Experimental)
	Lagback: true
	# Detections
	Sneak.Detection: true
	Killaura.Detection: false
	InvManager.Detection: true
	InvalidMove.Detection: true
	KillauraAutoB.Detection: true
	Speed.Detection: true
	SensitiveSpeed.Detection: true
	Reach.Detection: false
	Flight.Detection: true
	FlightFloat.Detection: true
	KillauraB.Detection: false # Snap Detection Wouldn't Suggest using it, has a few to meny false positives to enable
	Scaffold.Detection: true
	NoFall.Detection: true
	Angle.Detection: true
	# Violation Giveout amount
	InvalidMove.Violations: 1
	SneakInventory.Violations: 1
	InvClickSneakDetection.Violations: 1
	SneakMoveClick.Violations: 1
	InvManager.Violations: 1
	SneakSign.Violations: 1
	Speed.Violations: 2
	SensitiveSpeed.Violations: 10 # Multiplies by 10
	Killaura.Violations: 2
	KillauraAutoB.Violations: 2
	Flight.Violations: 2
	FlightFloat.Violations: 8
	KillauraB.Violation: 1
	Scaffold.Violations: 4
	NoFall.Violations: 4
	Angle.Violations: 2


on load:
	# UpdateAPI
	set {Cryantic.Update.API} to text from "{@CryanticAPIWeb}" # I'm aware this can Crash your server.
	if {@CryanticAPIVer} is "{@Version}":
		broadcast "{@CryanticUptodate}"
	else:
		broadcast "{@CryanticNotUptodate}"
	if {Purge.date.time} is not set:
		set {Purge.date.time} to "day"
	if {Server.Total.Bans.Cryantic} is not set:
		set {Server.Total.Bans.Cryantic} to 0

on join:
	if {%UUID of player%.Violations} is not set:
		set {%UUID of player%.Violations} to 0

# - Command - #
command /Cryantic [<text>] [<text>] [<player>]:
	permission: Cryantic.anticheat
	aliases: c
	trigger:
		if arg-1 is not set:
			send "  &0[&c&lCryantic AntiCheat&0]             "
			send "                                           "
			send "  &7/Cryantic notify (on/off)              "
			send "  &7/Cryantic Update check                 "
			send "  &7/Cryantic LoadedModules                "
			send "  &7/Cryantic Player info (player)         "
			send "  &7/Cryantic Player clear (player)        "
			send "                                           "
		if arg-1 is "notify":
			if arg-2 is "on":
				if {%player%.notify.OF} is "on":
					send "&d&lCryantic &7// &7Notifications are already enabled"
				else:
					set {%player%.notify.OF} to "on"
					send "&d&lCryantic &7// &7Notifications enabled"
			if arg-2 is "off":
				if {%player%.notify.OF} is "off":
					send "&d&lCryantic &7// &7Notifications are already disabled"
				else:
					set {%player%.notify.OF} to "off"
					send "&d&lCryantic &7// &7Notifications disabled"
			if arg-2 is not set:
				send "  &0[&c&lCryantic AntiCheat&0]             "
				send "                                           "
				send "  &7/Cryantic notify (on/off)              "
				send "  &7/Cryantic Update check                 "
				send "  &7/Cryantic LoadedModules                "
				send "  &7/Cryantic Player info (player)         "
				send "  &7/Cryantic Player clear (player)        "
				send "                                           "
		if arg-1 is "Update":
			if arg-2 is "Check":
				set {Cryantic.Update.API} to text from "{@CryanticAPIWeb}"
				if {@CryanticAPIVer} is "{@Version}":
					broadcast "{@CryanticUptodate}"
				else:
					broadcast "{@CryanticNotUptodate}"
			if arg-2 is not set:
				send "  &0[&c&lCryantic AntiCheat&0]             "
				send "                                           "
				send "  &7/Cryantic notify (on/off)              "
				send "  &7/Cryantic Update check                 "
				send "  &7/Cryantic LoadedModules                "
				send "  &7/Cryantic Player info (player)         "
				send "  &7/Cryantic Player clear (player)        "
				send "                                           "
		if arg-1 is "LoadedModules":
			if {@Sneak.Detection} = true:
				send "&d&lCryantic &7// &7Sneak Module &aLoaded"
			else:
				send "&d&lCryantic &7// &7Sneak Module &cDisabled"
			if {@Killaura.Detection} = true:
				send "&d&lCryantic &7// &7Killaura Module &aLoaded"
			else:
				send "&d&lCryantic &7// &7Killaura Module &cDisabled"
			if {@InvManager.Detection} = true:
				send "&d&lCryantic &7// &7InvManager Module &aLoaded"
			else:
				send "&d&lCryantic &7// &7InvManager Module &cDisabled"
			if {@InvalidMove.Detection} = true:
				send "&d&lCryantic &7// &7InvalidMove Module &aLoaded"
			else:
				send "&d&lCryantic &7// &7InvalidMove Module &cDisabled"
			if {@KillauraAutoB.Detection} = true:
				send "&d&lCryantic &7// &7KillauraAutoBlock Module &aLoaded"
			else:
				send "&d&lCryantic &7// &7KillauraAutoBlock Module &cDisabled"
			if {@Speed.Detection} = true:
				send "&d&lCryantic &7// &7Speed Module &aLoaded"
			else:
				send "&d&lCryantic &7// &7Speed Module &cDisabled"
			if {@SensitiveSpeed.Detection} = true:
				send "&d&lCryantic &7// &7SensitiveSpeed Module &aLoaded"
			else:
				send "&d&lCryantic &7// &7SensitiveSpeed Module &cDisabled"
			if {@Reach.Detection} = true:
				send "&d&lCryantic &7// &7Reach Module &aLoaded"
			else:
				send "&d&lCryantic &7// &7Reach Module &cDisabled"
			if {@Flight.Detection} = true:
				send "&d&lCryantic &7// &7Flight Module &aLoaded"
			else:
				send "&d&lCryantic &7// &7Flight Module &cDisabled"
			if {@FlightFloat.Detection} = true:
				send "&d&lCryantic &7// &7FlightFloat Module &aLoaded"
			else:
				send "&d&lCryantic &7// &7FlightFloat Module &cDisabled"
			if {@KillauraB.Detection} = true:
				send "&d&lCryantic &7// &7KillauraB Module &aLoaded"
			else:
				send "&d&lCryantic &7// &7KillauraB Module &cDisabled"
			if {@Scaffold.Detection} = true:
				send "&d&lCryantic &7// &7Scaffold Module &aLoaded"
			else:
				send "&d&lCryantic &7// &7Scaffold Module &cDisabled"
			if {@NoFall.Detection} = true:
				send "&d&lCryantic &7// &7NoFall Module &aLoaded"
			else:
				send "&d&lCryantic &7// &7NoFall Module &cDisabled"
			if {@Angle.Detection} = true:
				send "&d&lCryantic &7// &7Angle Module &aLoaded"
			else
				send "&d&lCryantic &7// &7Angle Module &cDisabled"
		if arg-1 = "Player":
			if arg-2 = "info":
				if arg-3 is not set:
					send "  &0[&c&lCryantic AntiCheat&0]             "
					send "                                           "
					send "  &7/Cryantic notify (on/off)              "
					send "  &7/Cryantic Update check                 "
					send "  &7/Cryantic LoadedModules                "
					send "  &7/Cryantic Player info (player)         "
					send "  &7/Cryantic Player clear (player)        "
					send "                                           "
				if arg-3 is set:
					send "&d&lCryantic &7// &7%arg-3%'s violation count [&f%{%arg-3's uuid%.Violations}%&7]"
		if arg-1 = "Player":
			if arg-2 = "Clear":
				if arg-3 is not set:
					send "  &0[&c&lCryantic AntiCheat&0]             "
					send "                                           "
					send "  &7/Cryantic notify (on/off)              "
					send "  &7/Cryantic Update check                 "
					send "  &7/Cryantic LoadedModules                "
					send "  &7/Cryantic Player info (player)         "
					send "  &7/Cryantic Player clear (player)        "
					send "                                           "
				if arg-3 is set:
					clear {%arg-3's uuid%.Violations}
					set {%arg-3's uuid%.Violations} to 0
					send "&d&lCryantic &7// &7%arg-3%'s violation count [&f%{%arg-3's uuid%.Violations}%&7]"


# - Movement Detections - #

# LagBack
every second:
	if {@Lagback} = true:
		loop all players:
			set {Location.LagBack.Test.%loop-player%} to location of loop-player
			set {Yaw.LagBack.%loop-player%} to yaw of loop-player
			set {Pitch.LagBack.%loop-player%} to pitch of loop-player

on any movement:
	player is on ground
	if {%uuid of player%.moving} is not set:
		set {%uuid of player%.moving} to true
		wait 1 tick
		delete {%uuid of player%.moving}
on inventory open:
	set {Inventory.State.%uuid of player%} to true

on inventory close:
	set {Inventory.State.%uuid of player%} to false

every tick:
	if {@KillauraB.Detection} = true:
		loop all players:
			set {Yaw.KillauraB.%loop-player's uuid%.current} to loop-player's Yaw
			set {Pitch.KillauraB.%loop-player's uuid%.current} to loop-player's Pitch
# Checks
	
on projectile hit:
	if event-entity is a ender pearl:
		set {Enderpearled.%shooter's uuid%} to true
		wait 1.8 tick
		set {Enderpearled.%shooter's uuid%} to false

function Enderpearled(p: player) :: boolean:
	set {_uuid} to uuid of {_p}
	if {Enderpearled.%{_uuid}%} = true:
		return true
	return false

#on death:
	#victim is player
	#set {IsDead.%uuid of player%} to true

on respawn:
	set {IsDead.%uuid of player%} to true
	wait 2.5 tick
	set {IsDead.%uuid of player%} to false

function IsDead(p: player) :: boolean:
	set {_uuid} to uuid of {_p}
	if {IsDead.%{_uuid}%} = true:
		return true
	return false

on teleport:
	set {Telporting.%uuid of player%} to true
	wait 2.2 tick
	set {Telporting.%uuid of player%} to false

function IsTelporting(p: player) :: boolean:
	set {_uuid} to uuid of {_p}
	if {Telporting.%{_uuid}%} = true:
		return true
	return false

on vehicle enter:
	set {_p} to passenger of event-entity
	set {_uuid} to uuid of {_p}
	set {VechileEnter.%{_uuid}%} to true
	wait 3 tick
	set {VechileEnter.%{_uuid}%} to false

function IsVechicleEnter(p: player) :: boolean:
	set {_uuid} to uuid of {_p}
	if {VechileEnter.%{_uuid}%} = true:
		return true
	return false

on vehicle exit:
	set {_uuid} to uuid of event-entity
	set {VechileExit.%{_uuid}%} to true
	wait 3 tick
	set {VechileExit.%{_uuid}%} to false

function IsVechicleExit(p: player) :: boolean:
	set {_uuid} to uuid of {_p}
	if {VechileExit.%{_uuid}%} = true:
		return true
	return false

on damage:
	set {Attacked.%uuid of attacker%} to true
	wait 3.2 ticks
	set {Attacked.%uuid of attacker%} to false

function IsAttacked(p: player) :: boolean:
	set {_uuid} to uuid of {_p}
	if {Attacked.%{_uuid}%} = true:
		return true
	return false

# Sneak // Inventory Manager // InvalidMove

on chat:
	if {@InvalidMove.Detection} = true:
		if player is sneaking:
			set {%player%.InvalidMove.Reason} to "Chat Move"
			add 1 to {%uuid of player%.InvalidMove.Alert}
			if {%uuid of player%.InvalidMove.Alert} = 2:
				add {@InvalidMove.Violations} to {%UUID of player%.Violations}
				clear {%uuid of player%.InvalidMove.Alert}
				loop all players:
					if {%loop-player%.notify.OF} is "on":
						if loop-player has permission "{@NotifcationPerm}":
							send "{@InvalidMoveDetection}" to loop-player

on inventory open:
	if {@Sneak.Detection} = true:
		wait 6 tick
		if player is sneaking:
			set {%player%.Sneak.Reason} to "Sneak Inventory"
			add {@SneakInventory.Violations} to {%UUID of player%.Violations}
			loop all players:
				if {%loop-player%.notify.OF} is "on":
					if loop-player has permission "{@NotifcationPerm}":
						send "{@SneakDetection}" to loop-player

on inventory click:
	if {@Sneak.Detection} = true:
		wait 6 tick
		player's gamemode is not creative
		if player is sneaking:
			set {%player%.Sneak.Reason} to "Inv Click Sneak"
			add {@InvClickSneakDetection.Violations} to {%UUID of player%.Violations}
			loop all players:
				if {%loop-player%.notify.OF} is "on":
					if loop-player has permission "{@NotifcationPerm}":
						send "{@SneakDetection}" to loop-player

		if {%uuid of player%.moving} = true:
			if player is sneaking:
				set {%player%.Sneak.Reason} to "Moving + Sneak + Clicking"
				add {@SneakMoveClick.Violations} to {%UUID of player%.Violations}
				loop all players:
					if {%loop-player%.notify.OF} is "on":
						if loop-player has permission "{@NotifcationPerm}":
							send "{@SneakDetection}" to loop-player
	if {@InvManager.Detection} = true:
		if {%uuid of player%.moving} = true:
			set {%player%.InvManager.Reason} to "Moving + Clicking"
			add 1 to {%UUID of player%.alert.InvManager}
			if {%UUID of player%.alert.InvManager} = 20:
				add {@InvManager.Violations} to {%UUID of player%.Violations}
				clear {%UUID of player%.alert.InvManager}
				loop all players:
					if {%loop-player%.notify.OF} is "on":
						if loop-player has permission "{@NotifcationPerm}":
							send "{@InvManagerDetection}" to loop-player

on sign change:
	if {@Sneak.Detection} = true:
		wait 6 tick
		if player is sneaking:
			set {%player%.Sneak.Reason} to "Sign Change + Sneak"
			add {SneakSign.Violations} to {%UUID of player%.Violations}
			loop all players:
				if {%loop-player%.notify.OF} is "on":
					if loop-player has permission "{@NotifcationPerm}":
						send "{@SneakDetection}" to loop-player

# Speed

every 3 ticks:
	loop all players:
		if {%uuid of loop-player%.moving} = true:
# Speed
			loop-player is not flying
			loop-player's gamemode is not creative
			loop-player's gamemode is not spectator
			if {@Speed.Detection} = true:
				if Enderpearled(loop-player):
					stop
				if IsDead(loop-player):
					stop
				if IsTelporting(loop-player):
					stop
				if IsVechicleEnter(loop-player):
					stop
				if IsVechicleExit(loop-player):
					stop
				set {Block.Below.%loop-player's uuid%} to the block 0 below the loop-player
				if {Block.Below.%loop-player's uuid%} is not "air":
# X
					set {Flight.Speed.X.location.last.%loop-player's uuid%} to the x location of loop-player
					set {LagBack.Fligh.Speed.location.%loop-player's uuid%} to "%location of loop-player%"
					wait 1 tick
					if difference between {Flight.Speed.X.location.last.%loop-player's uuid%} and {Flight.Speed.X.location.Current.%loop-player's uuid%} > {@SpeedGreater}: #0.85
#						add 1 to {Flight.Speed.X.alert.%loop-player's uuid%}
						teleport loop-player to {Location.LagBack.Test.%loop-player%}
						wait 1 tick
						teleport loop-player to {Location.LagBack.Test.%loop-player%} 
						add {@Speed.Violations} to {%UUID of loop-player%.Violations}
#						if {Flight.Speed.X.alert.%loop-player's uuid%} is 1 or above:
#							clear {Flight.Speed.X.alert.%loop-player's uuid%}
						if {%loop-player%.notify.OF} is "on":
							if loop-player has permission "{@NotifcationPerm}":
								send "{@SpeedXDetection}" to loop-player
# Z									
					set {Flight.Speed.Z.location.last.%loop-player's uuid%} to the z location of loop-player
					set {LagBack.Fligh.Speed.location.%loop-player's uuid%} to "%location of loop-player%"
					wait 1 tick
					if difference between {Flight.Speed.Z.location.last.%loop-player's uuid%} and {Flight.Speed.Z.location.Current.%loop-player's uuid%} > {@SpeedGreater}: #0.85
#						add 1 to {Flight.Speed.Z.alert.%loop-player's uuid%}
						teleport loop-player to {Location.LagBack.Test.%loop-player%}
						wait 1 tick
						teleport loop-player to {Location.LagBack.Test.%loop-player%} 
						add {@Speed.Violations} to {%UUID of loop-player%.Violations}
#						if {Flight.Speed.Z.alert.%loop-player's uuid%} is 1 or above:
#							clear {Flight.Speed.Z.alert.%loop-player's uuid%}
						if {%loop-player%.notify.OF} is "on":
							if loop-player has permission "{@NotifcationPerm}":
								send "{@SpeedZDetection}" to loop-player

# Sensitive Location Checks
every 1 ticks:
	if {@SensitiveSpeed.Detection} = true:
		loop all players:
			set {%loop-player's uuid%.Blocks.Second.1.X} to x location of loop-player
			set {%loop-player's uuid%.Blocks.Second.1.Z} to z location of loop-player

every 1 ticks:
	if {@SensitiveSpeed.Detection} = true:
		loop all players:
			set {%loop-player's uuid%.Blocks.Second.2.X} to x location of loop-player
			set {%loop-player's uuid%.Blocks.Second.2.Z} to z location of loop-player

every 1 ticks:
	if {@SensitiveSpeed.Detection} = true:
		loop all players:
			set {%loop-player's uuid%.Blocks.Second.X.Complete} to {%loop-player's uuid%.Blocks.Second.1.X} - {%loop-player's uuid%.Blocks.Second.2.X}
			set {%loop-player's uuid%.Blocks.Second.Z.Complete} to {%loop-player's uuid%.Blocks.Second.1.Z} - {%loop-player's uuid%.Blocks.Second.2.Z}

# Sensitive Speed Check
every 1 ticks:
	if {@SensitiveSpeed.Detection} = true:
		loop all players:
			loop-player is not flying
			loop-player's gamemode is not creative
			loop-player's gamemode is not spectator
			# CHECKS
			
			# Extra method from old way
			# Stop
			#if {%loop-player's uuid%.Blocks.Second.X.Complete} = 0:
				#stop
			#if {%loop-player's uuid%.Blocks.Second.Z.Complete} = 0:
				#stop
			# Block Above
			set {Block.Above.%loop-player's uuid%} to the block 2 above the loop-player
			if {Block.Above.%loop-player's uuid%} != air:
				set {SensitiveSpeed} to {@SensitiveSpeedAbove}
			else:
				set {SensitiveSpeed} to {@SensitiveSpeed}
			# Enderpearl
			if Enderpearled(loop-player):
				stop
			# Respawn / Death
			if IsDead(loop-player):
				stop
			# Teleporting
			if IsTelporting(loop-player):
				stop
			# Vechile Enter
			if IsVechicleEnter(loop-player):
				stop
			# Vechile Exit
			if IsVechicleExit(loop-player):
				stop
			# Attacked
			if IsAttacked(loop-player):
				stop
			if {%loop-player's uuid%.Blocks.Second.X.Complete} is bigger than {SensitiveSpeed}: # 1.675
				teleport loop-player to {Location.LagBack.Test.%loop-player%}
				set loop-player's pitch to {Pitch.LagBack.%loop-player%}
				set loop-player's yaw to {Yaw.LagBack.%loop-player%}
				set {%UUID of loop-player%.Violations.add} to {%loop-player's uuid%.Blocks.Second.X.Complete} * {@SensitiveSpeed.Violations}
				set {%UUID of loop-player%.Violations.add} to abs({%UUID of loop-player%.Violations.add})
				add {%UUID of loop-player%.Violations.add} to {%UUID of loop-player%.Violations}
				loop all players:
					if {%loop-player-2%.notify.OF} is "on":
						if loop-player-2 has permission "{@NotifcationPerm}":
							send "{@SpeedXDetectionSensitive}" to loop-player-2
			if {%loop-player's uuid%.Blocks.Second.X.Complete} is less than {SensitiveSpeed} * -1: #1.675
				teleport loop-player to {Location.LagBack.Test.%loop-player%}
				set loop-player's pitch to {Pitch.LagBack.%loop-player%}
				set loop-player's yaw to {Yaw.LagBack.%loop-player%}
				set {%UUID of loop-player%.Violations.add} to {%loop-player's uuid%.Blocks.Second.X.Complete} * {@SensitiveSpeed.Violations}
				set {%UUID of loop-player%.Violations.add} to abs({%UUID of loop-player%.Violations.add})
				add {%UUID of loop-player%.Violations.add} to {%UUID of loop-player%.Violations}
				loop all players:
					if {%loop-player-2%.notify.OF} is "on":
						if loop-player-2 has permission "{@NotifcationPerm}":
							send "{@SpeedXDetectionSensitive}" to loop-player-2

			if {%loop-player's uuid%.Blocks.Second.Z.Complete} is less than {SensitiveSpeed} * -1: # -1.675
				teleport loop-player to {Location.LagBack.Test.%loop-player%}
				set loop-player's pitch to {Pitch.LagBack.%loop-player%}
				set loop-player's yaw to {Yaw.LagBack.%loop-player%}
				set {%UUID of loop-player%.Violations.add} to {%loop-player's uuid%.Blocks.Second.Z.Complete} * {@SensitiveSpeed.Violations}
				set {%UUID of loop-player%.Violations.add} to abs({%UUID of loop-player%.Violations.add})
				send {%UUID of loop-player%.Violations.add} to loop-player-1
				add {%UUID of loop-player%.Violations.add} to {%UUID of loop-player%.Violations}
				loop all players:
					if {%loop-player-2%.notify.OF} is "on":
						if loop-player-2 has permission "{@NotifcationPerm}":
							send "{@SpeedZDetectionSensitive}" to loop-player-2
			if {%loop-player's uuid%.Blocks.Second.Z.Complete} is greater than {SensitiveSpeed}: #-1.675
				teleport loop-player to {Location.LagBack.Test.%loop-player%}
				set loop-player's pitch to {Pitch.LagBack.%loop-player%}
				set loop-player's yaw to {Yaw.LagBack.%loop-player%}
				set {%UUID of loop-player%.Violations.add} to {%loop-player's uuid%.Blocks.Second.Z.Complete} * {@SensitiveSpeed.Violations}
				set {%UUID of loop-player%.Violations.add} to abs({%UUID of loop-player%.Violations.add})
				send {%UUID of loop-player%.Violations.add} to loop-player-1
				add {%UUID of loop-player%.Violations.add} to {%UUID of loop-player%.Violations}
				loop all players:
					if {%loop-player-2%.notify.OF} is "on":
						if loop-player-2 has permission "{@NotifcationPerm}":
							send "{@SpeedZDetectionSensitive}" to loop-player-2


every 2 ticks:
	loop all players:
		set {Flight.Speed.X.location.Current.%loop-player's uuid%} to the x location of loop-player
		set {Flight.Speed.Z.location.Current.%loop-player's uuid%} to the z location of loop-player
		set {Flight.Speed.Y.location.Current.%loop-player's uuid%} to the y location of loop-player
		# Y Port
		set {YPort.Lower.Current.%loop-player's uuid%} to the y location of loop-player

# Flight / Teleportation
every tick:
	if {@Flight.Detection} = true:
		loop all players:
			set {SpeedFlight.X.%loop-player's uuid%.location.current} to loop-player's x location
			set {SpeedFlight.Z.%loop-player's uuid%.location.current} to loop-player's z location

every 2 ticks:
	if {@Flight.Detection} = true:
		loop all players:
			loop-player is not flying
			loop-player's gamemode is not creative or spectator
			if Enderpearled(loop-player):
				stop
			if IsDead(loop-player):
				stop
			if IsTelporting(loop-player):
				stop
			if IsVechicleEnter(loop-player):
				stop
			if IsVechicleExit(loop-player):
				stop
			if IsAttacked(loop-player):
				stop
			set {Block.Below.%loop-player's uuid%} to the block 1 below the loop-player
			if {Block.Below.%loop-player's uuid%} is ice or packed ice:
				set {FlightSpeed} to {@IceFlightSpeed}
			else:
				set {FlightSpeed} to {@NormalFlightSpeed}
			set {SpeedFlight.X.%loop-player's uuid%.location.second} to loop-player's x location
			if difference between {SpeedFlight.X.%loop-player's uuid%.location.current} and {SpeedFlight.X.%loop-player's uuid%.location.second} > 0.43:
				set {SpeedFlight.X.%loop-player's uuid%.Range} to {SpeedFlight.X.%loop-player's uuid%.location.current} - {SpeedFlight.X.%loop-player's uuid%.location.second}
				if {SpeedFlight.X.%loop-player's uuid%.Range} is greater than {FlightSpeed}: # 1.2
					add 1 to {SpeedFlight.X.%loop-player's uuid%.Final.1}
					if {SpeedFlight.X.%loop-player's uuid%.Final.1} = 2:
						add {@Flight.Violations} to {%UUID of loop-player%.Violations}
						clear {SpeedFlight.X.%loop-player's uuid%.Final.1}

						if {@SensitiveSpeed.Detection} = true:
							teleport loop-player to {Location.LagBack.Test.%loop-player%}
							set loop-player's pitch to {Pitch.LagBack.%loop-player%}
							set loop-player's yaw to {Yaw.LagBack.%loop-player%}

						loop all players:
							if {%loop-player-2%.notify.OF} is "on":
								if loop-player-2 has permission "{@NotifcationPerm}":
									send "{@FlightSDetection}" to loop-player-2
					stop
				if {SpeedFlight.X.%loop-player's uuid%.Range} is less than {FlightSpeed} * -1:
					add 1 to {SpeedFlight.X.%loop-player's uuid%.Final.2}
					if {SpeedFlight.X.%loop-player's uuid%.Final.2} = 2:
						add {@Flight.Violations} to {%UUID of loop-player%.Violations}
						clear {SpeedFlight.X.%loop-player's uuid%.Final.2}

						if {@SensitiveSpeed.Detection} = true:
							teleport loop-player to {Location.LagBack.Test.%loop-player%}
							set loop-player's pitch to {Pitch.LagBack.%loop-player%}
							set loop-player's yaw to {Yaw.LagBack.%loop-player%}

						loop all players:
							if {%loop-player-2%.notify.OF} is "on":
								if loop-player-2 has permission "{@NotifcationPerm}":
									send "{@FlightSDetection}" to loop-player-2
					stop

every 2 ticks:
	if {@Flight.Detection} = true:
		loop all players:
			loop-player is not flying
			loop-player's gamemode is not creative
			if Enderpearled(loop-player):
				stop
			if IsDead(loop-player):
				stop
			if IsTelporting(loop-player):
				stop
			if IsVechicleEnter(loop-player):
				stop
			if IsVechicleExit(loop-player):
				stop
			if IsAttacked(loop-player):
				stop
			set {Block.Below.%loop-player's uuid%} to the block 1 below the loop-player
			if {Block.Below.%loop-player's uuid%} is ice or packed ice:
				set {FlightSpeed} to {@IceFlightSpeed}
			else:
				set {FlightSpeed} to {@NormalFlightSpeed}
			set {SpeedFlight.Z.%loop-player's uuid%.location.second} to loop-player's z location
			if difference between {SpeedFlight.Z.%loop-player's uuid%.location.current} and {SpeedFlight.Z.%loop-player's uuid%.location.second} > 0.43:
				set {SpeedFlight.Z.%loop-player's uuid%.Range} to {SpeedFlight.Z.%loop-player's uuid%.location.current} - {SpeedFlight.Z.%loop-player's uuid%.location.second}
				if {SpeedFlight.Z.%loop-player's uuid%.Range} is greater than {FlightSpeed}:
					add 1 to {SpeedFlight.Z.%loop-player's uuid%.Final.2}
					if {SpeedFlight.Z.%loop-player's uuid%.Final.2} = 2:
						add {@Flight.Violations} to {%UUID of loop-player%.Violations}
						clear {SpeedFlight.Z.%loop-player's uuid%.Final.2}

						if {@SensitiveSpeed.Detection} = true:
							teleport loop-player to {Location.LagBack.Test.%loop-player%}
							set loop-player's pitch to {Pitch.LagBack.%loop-player%}
							set loop-player's yaw to {Yaw.LagBack.%loop-player%}

						loop all players:
							if {%loop-player-2%.notify.OF} is "on":
								if loop-player-2 has permission "{@NotifcationPerm}":
									send "{@FlightSDetection}" to loop-player-2
					stop
				if {SpeedFlight.Z.%loop-player's uuid%.Range} is less than {FlightSpeed} * -1:
					add 1 to {SpeedFlight.Z.%loop-player's uuid%.Final.2}
					if {SpeedFlight.Z.%loop-player's uuid%.Final.2} = 2:
						add {@Flight.Violations} to {%UUID of loop-player%.Violations}
						clear {SpeedFlight.Z.%loop-player's uuid%.Final.2}

						if {@SensitiveSpeed.Detection} = true:
							teleport loop-player to {Location.LagBack.Test.%loop-player%}
							set loop-player's pitch to {Pitch.LagBack.%loop-player%}
							set loop-player's yaw to {Yaw.LagBack.%loop-player%}

						loop all players:
							if {%loop-player-2%.notify.OF} is "on":
								if loop-player-2 has permission "{@NotifcationPerm}":
									send "{@FlightSDetection}" to loop-player-2
					stop

# Flight Float // HighJump // LongJump // Glide 
on packet:
	if {@FlightFloat.Detection} = true:
		if event-string = "PacketPlayInFlying":
			loop all players:
				loop-player's gamemode is not creative or spectator
				loop-player is not flying
				loop all blocks in radius 2.15525 around loop-player: #1.275
					if loop-block is not air:
						stop
				if Enderpearled(loop-player):
					stop
				if IsDead(loop-player):
					stop
				if IsTelporting(loop-player):
					stop
				if IsVechicleEnter(loop-player):
					stop
				if IsVechicleExit(loop-player):
					stop
				set {FlightFloat.Block.Below.%loop-player's uuid%} to the block 0.05 below the loop-player
				if block below {FlightFloat.Block.Below.%loop-player's uuid%} is air:
					add 1 to {FlightFloat.Alert.%loop-player's uuid%}
					add {@FlightFloat.Violations} to {%UUID of loop-player%.Violations}
					if {FlightFloat.Alert.%loop-player's uuid%} = 2:
						clear {FlightFloat.Alert.%loop-player's uuid%}
						loop all players:
							if {%loop-player-2%.notify.OF} is "on":
								if loop-player-2 has permission "{@NotifcationPerm}":
									send "{@FlightFloat}" to loop-player-2

# Scaffold // Base Scaffold Code // Modified By Etho, Thanks to Phe0X
on packet:
	{@Scaffold.Detection} = true
	player's gamemode is not creative
	if IsDead(player):
		stop
	event-string contains "PacketPlayInBlockPlace"
	set {_c} to packet field "c"
	set {_e} to packet field "e"
	set {_f} to packet field "f"
	set {_g} to packet field "g"
	if {_e} > 1:
		loop all players:
			if {%loop-player%.notify.OF} is "on":
				if loop-player has permission "{@NotifcationPerm}":
					set {Scaffold.Current.Mode.%player's uuid%} to "Wrongly"
					send "{@ScaffoldDetection}" to loop-player
	if {_f} > 1:
		loop all players:
			if {%loop-player%.notify.OF} is "on":
				if loop-player has permission "{@NotifcationPerm}":
					set {Scaffold.Current.Mode.%player's uuid%} to "Wrongly"
					send "{@ScaffoldDetection}" to loop-player
	if {_g} > 1:
		loop all players:
			if {%loop-player%.notify.OF} is "on":
				if loop-player has permission "{@NotifcationPerm}":
					set {Scaffold.Current.Mode.%player's uuid%} to "Wrongly"
					send "{@ScaffoldDetection}" to loop-player
	if {_e} = {_f}:
		{_f} is not 0
		if {Scaffold.Block.Target.%event-player's uuid%} = location of target block:
			clear {Scaffold.Alert.v1.%player's uuid%}
			stop
		set {Scaffold.Block.Target.%event-player's uuid%} to location of target block
		add 1 to {Scaffold.Alert.v1.%player's uuid%}
		{Scaffold.Alert.v1.%player's uuid%} > 2 # 0.1
		add {@Scaffold.Violations} to {%UUID of player%.Violations}
		loop all players:
			if {%loop-player%.notify.OF} is "on":
				if loop-player has permission "{@NotifcationPerm}":
					set {Scaffold.Current.Mode.%player's uuid%} to "Invalid" # 0.1
					send "{@ScaffoldDetection}" to loop-player
	if {_f} = {_g}:
		{_f} is not 0
		if {Scaffold.Block.Target.%event-player's uuid%} = location of target block:
			clear {Scaffold.Alert.v1.%player's uuid%}
			stop
		set {Scaffold.Block.Target.%event-player's uuid%} to location of target block
		add 1 to {Scaffold.Alert.v1.%player's uuid%}
		{Scaffold.Alert.v1.%player's uuid%} > 3 # 0.2
		add {@Scaffold.Violations} to {%UUID of player%.Violations}
		loop all players:
			if {%loop-player%.notify.OF} is "on":
				if loop-player has permission "{@NotifcationPerm}":
					set {Scaffold.Current.Mode.%player's uuid%} to "Invalid" # 0.2
					send "{@ScaffoldDetection}" to loop-player
	if {_e} = {_g}:
		{_e} is not 0
		if {Scaffold.Block.Target.%event-player's uuid%} = location of target block:
			clear {Scaffold.Alert.v1.%player's uuid%}
			stop
		set {Scaffold.Block.Target.%event-player's uuid%} to location of target block
		add 1 to {Scaffold.Alert.v1.%player's uuid%}
		{Scaffold.Alert.v1.%player's uuid%} > 2 # 0.3
		add {@Scaffold.Violations} to {%UUID of player%.Violations}
		loop all players:
			if {%loop-player%.notify.OF} is "on":
				if loop-player has permission "{@NotifcationPerm}":
					set {Scaffold.Current.Mode.%player's uuid%} to "Invalid" # 0.2
					send "{@ScaffoldDetection}" to loop-player
# NoFall
function Air(p: player) :: boolean:
	loop all blocks in radius 2 around {_p}:
		if loop-block is not air:
			return false
	return true

on any move:
	{@NoFall.Detection} = true
	player is not flying
	player is not riding
	player's gamemode is not creative or spectator
	if IsVechicleEnter(player):
		stop
	if IsVechicleExit(player):
		stop
	if Air(player):
		player is on ground
		add {@NoFall.Violations} to {%UUID of player%.Violations}
		set player's pitch to {Pitch.LagBack.%player%}
		set player's yaw to {Yaw.LagBack.%player%}
		damage player by 0.5 hearts
		loop all players:
			if {%loop-player%.notify.OF} is "on":
				if loop-player has permission "{@NotifcationPerm}":
					send "{@NoFallDetection}" to loop-player

# - Player Detections - #


# - Combat Detections - #

#on rightclick:
#	set {%uuid of player%.rightclick.tick} to true
#	wait 1 tick
#	clear {%uuid of player%.rightclick.tick}


# Bad Method for Autoblock
every tick:
	loop all players:
		if loop-player is blocking:
			set {%uuid of loop-player%.rightclick.tick} to true
		else:
			set {%uuid of loop-player%.rightclick.tick} to false
		wait 2 tick
		set {%uuid of loop-player%.rightclick.tick} to false

# Killaura
every tick:
	{@Killaura.Detection} = true:
		loop all players:
			set {ac.killaura.infront.%loop-player's UUID%} to location of block {@KillauraDIF} infront loop-player #3.78

on damage:
	{@Killaura.Detection} = true:
		attacker is a player:
			attacker is not victim
			distance between {ac.killaura.infront.%attacker's UUID%} and block {@KillauraDIF} infront attacker is bigger than {@KillauraReach}: # 0.48 #BEST: 0.478
				add 1 to {%attacker's UUID%.ac.killaura}
				if {%attacker's UUID%.ac.killaura} is 2 or above:
					clear {%attacker's UUID%.ac.killaura}
					add {@Killaura.Violations} to {%UUID of attacker%.Violations}
					set {%attacker%.Killaura.Reason} to "Normal-Killaura"
					loop all players:
						if {%loop-player%.notify.OF} is "on":
							if loop-player has permission "{@NotifcationPerm}":
								send "{@KillauraDetection}" to loop-player
#				if {Inventory.State.%uuid of attacker%} = true:
#					set {%attacker%.Killaura.Reason} to "Inventory-Killaura"
#					loop all players:
#						if {%loop-player%.notify.OF} is "on":
#							if loop-player has permission "{@NotifcationPerm}":
#								send "{@KillauraDetection}" to loop-player
	{@KillauraAutoB.Detection} = true:
		attacker is a player:
			#if {%attacker's UUID%.ac.killaura} is 2 or above:
			#	clear {%attacker's UUID%.ac.killaura}
			if {%uuid of attacker%.rightclick.tick} = true:
				add 1 to {%uuid of attacker%.Killaura.autoblock.alert}
				if {%uuid of attacker%.Killaura.autoblock.alert} = 5 or above:
					clear {%uuid of attacker%.Killaura.autoblock.alert}
					add {@KillauraAutoB.Violations} to {%UUID of attacker%.Violations}
					set {%attacker%.Killaura.autoblock.Reason} to "Autoblock-Killaura"
					loop all players:
						if {%loop-player%.notify.OF} is "on":
							if loop-player has permission "{@NotifcationPerm}":
								send "{@KillauraAutoBDetection}" to loop-player
	{@Reach.Detection} = true:
		attacker is a player:
			gamemode of attacker is survival or adventure:
				fly mode of attacker is false:
					attacker is not riding a boat or pig or horse:
						damage wasn't caused by projectile:
							set {_y.a.%UUID of attacker%} to y coord of attacker
							set {_y.v.%UUID of victim%} to y coord of victim
							set {_yayv} to {_y.v.%UUID of victim%} - {_y.a.%UUID of attacker%}
							if {_yayv} >= 0.01:
								set {_dva} to distance between location of victim and location of attacker
								set {_dvaMinus} to {_dva} - {_yayv}
							if {_yayv} <= 0:
								set {_dva} to distance between location of victim and location of attacker
								set {_dvaMinus} to {_dva} - {_yayv}
							loop all blocks in radius 1.5 around attacker:
								if loop-block is slab or stairs:
									{_dvaMinus} is bigger than {@ReachHalfBlocks}: # 4.2
										set {_Reach.Rounded.%UUID of attacker%} to round({_dvaMinus})
										loop all players:
											if {%loop-player%.notify.OF} is "on":
												if loop-player has permission "{@NotifcationPerm}":
													send "{@ReachDetection}" to loop-player
										add {_Reach.Rounded.%UUID of attacker%} to {%UUID of attacker%.Violations}
										stop
								else:
									{_dvaMinus} is bigger than {@Reach}: # 3.85
										set {_Reach.Rounded.%UUID of attacker%} to round({_dvaMinus})
										loop all players:
											if {%loop-player%.notify.OF} is "on":
												if loop-player has permission "{@NotifcationPerm}":
													send "{@ReachDetection}" to loop-player
										add {_Reach.Rounded.%UUID of attacker%} to {%UUID of attacker%.Violations}
										stop
	{@KillauraB.Detection} = true:
		set {Yaw.KillauraB.%attacker's uuid%.damage.1} to attacker's Yaw
		set {Pitch.KillauraB.%attacker's uuid%.damage.1} to attacker's Pitch
		set {Yaw.KillauraB.%attacker's uuid%.damage.2} to attacker's Yaw
		set {Pitch.KillauraB.%attacker's uuid%.damage.2} to attacker's Pitch
		remove 2.125 from {Yaw.KillauraB.%attacker's uuid%.damage.1}
		remove 2.125 from {Pitch.KillauraB.%attacker's uuid%.damage.1}
		add 2.125 to {Yaw.KillauraB.%attacker's uuid%.damage.2}
		add 2.125 to {Pitch.KillauraB.%attacker's uuid%.damage.2}
		if {Yaw.KillauraB.%attacker's uuid%.damage.1} is bigger than {Yaw.KillauraB.%attacker's uuid%.current}:
			add 1 to {KillauraB.AlertB.%attacker's uuid%.1}
			add {@KillauraB.Violation} to {%UUID of attacker%.Violations}
			if {KillauraB.AlertB.%attacker's uuid%.1} = 2 or above:
				clear {KillauraB.AlertB.%attacker's uuid%.1}
				loop all players:
					if {%loop-player%.notify.OF} is "on":
						if loop-player has permission "{@NotifcationPerm}":
							send "{@KillauraBDetection}" to loop-player
		if {Pitch.KillauraB.%attacker's uuid%.damage.1} is bigger than {Pitch.KillauraB.%attacker's uuid%.current}:
			add 1 to {KillauraB.AlertB.%attacker's uuid%.1}
			add {@KillauraB.Violation} to {%UUID of attacker%.Violations}
			if {KillauraB.AlertB.%attacker's uuid%.1} = 2 or above:
				clear {KillauraB.AlertB.%attacker's uuid%.1}
				loop all players:
					if {%loop-player%.notify.OF} is "on":
						if loop-player has permission "{@NotifcationPerm}":
							send "{@KillauraBDetection}" to loop-player
		if {Yaw.KillauraB.%attacker's uuid%.damage.2} is less than {Yaw.KillauraB.%attacker's uuid%.current}:
			add 1 to {KillauraB.AlertB.%attacker's uuid%.2}
			add {@KillauraB.Violation} to {%UUID of attacker%.Violations}
			if {KillauraB.AlertB.%attacker's uuid%.2} = 2 or above:
				clear {KillauraB.AlertB.%attacker's uuid%.2}
				loop all players:
					if {%loop-player%.notify.OF} is "on":
						if loop-player has permission "{@NotifcationPerm}":
							send "{@KillauraBDetection}" to loop-player
		if {Pitch.KillauraB.%attacker's uuid%.damage.2} is less than {Pitch.KillauraB.%attacker's uuid%.current}:
			add 1 to {KillauraB.AlertB.%attacker's uuid%.2}
			add {@KillauraB.Violation} to {%UUID of attacker%.Violations}
			if {KillauraB.AlertB.%attacker's uuid%.2} = 2 or above:
				clear {KillauraB.AlertB.%attacker's uuid%.2}
				loop all players:
					if {%loop-player%.notify.OF} is "on":
						if loop-player has permission "{@NotifcationPerm}":
							send "{@KillauraBDetection}" to loop-player
	{@Angle.Detection} = true:
		attacker is player
		if IsTelporting(attacker):
			stop
		if Enderpearled(attacker):
			stop
		# Location Var of Victim and Attacker
		set {_a} to vector to location of attacker
		set {_c} to vector to location of victim
		# Attacker's Pitch
		set {_ap} to pitch of attacker
		set {_ay} to yaw of attacker
		# Add To Main Location Var
		add {_ap} to vector pitch of {_v}
		add {_ay} to vector yaw of {_v}
		set {_v} to angle between {_a} and {_c}
		if {_v} is greater than {@Angle}: #1.1940 
			add {@Angle.Violations} to {%UUID of attacker%.Violations}
			loop all players:
				if {%loop-player%.notify.OF} is "on":
					if loop-player has permission "{@NotifcationPerm}":
						send "{@AngleDetection}" to loop-player
#	{@KillauraMultiAura.Detection} = true:
#		if {KillauraMultiAura.LastTime} is now:
#				set {KillauraMultiAura.LastDetection} to false
#				clear {KillauraMultiAura.LastTime}
#				broadcast "MultiAura"
#			set {KillauraMultiAura.LastTime} to now
#			set {KillauraMultiAura.LastDetection} to true

# Unstable
#			set {%attacker%.blockfront.Killaura} to the block {@KillauraDIF} infront of the attacker
#			if {%attacker%.blockfront.killaura} is not "air":
#				add 1 to {%attacker's UUID%.ac.killaura.Walls}
#				if {%attacker's UUID%.ac.killaura.Walls} is 8 or above:
#					clear {%attacker's UUID%.ac.killaura}
#					set {%attacker%.Killaura.Reason} to "Killaura+Walls"
#					loop all players:
#						if {%loop-player%.notify.OF} is "on":
#							if loop-player has permission "{@NotifcationPerm}":
#								send "{@KillauraDetection}" to loop-player