akon1248

Mute

Feb 16th, 2019
662
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.13 KB | None | 0 0
  1. function getPeriodFromSeconds(arg: integer) :: string:
  2. set {_days} to floor({_arg}/86400)
  3. set {_seconds} to {_arg}-86400*{_days}
  4. set {_hours} to floor({_seconds}/3600)
  5. set {_seconds} to {_seconds}-3600*{_hours}
  6. set {_minutes} to floor({_seconds}/60)
  7. set {_seconds} to {_seconds}-60*{_minutes}
  8. set {_timetext} to "%{_days}%日 %{_hours}%時間 %{_minutes}%分 %{_seconds}%秒"
  9. return {_timetext}
  10. command /mute [<offline player>] [<text>] [<text>] [<text>] [<text>] [<text>]:
  11. permission: sk.command.mute
  12. permission message: &4このコマンドを実行する権限がありません!
  13. trigger:
  14. if arg-1 is not set:
  15. send "&cUsage: /mute <player> never OR /mute <player> temply <days> <hours> <minutes> <seconds>"
  16. else if arg-1 has not played before:
  17. send "&cプレイヤー%arg-1%はログインしたことがありません!"
  18. else if {mute::%UUID of arg-1%} is 1:
  19. send "&c%arg-1%は既にミュートされています!"
  20. else if arg-2 is not set:
  21. send "&cUsage: /mute <player> never OR /mute <player> temply <days> <hours> <minutes> <seconds>"
  22. else if arg-2 is not "never" or "temply":
  23. send "&cUsage: /mute <player> never OR /mute <player> temply <days> <hours> <minutes> <seconds>"
  24. else if arg-2 is "never":
  25. set {mute::%UUID of arg-1%} to 1
  26. set {mutedplayername.%UUID of arg-1%} to "%arg-1%"
  27. broadcast "&6%player%&eが&6%arg-1%&eをミュートしました%nl%&e期限: &7無期限"
  28. else if arg-2 is "temply":
  29. if arg-3 is not set:
  30. send "&cUsage: /mute <player> temply <days> <hours> <minutes> <seconds>"
  31. else if arg-4 is not set:
  32. send "&cUsage: /mute <player> temply <days> <hours> <minutes> <seconds>"
  33. else if arg-5 is not set:
  34. send "&cUsage: /mute <player> temply <days> <hours> <minutes> <seconds>"
  35. else if arg-6 is not set:
  36. send "&cUsage: /mute <player> temply <days> <hours> <minutes> <seconds>"
  37. else:
  38. set {_days} to arg-3 parsed as integer
  39. set {_hours} to arg-4 parsed as integer
  40. set {_minutes} to arg-5 parsed as integer
  41. set {_seconds} to arg-6 parsed as integer
  42. set {_total} to {_days}*86400+{_hours}*3600+{_minutes}*60+{_seconds}
  43. if {_days} is not set:
  44. send "&cUsage: /mute <player> temply <days> <hours> <minutes> <seconds>"
  45. else if {_hours} is not set:
  46. send "&cUsage: /mute <player> temply <days> <hours> <minutes> <seconds>"
  47. else if {_minutes} is not set:
  48. send "&cUsage: /mute <player> temply <days> <hours> <minutes> <seconds>"
  49. else if {_seconds} is not set:
  50. send "&cUsage: /mute <player> temply <days> <hours> <minutes> <seconds>"
  51. else if {_days} > 9999:
  52. send "&c入力した数値(%arg-3%)は大きすぎます! 9999以下にしてください"
  53. else if {_hours} > 23:
  54. send "&c入力した数値(%arg-4%)は大きすぎます! 23以下にしてください"
  55. else if {_minutes} > 59:
  56. send "&c入力した数値(%arg-5%)は大きすぎます! 59以下にしてください"
  57. else if {_seconds} > 59:
  58. send "&c入力した数値(%arg-6%)は大きすぎます! 59以下にしてください"
  59. else if {_days} < 0:
  60. send "&c入力した数値(%arg-3%)は小さすぎます! 0以上にしてください"
  61. else if {_hours} < 0:
  62. send "&c入力した数値(%arg-4%)は小さすぎます! 0以上にしてください"
  63. else if {_minutes} < 0:
  64. send "&c入力した数値(%arg-5%)は小さすぎます! 0以上にしてください"
  65. else if {_total} is 0:
  66. send "&c入力した数値(%arg-6%)は小さすぎます! 1以上にしてください"
  67. else if {_total} > 0:
  68. {_seconds} < 0
  69. send "&c入力した数値(%arg-6%)は小さすぎます! 0以上にしてください"
  70. set {mute::%UUID of arg-1%} to 1
  71. set {mutedplayername.%UUID of arg-1%} to "%arg-1%"
  72. set {unmutetime.%UUID of arg-1%} to floor(unix timestamp of now)+{_days}*86400+{_hours}*3600+{_minutes}*60+{_seconds}
  73. set {_muteperiod} to "%{unmutetime.%UUID of arg-1%}-floor(unix timestamp of now)%" parsed as integer
  74. broadcast "&6%player%&eが&6%arg-1%&eをミュートしました%nl%&e期限: &7%getPeriodFromSeconds({_muteperiod})%"
  75. command /unmute [<offline player>] [<text>]:
  76. permission: sk.command.mute
  77. permission message: &4このコマンドを実行する権限がありません!
  78. trigger:
  79. if arg-2 is set:
  80. send "&cUsage: /unmute <player>"
  81. else if arg-1 is not set:
  82. send "&cUsage: /unmute <player>"
  83. else if arg-1 is set:
  84. if {mute::%UUID of arg-1%} is not set:
  85. send "&c%arg-1%はミュートされていません!"
  86. else if {mute::%UUID of arg-1%} is 1:
  87. delete {mute::%UUID of arg-1%}
  88. delete {unmutetime.%UUID of arg-1%}
  89. delete {mutedplayername.%UUID of arg-1%}
  90. send "&6%arg-1%&eのミュートを解除しました"
  91. command /mutelist:
  92. permission: sk.command.mute
  93. permission message: &4このコマンドを実行する権限がありません!
  94. trigger:
  95. if {mute::*} is not set:
  96. send "&cミュートされているプレイヤーはいません"
  97. else if {mute::*} is set:
  98. loop {mute::*}:
  99. if {unmutetime.%loop-index%} is set:
  100. set {_muteperiod} to "%{unmutetime.%loop-index%}-floor(unix timestamp of now)%" parsed as integer
  101. send "&eプレイヤー: &7%{mutedplayername.%loop-index%}% &eUUID: &7%loop-index% &e期限: &7%getPeriodFromSeconds({_muteperiod})%"
  102. else if {unmutetime.%loop-index%} is not set:
  103. send "&eプレイヤー: &7%{mutedplayername.%loop-index%}% &eUUID: &7%loop-index% &e期限: &7無期限"
  104. on command:
  105. {mute::%UUID of player%} is 1
  106. command is "say" or "me" or "m" or "message" or "msg" or "r" or "reply" or "t" or "tell" or "w" or "lunachat:m" or "lunachat:message" or "lunachat:msg" or "lunachat:r" or "lunachat:reply" or "lunachat:t" or "lunachat:tell" or "lunachat:w" or "minecraft:msg" or "minecraft:tell" or "minecraft:w"
  107. cancel event
  108. if {unmutetime.%UUID of player%} is set:
  109. set {_muteperiod} to "%{unmutetime.%UUID of player%}-floor(unix timestamp of now)%" parsed as integer
  110. send "&cあなたはミュートされています!%nl%&c期限: &7%getPeriodFromSeconds({_muteperiod})%"
  111. else if {unmutetime.%UUID of player%} is not set:
  112. send "&cあなたはミュートされています!%nl%&c期限: &7無期限"
  113. on packet recieve:
  114. event-string is "PacketPlayInChat"
  115. set {_msg} to packet field "a"
  116. first 1 characters of {_msg} is not "/"
  117. {mute::%UUID of player%} is 1
  118. cancel event
  119. if {unmutetime.%UUID of player%} is set:
  120. set {_muteperiod} to "%{unmutetime.%UUID of player%}-floor(unix timestamp of now)%" parsed as integer
  121. send "&cあなたはミュートされています!%nl%&c期限: &7%getPeriodFromSeconds({_muteperiod})%"
  122. else if {unmutetime.%UUID of player%} is not set:
  123. send "&cあなたはミュートされています!%nl%&c期限: &7無期限"
  124. every second:
  125. loop {mute::*}:
  126. {unmutetime.%loop-index%} <= floor(unix timestamp of now)
  127. send "&eあなたのミュートが解除されました" to {mutedplayername.%loop-index%} parsed as player
  128. if {mutedplayername.%loop-index%} parsed as offline player is not online:
  129. set {unmutemessageflag.%loop-index%} to 1
  130. delete {mute::%loop-index%}
  131. delete {unmutetime.%loop-index%}
  132. delete {mutedplayername.%loop-index%}
  133. on join:
  134. if {unmutemessageflag.%UUID of player%} is 1:
  135. send "&eあなたのミュートが解除されました"
  136. delete {unmutemessageflag.%UUID of player%}
  137. on connect:
  138. {mute::%UUID of player%} is set
  139. {mutedplayername.%UUID of player%} is not "%player%"
  140. set {mutedplayername.%UUID of player%} to "%player%"
  141. on tab complete:
  142. set {_splits::*} to split event-string by " "
  143. if {_splits::1} is "/mute":
  144. if size of {_splits::*} is 3:
  145. delete completions
  146. add "never" and "temply" to completions
  147. if first 1 characters of {_splits::3} is "t":
  148. delete completions
  149. add "temply" to completions
  150. if first 1 characters of {_splits::3} is "n":
  151. delete completions
  152. add "never" to completions
  153. else if size of {_splits::*} > 3:
  154. cancel event
  155. if {_splits::1} is "/unmute":
  156. size of {_splits::*} > 2
  157. cancel event
  158. if {_splits::1} is "/mutelist":
  159. size of {_splits::*} > 1
  160. cancel event
Add Comment
Please, Sign In to add comment