Advertisement
chatasma

Raw Punishment System

Jan 12th, 2019
401
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.18 KB | None | 0 0
  1. options:
  2. perm: &cInsufficient permissions
  3. server: &bServer
  4.  
  5. on connect:
  6. if {tempban::%player's uuid%::ban} is true:
  7. set {_diff} to difference between now and {tempban::%player's uuid%::stamp}
  8. set {_remain} to difference between {tempban::%player's uuid%::span} and {_diff}
  9. if {_diff} < {tempban::%player's uuid%::span}:
  10. kick the player due to "%{tempban::%player's uuid%::msg}% &8| &7Punishment expires in %{_remain}%"
  11. else:
  12. set {tempban::%player's uuid%::ban} to false
  13. set {tempban::%player's uuid%::msg} to ""
  14. set {tempban::%player's uuid%::span} to 0 seconds
  15. set {tempban::%player's uuid%::stamp} to 0 seconds
  16.  
  17. on chat:
  18. if {mute::%player's uuid%::mute} is true:
  19. if {mute::%player's uuid%::span} is greater than 0 seconds:
  20. set {_diff} to difference between now and {mute::%player's uuid%::stamp}
  21. if {_diff} >= {mute::%player's uuid%::span}:
  22. set {mute::%player's uuid%::span} to 0 seconds
  23. set {mute::%player's uuid%::mute} to false
  24. set {mute::%player's uuid%::stamp} to 0 seconds
  25. else:
  26. set {_attach} to ""
  27. if {mute::%player's uuid%::msg} is not false:
  28. set {_attach} to " &7for &e%{mute::%player's uuid%::msg}%"
  29. set {_wait} to difference between {mute::%player's uuid%::span} and {_diff}
  30. send ""
  31. send "&7You are &cmuted%{_attach}%"
  32. send "&7You may speak in &e%{_wait}%"
  33. send ""
  34. cancel event
  35. stop
  36. else:
  37. if {mute::%player's uuid%::msg} is false:
  38. send "&7You are &cmuted! &7You cannot speak."
  39. cancel event
  40. else:
  41. send "&7You are &cmuted &7for &e%{mute::%player's uuid%::msg}%"
  42. cancel event
  43. stop
  44.  
  45.  
  46. command /warn [<offline player>] [<text>]:
  47. permission: staff.warn
  48. trigger:
  49. if arg-1 is not set:
  50. set {_dab} to true
  51. if arg-2 is not set:
  52. set {_dab} to true
  53. if {_dab} is true:
  54. send "&c/warn (player) (reason)"
  55. stop
  56. if arg-1 is online:
  57. broadcast "&b%player% &7warned &b%arg-1% &7for %colored arg-2%"
  58. else:
  59. send "&cPlayer is offline."
  60.  
  61. command /revertwarn [<offline player>]:
  62. permission: staff.warn
  63. trigger:
  64. if arg-1 is not set:
  65. set {_dab} to true
  66. if {_dab} is true:
  67. send "&c/revertwarn (player)"
  68. stop
  69. if arg-1 is online:
  70. broadcast "&b%player% &7reverted the warn for &b%arg-1%"
  71. else:
  72. send "&cPlayer is offline."
  73.  
  74. command /cc:
  75. permission: staff.cc
  76. trigger:
  77. loop 250 times:
  78. broadcast " "
  79. broadcast "&8[&aServer&8] &eChat cleared by &6%player%"
  80.  
  81. command /kick [<offline player>] [<text>]:
  82. permission message: {@perm}
  83. permission: staff.kick
  84. trigger:
  85. if arg-1 is not set:
  86. send "&c/kick <player> [reason]"
  87. stop
  88. if arg-1 is online:
  89. if arg-2 is set:
  90. kick arg-1 because colored arg-2
  91. broadcast "&b%player% &7kicked &b%arg-1% &7for %colored arg-2%"
  92. else:
  93. kick arg-1
  94. broadcast "&b%player% &7kicked &b%arg-1%"
  95. else:
  96. send "&cPlayer is offline."
  97.  
  98. command /ban [<offline player>] [<text>]:
  99. permission: staff.ban
  100. permission message: {@perm}
  101. trigger:
  102. set {_failure} to false
  103. if arg-1 is not set:
  104. set {_failure} to true
  105. if arg-2 is not set:
  106. set {_failure} to true
  107. if {_failure} is true:
  108. send "&c/ban <player> <timespan> [reason]"
  109. stop
  110. set {_lmao::*} to split arg-2 using the delimiter " "
  111. set {_span} to {_lmao::1}
  112. set {_len} to length of {_span}
  113. set {_lenwhole} to length of arg-2
  114. set {_lendiff} to {_lenwhole} - {_len}
  115. if size of {_lmao::*} is 1:
  116. set {_reason} to "&cBanned by an operator."
  117. else:
  118. set {_reason} to last ({_lendiff} - 1) characters of arg-2
  119. if {_span} is "forever":
  120. set {tempban::%arg-1's uuid%::ban} to false
  121. set {tempban::%arg-1's uuid%::span} to 0 seconds
  122. set {tempban::%arg-1's uuid%::stamp} to 0 seconds
  123. ban arg-1 because "&c&lPerm Ban &8|&r &a{@server} &8- &7%colored {_reason}%"
  124. kick arg 1 due to "&c&lPerm Ban &8|&r &a{@server} &8- &7%colored {_reason}%"
  125. broadcast "&b%player% &7banned &b%arg-1% &7for &c%{_reason}% &7[FOREVER]"
  126. else:
  127. set {_tryParse::*} to timeParser({_span})
  128. set {_res} to {_tryParse::1}
  129. if {_res} is "error":
  130. send "&cInvalid timespan!"
  131. send "&6Example: &e2y3mo1w4d5h2m29s"
  132. else:
  133. set {_timespan} to "%{_res}% seconds" parsed as timespan
  134. unban arg-1
  135. set {tempban::%arg-1's uuid%::ban} to true
  136. set {tempban::%arg-1's uuid%::span} to {_timespan}
  137. set {tempban::%arg-1's uuid%::stamp} to now
  138. set {tempban::%arg-1's uuid%::msg} to "&c&lTempban&r &8| &a{@server} &8- &7%colored {_reason}%"
  139. kick arg 1 due to "&c&lTempban&r &8| &a{@server}&r &8- &7%colored {_reason}% &8| &7Expires in &e%{_timespan}%"
  140. broadcast "&b%player% &7banned &b%arg-1% &7for &c%{_reason}% &7[&e%{_timespan}%&7]"
  141.  
  142.  
  143. command /mute [<offline player>] [<text>]:
  144. permission: staff.mute
  145. permission message: {@perm}
  146. trigger:
  147. if arg-1 is set:
  148. if arg-1 is online:
  149. set {_minspan} to 1 second
  150. set {_zerospan} to 0 seconds
  151. set {_uuid} to uuid of arg-1
  152. if arg-2 is set:
  153. set {_lmao::*} to split arg-2 using the delimiter " "
  154. set {_span} to {_lmao::1}
  155. set {_len} to length of {_span}
  156. set {_lenwhole} to length of arg-2
  157. set {_lendiff} to {_lenwhole} - {_len}
  158. if size of {_lmao::*} > 1:
  159. set {_reason} to last ({_lendiff} - 1) characters of arg-2
  160. set {_decolor} to {_reason}
  161. set {_reason} to colored {_reason}
  162. else:
  163. set {_span} to "forever"
  164. if {_span} is not "forever":
  165. set {_tryParse::*} to timeParser({_span})
  166. set {_res} to {_tryParse::1}
  167. if {_res} is "error":
  168. send "&cInvalid timespan!"
  169. send "&6Example: &e2y3mo1w4d5h2m29s"
  170. stop
  171. set {_span} to {_res}
  172. set {_span} to "%{_span}% seconds" parsed as timespan
  173. if {_span} >= {_minspan}:
  174. set {mute::%{_uuid}%::span} to {_span}
  175. set {mute::%{_uuid}%::mute} to true
  176. set {mute::%{_uuid}%::stamp} to now
  177. if {_reason} is set:
  178. set {mute::%{_uuid}%::msg} to {_reason}
  179. send "&7You have been &cmuted &7for &e%{_reason}% &7[&e%{_span}%&7]" to arg-1
  180. broadcast "&b%player% &7muted &b%arg-1% &7for &c%{_reason}% &7[&e%{_span}%&7]"
  181. else:
  182. set {mute::%{_uuid}%::msg} to false
  183. send "&7You have been &cmuted. &7[&e%{_span}%&7]" to arg-1
  184. broadcast "&b%player% &7muted &b%arg-1% &7[&e%{_span}%&7]"
  185. else:
  186. if {_span} = {_zerospan}:
  187. make player execute "/unmute %arg-1%"
  188. else:
  189. send "&cYour mute span should be at least 1 second."
  190. else:
  191. if {_reason} is set:
  192. if {mute::%{_uuid}%::mute} is not set:
  193. set {mute::%{_uuid}%::mute} to false
  194. send "&7Muted &e%arg-1% &7for &e%{_decolor}% &7[FOREVER]"
  195. set {mute::%{_uuid}%::span} to {_zerospan}
  196. set {mute::%{_uuid}%::mute} to true
  197. set {mute::%{_uuid}%::stamp} to now
  198. set {mute::%{_uuid}%::msg} to {_reason}
  199. broadcast "&b%player% &7muted &b%arg-1% &7for &e%{_reason}% &7[&7FOREVER&7]"
  200. send "&7You have been &cmuted &7for &e%{_reason}%" to arg-1
  201. else:
  202. if {mute::%{_uuid}%::mute} is not set:
  203. set {mute::%{_uuid}%::mute} to false
  204. if {mute::%{_uuid}%::mute} is false:
  205. send "&7Muted &e%arg-1% &7forever."
  206. set {mute::%{_uuid}%::span} to {_zerospan}
  207. set {mute::%{_uuid}%::mute} to true
  208. set {mute::%{_uuid}%::stamp} to now
  209. set {mute::%{_uuid}%::msg} to false
  210. broadcast "&b%player% &7muted &b%arg-1% &7[&7FOREVER&7]"
  211. send "&7You have been &cmuted." to arg-1
  212. else:
  213. make player execute "/unmute %arg-1%"
  214. else:
  215. send "&cPlayer is not online."
  216. else:
  217. send "&c/mute (player) [timespan] [reason]"
  218.  
  219. command /unmute [<offline player>]:
  220. permission: staff.unmute
  221. permission message: {@perm}
  222. trigger:
  223. if arg-1 is set:
  224. if arg-1 is online:
  225. set {_uuid} to uuid of arg-1
  226. if {mute::%{_uuid}%::mute} is not set:
  227. set {mute::%{_uuid}%::mute} to false
  228. if {mute::%{_uuid}%::mute} is false:
  229. send "&e%arg-1% &7is not &6muted."
  230. stop
  231. set {mute::%{_uuid}%::mute} to false
  232. set {mute::%{_uuid}%::span} to 0 seconds
  233. send "&7Unmuted &e%arg-1%."
  234. broadcast "&b%player% &7unmuted &b%arg-1%"
  235. else:
  236. send "&cPlayer is not online."
  237. else:
  238. send "&c/unmute (player)"
  239.  
  240. command /unban [<offline player>]:
  241. permission: staff.unban
  242. permission message: {@perm}
  243. trigger:
  244. set {_failure} to false
  245. if arg-1 is not set:
  246. message "&c/unban <player>"
  247. stop
  248. unban arg-1
  249. set {tempban::%arg-1's uuid%::ban} to false
  250. set {tempban::%arg-1's uuid%::span} to 0 seconds
  251. set {tempban::%arg-1's uuid%::stamp} to 0 seconds
  252. broadcast "&b%player% &cunbanned &b%arg-1%"
  253.  
  254.  
  255.  
  256. # Punish
  257.  
  258. function timeParser(p: text) :: objects:
  259. set {_invalid} to false
  260. add "y" to {_validdate::*}
  261. add "mo" to {_validdate::*}
  262. add "w" to {_validdate::*}
  263. add "d" to {_validdate::*}
  264. add "h" to {_validdate::*}
  265. add "s" to {_validdate::*}
  266. add "m" to {_validdate::*}
  267.  
  268. set {_secres} to 0
  269. set {_help} to 0
  270. set {_terminate} to length of {_p}
  271. set {_totalnum} to 0
  272. set {_numlock} to 0
  273. while {_help} < {_terminate}:
  274. set {_char} to the first character of {_p}
  275. set {_yeet} to false
  276. if {_char} is "0":
  277. set {_yeet} to true
  278. if {_char} is "1":
  279. set {_yeet} to true
  280. if {_char} is "2":
  281. set {_yeet} to true
  282. if {_char} is "3":
  283. set {_yeet} to true
  284. if {_char} is "4":
  285. set {_yeet} to true
  286. if {_char} is "5":
  287. set {_yeet} to true
  288. if {_char} is "6":
  289. set {_yeet} to true
  290. if {_char} is "7":
  291. set {_yeet} to true
  292. if {_char} is "8":
  293. set {_yeet} to true
  294. if {_char} is "9":
  295. set {_yeet} to true
  296. if {_yeet} is true:
  297. if {_numlock} is 2:
  298. if {_validdate::*} does not contain {_ahh}:
  299. set {_invalid} to true
  300. else:
  301. set {_tempres} to parseShortTime({_totalnum}, {_ahh})
  302. add {_tempres} to {_secres}
  303. set {_ahh} to ""
  304. set {_totalnum} to 0
  305. set {_numlock} to 1
  306. set {_what} to {_char} parsed as number
  307. set {_totalnum} to {_totalnum} * 10
  308. add {_what} to {_totalnum}
  309. else:
  310. set {_ahh} to join {_ahh} and {_char}
  311. if {_numlock} is 1:
  312. set {_numlock} to 2
  313. set {_p} to last (length of {_p} - 1) characters of {_p}
  314. add 1 to {_help}
  315. if {_validdate::*} does not contain {_ahh}:
  316. set {_invalid} to true
  317. else:
  318. set {_tempres} to parseShortTime({_totalnum}, {_ahh})
  319. add {_tempres} to {_secres}
  320. if {_invalid} is true:
  321. add "error" to {_package::*}
  322. return {_package::*}
  323. else:
  324. # broadcast "%{_secres}% seconds."
  325. # set {_timespan} to "%{_secres}% seconds" parsed as timespan
  326. # broadcast "%{_timespan}%"
  327. add {_secres} to {_package::*}
  328. return {_package::*}
  329.  
  330. function parseShortTime(n: number, s: text) :: number:
  331. add "y" to {_validdate::*}
  332. add "mo" to {_validdate::*}
  333. add "w" to {_validdate::*}
  334. add "d" to {_validdate::*}
  335. add "h" to {_validdate::*}
  336. add "s" to {_validdate::*}
  337. add "m" to {_validdate::*}
  338.  
  339. set {_zero} to 0
  340. if {_validdate::*} does not contain {_s}:
  341. return {_zero}
  342. if {_s} is "m":
  343. set {_n} to {_n} * 60
  344. if {_s} is "h":
  345. set {_n} to {_n} * 3600
  346. if {_s} is "d":
  347. set {_n} to {_n} * 86400
  348. if {_s} is "w":
  349. set {_n} to {_n} * 604800
  350. if {_s} is "mo":
  351. set {_n} to {_n} * 2592000
  352. if {_s} is "y":
  353. set {_n} to {_n} * 31557600
  354. return {_n}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement