Files
punishments.sk
Code
1 268
punishments.sk
options:
prefix: &8[&cPunishments&8]&r
staff-permission: punishments.staff
command /punish <offlineplayer>:
permission: {@staff-permission}
permission message: &cYou do not have permission to use this command.
trigger:
delete {ps.type::%uuid of player%}
delete {ps.duration::%uuid of player%}
set {ps.target::%uuid of player%} to arg-1
set {ps.menu::%uuid of player%} to "main"
open chest inventory with 3 rows named "&8Punishment Menu" to player
set slot 10 of player's current inventory to red wool named "&cPermanent Ban"
set slot 11 of player's current inventory to orange wool named "&6Temporary Ban"
set slot 12 of player's current inventory to purple wool named "&5Permanent Mute"
set slot 13 of player's current inventory to yellow wool named "&eTemporary Mute"
set slot 14 of player's current inventory to iron sword named "&cKick"
set slot 15 of player's current inventory to paper named "&eWarning"
send "{@prefix} &7Choose a punishment for &f%name of arg-1%&7."
on inventory click:
if name of event-inventory is "&8Punishment Menu":
cancel event
if {ps.menu::%uuid of player%} is "main":
delete {ps.type::%uuid of player%}
if event-slot is 10:
set {ps.type::%uuid of player%} to "ban"
else if event-slot is 11:
set {ps.type::%uuid of player%} to "tempban"
else if event-slot is 12:
set {ps.type::%uuid of player%} to "mute"
else if event-slot is 13:
set {ps.type::%uuid of player%} to "tempmute"
else if event-slot is 14:
set {ps.type::%uuid of player%} to "kick"
else if event-slot is 15:
set {ps.type::%uuid of player%} to "warning"
if {ps.type::%uuid of player%} is not set:
stop
if {ps.type::%uuid of player%} is "tempban" or {ps.type::%uuid of player%} is "tempmute":
set {ps.menu::%uuid of player%} to "duration"
open chest inventory with 3 rows named "&8Select Duration" to player
set slot 10 of player's current inventory to paper named "&e1 hour"
set slot 11 of player's current inventory to paper named "&e6 hours"
set slot 12 of player's current inventory to paper named "&e1 day"
set slot 13 of player's current inventory to paper named "&e3 days"
set slot 14 of player's current inventory to paper named "&e7 days"
set slot 15 of player's current inventory to paper named "&e30 days"
else:
set {ps.pending.reason::%uuid of player%} to true
close player's inventory
send "{@prefix} &7Type the punishment reason in chat. Type &ccancel &7to stop."
stop
if name of event-inventory is "&8Select Duration":
cancel event
if {ps.menu::%uuid of player%} is not "duration":
stop
if event-slot is 10:
set {ps.duration::%uuid of player%} to 1 hour
else if event-slot is 11:
set {ps.duration::%uuid of player%} to 6 hours
else if event-slot is 12:
set {ps.duration::%uuid of player%} to 1 day
else if event-slot is 13:
set {ps.duration::%uuid of player%} to 3 days
else if event-slot is 14:
set {ps.duration::%uuid of player%} to 7 days
else if event-slot is 15:
set {ps.duration::%uuid of player%} to 30 days
if {ps.duration::%uuid of player%} is not set:
stop
set {ps.pending.reason::%uuid of player%} to true
close player's inventory
send "{@prefix} &7Type the punishment reason in chat. Type &ccancel &7to stop."
on inventory drag:
if name of event-inventory is "&8Punishment Menu" or name of event-inventory is "&8Select Duration":
cancel event
on chat:
if {ps.pending.reason::%uuid of player%} is set:
cancel event
if message is "cancel":
delete {ps.pending.reason::%uuid of player%}
delete {ps.type::%uuid of player%}
delete {ps.duration::%uuid of player%}
delete {ps.target::%uuid of player%}
send "{@prefix} &7Punishment cancelled."
stop
set {_reason} to message
set {_target} to {ps.target::%uuid of player%}
set {_targetUUID} to uuid of {_target}
set {_kind} to {ps.type::%uuid of player%}
if {_kind} is "ban" or {_kind} is "tempban":
if {ps.next-ban-id} is not set:
set {ps.next-ban-id} to 0
add 1 to {ps.next-ban-id}
set {_banid} to "D-%{ps.next-ban-id}%"
set {ps.ban.id::%{_targetUUID}%} to {_banid}
set {ps.ban.reason::%{_targetUUID}%} to {_reason}
if {_kind} is "tempban":
set {ps.ban.expires::%{_targetUUID}%} to now + {ps.duration::%uuid of player%}
delete {ps.ban.permanent::%{_targetUUID}%}
set {_time} to "%{ps.duration::%uuid of player%}%"
else:
delete {ps.ban.expires::%{_targetUUID}%}
set {ps.ban.permanent::%{_targetUUID}%} to true
set {_time} to "Permanent"
add "%now% | BAN | ID %{_banid}% | %{_time}% | %{_reason}%" to {ps.history::%{_targetUUID}%::*}
loop all players:
if uuid of loop-player is {_targetUUID}:
if {_kind} is "tempban":
set {_kick} to "&cYou are temporarily banned for &f%{_reason}%%nl%%nl%&fTime Left: &e%{_time}%%nl%%nl%&fBan ID: &e%{_banid}%%nl%%nl%&7You may be able to appeal this ban."
else:
set {_kick} to "&cYou are permanently banned for &f%{_reason}%%nl%%nl%&fTime Left: &ePermanent%nl%%nl%&fBan ID: &e%{_banid}%%nl%%nl%&7You may be able to appeal this ban."
kick loop-player due to {_kick}
send "{@prefix} &7Ban applied to &f%name of {_target}%&7. &8(ID: &f%{_banid}%&8)"
else if {_kind} is "mute" or {_kind} is "tempmute":
set {ps.mute.reason::%{_targetUUID}%} to {_reason}
if {_kind} is "tempmute":
set {ps.mute.expires::%{_targetUUID}%} to now + {ps.duration::%uuid of player%}
delete {ps.mute.permanent::%{_targetUUID}%}
set {_time} to "%{ps.duration::%uuid of player%}%"
else:
delete {ps.mute.expires::%{_targetUUID}%}
set {ps.mute.permanent::%{_targetUUID}%} to true
set {_time} to "Permanent"
add "%now% | MUTE | %{_time}% | %{_reason}%" to {ps.history::%{_targetUUID}%::*}
loop all players:
if uuid of loop-player is {_targetUUID}:
send "&cYou have been muted for &f%{_reason}%&c. &7Duration: &f%{_time}%" to loop-player
send "{@prefix} &7Mute applied to &f%name of {_target}%&7."
else if {_kind} is "kick":
add "%now% | KICK | %{_reason}%" to {ps.history::%{_targetUUID}%::*}
loop all players:
if uuid of loop-player is {_targetUUID}:
kick loop-player due to "&cYou have been kicked.%nl%&7Reason: &f%{_reason}%"
send "{@prefix} &7Kick applied to &f%name of {_target}%&7."
else if {_kind} is "warning":
add "%now% | WARNING | %{_reason}%" to {ps.history::%{_targetUUID}%::*}
loop all players:
if uuid of loop-player is {_targetUUID}:
send "&cYou have received a warning.%nl%&7Reason: &f%{_reason}%" to loop-player
send "{@prefix} &7Warning issued to &f%name of {_target}%&7."
delete {ps.pending.reason::%uuid of player%}
delete {ps.type::%uuid of player%}
delete {ps.duration::%uuid of player%}
delete {ps.target::%uuid of player%}
stop
if {ps.mute.permanent::%uuid of player%} is true:
cancel event
send "&cYou are muted. &7Reason: &f%{ps.mute.reason::%uuid of player%}%"
stop
if {ps.mute.expires::%uuid of player%} is set:
if {ps.mute.expires::%uuid of player%} is before now:
delete {ps.mute.expires::%uuid of player%}
delete {ps.mute.reason::%uuid of player%}
else:
cancel event
send "&cYou are muted for &f%difference between {ps.mute.expires::%uuid of player%} and now%&c. &7Reason: &f%{ps.mute.reason::%uuid of player%}%"
on join:
if {ps.ban.reason::%uuid of player%} is set:
if {ps.ban.expires::%uuid of player%} is set:
if {ps.ban.expires::%uuid of player%} is before now:
delete {ps.ban.reason::%uuid of player%}
delete {ps.ban.expires::%uuid of player%}
delete {ps.ban.id::%uuid of player%}
delete {ps.ban.permanent::%uuid of player%}
else:
set {_left} to difference between {ps.ban.expires::%uuid of player%} and now
set {_kick} to "&cYou are temporarily banned for &f%{ps.ban.reason::%uuid of player%}%%nl%%nl%&fTime Left: &e%{_left}%%nl%%nl%&fBan ID: &e%{ps.ban.id::%uuid of player%}%%nl%%nl%&7You may be able to appeal this ban."
wait 1 tick
kick player due to {_kick}
else:
set {_kick} to "&cYou are permanently banned for &f%{ps.ban.reason::%uuid of player%}%%nl%%nl%&fTime Left: &ePermanent%nl%%nl%&fBan ID: &e%{ps.ban.id::%uuid of player%}%%nl%%nl%&7You may be able to appeal this ban."
wait 1 tick
kick player due to {_kick}
every 1 minute:
loop {ps.ban.expires::*}:
if loop-value is before now:
delete {ps.ban.reason::%loop-index%}
delete {ps.ban.expires::%loop-index%}
delete {ps.ban.id::%loop-index%}
delete {ps.ban.permanent::%loop-index%}
loop {ps.mute.expires::*}:
if loop-value is before now:
delete {ps.mute.reason::%loop-index%}
delete {ps.mute.expires::%loop-index%}
delete {ps.mute.permanent::%loop-index%}
command /unban <offlineplayer>:
permission: {@staff-permission}
permission message: &cYou do not have permission to use this command.