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.
#anticrash - Apahllo#8262
#must have skellet (for packets), skquery (for auto-update), and wildskript (for logging who tried to crash)
#stops players from crashing your server
#bans are automatically enabled, to disable them, do /anticrash bans off (or "on" to turn them on).
on script load:
if text from "https://pastebin.com/raw/DYBAse8F" is not "1.1":
set {_contents} to text from "https://pastebin.com/raw/DYBAse8F"
send "[WARNING]" to console
send "[WARNING]" to console
send "[WARNING] This version of Anticrash is outdated! A new version has been released! (%{_contents}%)" to console
send "[WARNING]" to console
send "[WARNING]" to console
loop all players:
if loop-player is op:
wait 1 second
send "&7Your version of &cAnticrash &7is outdated! &4%{_contents}% &7has been released. Download it to be up to date with all crash fixes." to loop-player
else:
loop all players:
if loop-player is op:
wait 1 second
send "&7Your version of &cAnticrash &7is up to date!" to loop-player
if file "plugins/Anticrash/crashes" doesn't exists:
create file "plugins/Anticrash/crashes"
if {ban} is not set:
set {ban} to true
function punish(p: player, t: text):
if {ban} = true:
wf "[%now%] %{_p}% was banned for %{_t}%." to "plugins/Anticrash/crashes"
wait 2 ticks
broadcast ""
broadcast "&c%{_p}% &7has been banned for attempting to crash the server."
broadcast ""
wait 2 ticks
command "/ban %{_p}% %{_t}% -s"
strike lightning at {_p} #need skript 2.2-dev36 for this, if you are unable to switch to this version (if you are under this version and others scripts cannot be switched), just remove this whole line. you really don't need it.
if {ban} = false:
kick {_p} due to "&cPlease relog."
wf "[%now%] %{_p}% would have been banned for %{_t}% but bans were disabled." to "plugins/Anticrash/crashes"
loop all players:
if loop-player has permission "anticrash.alert":
send "&c%{_p}% &7would have been banned for &4%{_t}% &7but bans are disabled." to loop-player
if {crashlist::*} contains "&c%{_p}%&f":
stop
else:
add "&c%{_p}%&f" to {crashlist::*}
command /anticrash [<text>] [<text>] [<offline player>]:
permission: anticrash.cmd
permission message: &cYou are lacking permissions.
aliases: /ac
trigger:
if arg 1 is set:
if arg 1 is "bans":
if arg 2 is set:
if arg 2 is "on" or "enable":
if {ban} = true:
send "&aBans &7are already enabled." to player
stop
if {ban} = false:
set {ban} to true
send "&aBans have been enabled." to player
stop
if arg 2 is "off" or "disable":
if {ban} = false:
send "&cBans &7are already disabled." to player
stop
if {ban} = true:
set {ban} to false
send "&cBans have been disabled." to player
stop
if arg 2 is not "on" or "off" or "enable" or "disable":
send "&cIncorrent syntax. Try /anticrash bans <on/off>." to player
if arg 2 is not set:
if {ban} = true:
send "&cUsage: &7/anticrash bans <on/off> (Bans are currently enabled)." to player
stop
if {ban} = false:
send "&cUsage: &7/anticrash bans <on/off> (Bans are currently disabled)." to player
stop
if arg 1 is "list":
if arg 2 is set:
if arg 2 is "clear":
if {crashlist::*} is not set:
send "&cThere is no one in the crash list." to player
stop
delete {crashlist::*}
send "&7List has been cleared." to player
if arg 2 is "remove":
if arg 3 is set:
if {crashlist::*} contains "&c%arg 3%&f":
remove "&c%arg 3%&f" from {crashlist::*}
send "&c%arg 3% &7has been removed from the list." to player
stop
else:
send "&c%arg 3% &7is not in the list." to player
stop
if arg 2 is not "clear" or "remove":
send "&cIncorrect syntax. Try /anticrash list <clear/remove> <player>."
if arg 2 is not set:
if arg 3 is not set:
if {crashlist::*} is not set:
send "&cThere is no one in the crash list." to player
stop
send "&7Players who have attempted to crash the server:" to player
send ""
send "%{crashlist::*}%"
if arg 1 is not "bans" or "list":
send "&4Anticrash &7commands:" to player
send "" to player
send " &7/anticrash bans <on/off>." to player
send " &7/anticrash list <clear/remove> <player>" to player
send "" to player
if arg 1 is not set:
send "&4Anticrash &7commands:" to player
send "" to player
send " &7/anticrash bans <on/off>." to player
send " &7/anticrash list <clear/remove> <player>" to player
send "" to player
#NOTHING DOWN HERE SHOULD BE TOUCHED (unless you're skidding lmaooo)
on packet:
add 1 to {packets::%player%}
if {packets::%player%} >= 1000:
kick player due to "Too many packets." #this is just incase your spigot doesn't auto kick for high amounts of packets being sent to the server
if event-string is "PacketPlayInCustomPayload":
set {_packet} to packet field "a"
if "%{_packet}%" = "MC|BSign" or "MC|BEdit":
cancel event
add 1 to {crash::%player%}
if {crash::%player%} = 15:
punish(player, "Anticrash (BookFlood)")
on leftclick on air:
add 1 to {clickcount::%player%}
if {clickcount::%player%} > 700:
punish(player, "Anticrash (Too Many ArmSwings %{clickcount::%player%}%)")
on command "suicide":
add 1 to {suicidecmd::%player%}
if {suicidecmd::%player%} > 4:
punish(player, "Anticrash (/suicide exploit)")
on command:
if complete command contains "for(i=0;i<256;i++)":
cancel event
send "&cYou may not use that use that algorithm in a command." to player
every second:
delete {clickcount::*}
delete {suicidecmd::*}
delete {crash::*}
delete {packets::*}