noftaly

Untitled

Sep 21st, 2018
268
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.99 KB | None | 0 0
  1. options:
  2. prefix: &e&l[&6&l&oServeur&r&e&l]&r &e&l➤&r
  3. prefixwo: &e&l[&6&l&oServeur&r&e&l]&r
  4. error: &c&lErreur:&r
  5. noperm: &cVous n'avez pas la permission de faire cela !
  6.  
  7. function JsonMessage(player: text, msg: text, tooltip: text, function: text, result: text):
  8. execute console command "/tellraw %{_player}% {""text"":""%{_msg}%"",""clickEvent"":{""action"":""%{_function}%"",""value"":""%{_result}%""},""hoverEvent"":{""action"":""show_text"",""value"":""%{_tooltip}%""}}"
  9. # Exemple : JsonMessage("%joueur%", "message", "infobulle", "type (=run_command; suggest_command...)", "command")
  10.  
  11. # =====> Verifier si le temps est bien écris
  12. function CheckTime(time: text) :: boolean:
  13. if length of {_time} is 2:
  14. set {_check::*} to groups 0 of "%{_time}%" matched to "^[0-9](s|S|m|M|h|H|d|D)$"
  15. else if length of {_time} is 3:
  16. set {_check::*} to groups 0 of "%{_time}%" matched to "^[0-9]{2}(s|S|m|M|h|H|d|D)$"
  17. if {_check::*} is set:
  18. return true
  19. else:
  20. return false
  21.  
  22. # =====> Retourner le temps en TimeSpan
  23. function TransformTime(time: text) :: timespan:
  24. if length of {_time} is 2:
  25. set {_time} to "0%{_time}%"
  26. set {_characters::*} to {_time} split at ""
  27. if {_characters::3} is "s":
  28. set {_characters::3} to " seconds"
  29. else if {_characters::3} is "m":
  30. set {_characters::3} to " minutes"
  31. else if {_characters::3} is "h":
  32. set {_characters::3} to " hours"
  33. else if {_characters::3} is "d":
  34. set {_characters::3} to " days"
  35. set {_result} to "%{_characters::1}%%{_characters::2}%%{_characters::3}%" parsed as timespan
  36. return {_result}
  37.  
  38. # =====> Retourner le temps en temps normal
  39. function SanctionTime(time: timespan) :: text:
  40. set {_time} to "%{_time}%"
  41. set {_words::*} to {_time} split at " "
  42. if {_words::2} is "second" or "seconds":
  43. set {_words::2} to "seconde(s)"
  44. else if {_words::2} is "minute" or "minutes":
  45. set {_words::2} to "minute(s)"
  46. else if {_words::2} is "hour" or "hours":
  47. set {_words::2} to "heure(s)"
  48. else if {_words::2} is "day" or "days":
  49. set {_words::2} to "jour(s)"
  50. set {_result} to "%{_words::1}% %{_words::2}%"
  51. return {_result}
  52.  
  53. # =====> Retourner le temps restant d'une sanction
  54. function TimeLeft(difference: timespan, cooldown: timespan) :: text:
  55. subtract {_difference} from {_cooldown}
  56. set {_cooldown} to "%{_cooldown}%"
  57. replace "second" with "seconde" in {_cooldown}
  58. replace "minute" with "minute" in {_cooldown}
  59. replace "hour" with "heure" in {_cooldown}
  60. replace "day" with "jour" in {_cooldown}
  61. replace "and" with "et" in {_cooldown}
  62. set {_words::*} to {_cooldown} split at " "
  63. if {_words::5} is set:
  64. set {_words::1} to rounded down ("%{_words::1}%" parsed as number)
  65. set {_words::4} to rounded down ("%{_words::4}%" parsed as number)
  66. set {_result} to "%{_words::1}% %{_words::2}% %{_words::3}% %{_words::4}% %{_words::5}%"
  67. else:
  68. set {_words::1} to rounded down ("%{_words::1}%" parsed as number)
  69. set {_result} to "%{_words::1}% %{_words::2}%"
  70. return {_result}
  71.  
  72.  
  73. command /ban [<offline player>] [<text>]:
  74. aliases: permban
  75. trigger:
  76. if player has permission "mod.ban":
  77. if arg-1 is set:
  78. if {mod::ban::%arg-1%::isBan} is true:
  79. message "{@prefix} {@error} &c%arg-1% &cest déjà banni !"
  80. else:
  81. if arg-1 has permission "mod.banExempt":
  82. message "{@prefix} {@error} &cVous ne pouvez pas bannir %arg-1%"
  83. else:
  84. if arg-2 is set:
  85. set {mod::ban::%arg-1%::reason} to arg-2
  86. else:
  87. set {mod::ban::%arg-1%::reason} to "Vous avez été banni !"
  88. set {mod::ban::%arg-1%::isBan} to true
  89. set {mod::ban::%arg-1%::time} to "Jamais"
  90. set {mod::ban::%arg-1%::start} to now
  91. set {mod::ban::%arg-1%::executor} to "%player%"
  92. add arg 1 to {ban::playerList::*}
  93. kick arg-1 due to "{@prefixwo}%nl%&b%nl%&cVous avez été banni !%nl%&b%nl%&cBanni par: &6%{mod::ban::%arg-1%::executor}%%nl%&cRaison: &6%{mod::ban::%arg-1%::reason}%%nl%&cDurée: &6Permanant"
  94. broadcast "{@prefix} &c%arg-1% &7à été bannis par &c%player% &7pour &c%{mod::ban::%arg-1%::reason}% &7pendant : &cPermanant"
  95. else:
  96. message "{@prefix} {@error} &cUsage : /ban <joueur> <raison>"
  97. else:
  98. message "{@prefix} {@error} {@noperm}"
  99.  
  100. command /tempban [<offline player>] [<text>] [<text>]:
  101. trigger:
  102. if player has permission "mod.tempban":
  103. if arg-1 is set:
  104. if {mod::ban::%arg-1%::isBan} is true:
  105. message "{@prefix} {@error} &c%arg-1% &cest déjà banni !"
  106. else:
  107. if arg-1 has permission "mod.tempbanExempt":
  108. message "{@prefix} {@error} &cVous ne pouvez pas bannir %arg-1%"
  109. else:
  110. if CheckTime(arg 2) is false:
  111. send "{@prefix} {@error} &cLa durée n'a pas été écrite correctement ! &7&oEx pour 1 jour: 1d"
  112. else:
  113. if arg-3 is set:
  114. set {mod::ban::%arg-1%::reason} to arg-3
  115. else:
  116. set {mod::ban::%arg-1%::reason} to "Vous avez été banni temporairement!"
  117. set {mod::ban::%arg-1%::isBan} to true
  118. set {mod::ban::%arg-1%::time} to TransformTime(arg 2)
  119. set {mod::ban::%arg-1%::start} to now
  120. set {mod::ban::%arg-1%::executor} to "%player%"
  121. add arg 1 to {ban::playerList::*}
  122. set {_time} to SanctionTime({mod::ban::%arg-1%::time})
  123. kick arg-1 due to "{@prefixwo}%nl%&b%nl%&cVous avez été banni !%nl%&b%nl%&cBanni par: &6%{mod::ban::%arg-1%::executor}%%nl%&cRaison: &6%{mod::ban::%arg-1%::reason}%%nl%&cDurée: &6%{_time}%"
  124. broadcast "{@prefix} &c%arg-1% &7à été bannis par &c%player% &7pour &c%{mod::ban::%arg-1%::reason}% &7pendant : &c%{_time}%"
  125. else:
  126. message "{@prefix} {@error} &cUsage : /tempban <joueur> <temps> <raison>"
  127. else:
  128. message "{@prefix} {@error} {@noperm}"
  129.  
  130. command /unban [<offline player>]:
  131. trigger:
  132. if player has permission "mod.unban":
  133. if arg-1 is set:
  134. if {mod::ban::%arg-1%::isBan} is not true:
  135. message "{@prefix} {@error} &c%arg-1% &cn'est pas banni !"
  136. else:
  137. clear {mod::ban::%arg-1%::*}
  138. clear {mod::ban::%arg-1%}
  139. remove arg-1 from {ban::playerList::*}
  140. broadcast "{@prefix} &c%arg-1% &7à été unban par &c%player%&7."
  141. else:
  142. message "{@prefix} {@error} &cUsage : /unban <joueur>"
  143. else:
  144. message "{@prefix} {@error} {@noperm}"
  145.  
  146.  
  147. on connect:
  148. if {mod::ban::%player%::isBan} is true:
  149. if {mod::ban::%player%::time} is "Jamais":
  150. kick player due to "{@prefixwo}%nl%&b%nl%&cVous avez été banni !%nl%&b%nl%&cBanni par: &6%{mod::ban::%player%::executor}%%nl%&cRaison: &6%{mod::ban::%player%::reason}%%nl%&cDurée: &6Permanant"
  151. else:
  152. if difference between {mod::ban::%player%::start} and now is less than {mod::ban::%player%::time}:
  153. wait a tick
  154. set {_timeleft} to TimeLeft(difference between {mod::ban::%player%::start} and now, {mod::ban::%player%::time})
  155. kick player due to "{@prefixwo}%nl%&b%nl%&cVous avez été banni !%nl%&b%nl%&cBanni par: &6%{mod::ban::%player%::executor}%%nl%&cRaison: &6%{mod::ban::%player%::reason}%%nl%&cTemps restant : %{_timeleft}%"
  156. else:
  157. clear {mod::ban::%player%}
  158. remove player from {ban::playerList::*}
Advertisement
Add Comment
Please, Sign In to add comment