Advertisement
miyasoku

【Skript】Coreprotect (soramamoe_256)

Aug 3rd, 2020
168
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 14.26 KB | None | 0 0
  1. #提供: soramamore さん。
  2. on load:
  3. broadcast "&aConfig Reloaded."
  4. on break:
  5. if {CP.inspecter.%player%} is set:
  6. cancel event
  7. message "Inspecter log of %floor(x location of event-location)%,%floor(y location of event-location)%,%floor(z location of event-location)%"
  8. loop {CP::%floor(x location of event-location)%,%floor(y location of event-location)%,%floor(z location of event-location)%::*}:
  9. set {_log::*} to split loop-value at " "
  10. set {_log} to " %{_log::3}% %{_log::4}% %{_log::5}% %{_log::6}%"
  11. # message "debug:%{CPT::%floor(x location of event-location)%,%floor(y location of event-location)%,%floor(z location of event-location)%::%{_log::1}% %{_log::2}%}%({CPT::%floor(x location of event-location)%,%floor(y location of event-location)%,%floor(z location of event-location)%::%{_log::1}% %{_log::2}%})"
  12. set {_log1::*} to split {_log::2} at ";"
  13. set {_time} to difference between now and {CPT::%floor(x location of event-location)%,%floor(y location of event-location)%,%floor(z location of event-location)%::%{_log::1}% %{_log::2}%}
  14. set {_time} to timesetting("%{_time}%")
  15. if {CPR::%floor(x location of event-location)%,%floor(y location of event-location)%,%floor(z location of event-location)%::%loop-index%} is set:
  16. message "&m%{_time}% ago&7&m(%{_log::1}% %{_log1::1}%) &f&mid:%{_log1::2}%%{_log}%"
  17. else:
  18. message "%{_time}% ago&7(%{_log::1}% %{_log1::1}%) &fid:%{_log1::2}%%{_log}%"
  19. stop
  20. set {_id} to random integer between 1 and 999999
  21. set {CPB::%floor(x location of event-location)%,%floor(y location of event-location)%,%floor(z location of event-location)%::%nowdate()%;%{_id}%} to type of event-block
  22. add "%nowdate()%;%{_id}% : %player% deleted %event-block%" to {CP::%floor(x location of event-location)%,%floor(y location of event-location)%,%floor(z location of event-location)%::*}
  23. set {CPT::%floor(x location of event-location)%,%floor(y location of event-location)%,%floor(z location of event-location)%::%nowdate()%;%{_id}%} to now
  24. add all items in event-block's inventory to {CPN::%floor(x location of event-location)%,%floor(y location of event-location)%,%floor(z location of event-location)%::%nowdate()%;%{_id}%::*}
  25. function timesetting(time: String) :: String:
  26. replace all " and " in {_time} with ""
  27. replace all " minutes" in {_time} with "m"
  28. replace all " seconds" in {_time} with "s"
  29. replace all " minute" in {_time} with "m"
  30. replace all " second" in {_time} with "s"
  31. replace all " hours" in {_time} with "h"
  32. replace all " hour" in {_time} with "h"
  33. replace all " day" in {_time} with "d"
  34. replace all " days" in {_time} with "d"
  35. return {_time}
  36. on place:
  37. if {CP.inspecter.%player%} is set:
  38. cancel event
  39. message "Inspecter log of %floor(x location of event-location)%,%floor(y location of event-location)%,%floor(z location of event-location)%"
  40. loop {CP::%floor(x location of event-location)%,%floor(y location of event-location)%,%floor(z location of event-location)%::*}:
  41. set {_log::*} to split loop-value at " "
  42. set {_log} to " %{_log::3}% %{_log::4}% %{_log::5}% %{_log::6}%"
  43. # message "debug:%{CPT::%floor(x location of event-location)%,%floor(y location of event-location)%,%floor(z location of event-location)%::%{_log::1}% %{_log::2}%}%({CPT::%floor(x location of event-location)%,%floor(y location of event-location)%,%floor(z location of event-location)%::%{_log::1}% %{_log::2}%})"
  44. set {_log1::*} to split {_log::2} at ";"
  45. set {_time} to difference between now and {CPT::%floor(x location of event-location)%,%floor(y location of event-location)%,%floor(z location of event-location)%::%{_log::1}% %{_log::2}%}
  46. set {_time} to timesetting("%{_time}%")
  47. if {CPR::%floor(x location of event-location)%,%floor(y location of event-location)%,%floor(z location of event-location)%::%loop-index%} is set:
  48. message "&m%{_time}% ago&7&m(%{_log::1}% %{_log1::1}%) &f&mid:%{_log1::2}%%{_log}%"
  49. else:
  50. message "%{_time}% ago&7(%{_log::1}% %{_log1::1}%) &fid:%{_log1::2}%%{_log}%"
  51. stop
  52. set {_id} to random integer between 1 and 999999
  53. add "%nowdate()%;%{_id}% : %player% placed %event-block%" to {CP::%floor(x location of event-location)%,%floor(y location of event-location)%,%floor(z location of event-location)%::*}
  54. set {CPT::%floor(x location of event-location)%,%floor(y location of event-location)%,%floor(z location of event-location)%::%nowdate()%;%{_id}%} to now
  55. on load:
  56. add chest to {CPBlock::container::*}
  57. add dispenser to {CPBlock::container::*}
  58. add dropper to {CPBlock::container::*}
  59. add furnace to {CPBlock::container::*}
  60. add jukebox to {CPBlock::container::*}
  61. add brewing stand to {CPBlock::container::*}
  62. on explode:
  63. loop all blocks in radius 10 of event-location:
  64. loop-block is not air
  65. set {_loc.%loop-block's location%} to type of loop-block
  66. {CPBlock::container::*} contain loop-block
  67. set {_loc.%loop-block's location%.container::*} to all items in loop-block's inventory
  68. wait 1 seconds
  69. loop all blocks in radius 10 of event-location:
  70. {_loc.%loop-block's location%} is not loop-block
  71. set {_id} to random integer between 1 and 999999
  72. set {CPB::%floor(x location of loop-block's location)%,%floor(y location of loop-block)%,%floor(z location of loop-block)%::%nowdate()%;%{_id}%} to {_loc.%loop-block's location%}
  73. add "%nowdate()%;%{_id}% : ##%event-entity% deleted %{_loc.%loop-block's location%}%" to {CP::%floor(x location of loop-block)%,%floor(y location of loop-block)%,%floor(z location of loop-block)%::*}
  74. set {CPT::%floor(x location of loop-block)%,%floor(y location of loop-block)%,%floor(z location of loop-block)%::%nowdate()%;%{_id}%} to 1 seconds ago
  75. add {_loc.%loop-block's location%.container::*} to {CPN::%floor(x location of loop-block)%,%floor(y location of loop-block)%,%floor(z location of loop-block)%::%nowdate()%;%{_id}%::*}
  76. message "SKCP:explosion logging process done" to console
  77. #on explode:
  78. # add "%nowdate()% : ##%event-entity% &cexploded &f%event-block%" to {CP::%floor(x location of event-location)%%floor(y location of event-location)%%floor(z location of event-location)%::*}
  79. command /coreprotect <text> [<integer>] [<text>] [<timespan>]:
  80. aliases: /co
  81. permission: skript.coreprotect.use
  82. trigger:
  83. if arg-1 is "inspect":
  84. if {CP.inspecter.%player%} is not set:
  85. set {CP.inspecter.%player%} to true
  86. message "&aSKCP:&bInspecterを有効にしました"
  87. else:
  88. clear {CP.inspecter.%player%}
  89. message "&aSKCP:&bInspecterを無効にしました"
  90. else if arg-1 is "rollback":
  91. if arg-4 is set:
  92. loop all blocks in radius arg-2 of player:
  93. if {CP::%floor(x location of loop-block)%,%floor(y location of loop-block)%,%floor(z location of loop-block)%::*} is set:
  94. message "&aSKCP:&b%loop-block's location%を修復しています..."
  95. loop {CP::%floor(x location of loop-block)%,%floor(y location of loop-block)%,%floor(z location of loop-block)%::*}:
  96. chance of 2%:
  97. wait 2 ticks
  98. {CPR::%floor(x location of loop-block)%,%floor(y location of loop-block)%,%floor(z location of loop-block)%::%loop-index%} is not set
  99. clear {_loop::*}
  100. # message "Debug:looping {CP::%floor(x location of loop-block)%,%floor(y location of loop-block)%,%floor(z location of loop-block)%::*}"
  101. set {_loop::*} to split loop-value-2 at " "
  102. # message "Debug:Splited::%{_loop::*}%"
  103. set {_time} to {CPT::%floor(x location of loop-block)%,%floor(y location of loop-block)%,%floor(z location of loop-block)%::%{_loop::1}% %{_loop::2}%}
  104. # loop {CPT::%floor(x location of loop-block)%,%floor(y location of loop-block)%,%floor(z location of loop-block)%::*}:
  105. # message "Debug:Timeindex::%loop-index-2%"
  106. # message "Debug:Time::%{_time}%({CPT::%floor(x location of loop-block)%,%floor(y location of loop-block)%,%floor(z location of loop-block)%::%{_loop::1}% %{_loop::2}%})"
  107. difference between now and {_time} is smaller than arg-4
  108. # message "Debug:Passed difference"
  109. set {_player} to {_loop::4}
  110. if arg-3 is "all":
  111. set {_player} to arg-3
  112. "%arg-3%" is {_player}
  113. # message "Debug:Passed player"
  114. set {_event} to {_loop::5}
  115. set {_cprb} to type of loop-block
  116. set {_cprn::*} to all items in loop-block's inventory
  117. if {_event} is "placed":
  118. # message "Debug:block removed"
  119. set loop-block to air
  120. if {_event} is "deleted":
  121. set loop-block to {CPB::%floor(x location of loop-block)%,%floor(y location of loop-block)%,%floor(z location of loop-block)%::%{_loop::1}% %{_loop::2}%}
  122. # message "Debug:block placed(%{CPB::%floor(x location of loop-block)%,%floor(y location of loop-block)%,%floor(z location of loop-block)%::%{_loop::1}% %{_loop::2}%}%)"
  123. {CPBlock::container::*} contain loop-block
  124. # message "%loop-block% is container"
  125. wait 1 seconds
  126. add {CPN::%floor(x location of loop-block)%,%floor(y location of loop-block)%,%floor(z location of loop-block)%::%{_loop::1}% %{_loop::2}%::*} to loop-block's inventory
  127. # message "Debug:itemadded %{CPN::%floor(x location of loop-block)%,%floor(y location of loop-block)%,%floor(z location of loop-block)%::%{_loop::1}% %{_loop::2}%::*}%"
  128. set {CPR::%floor(x location of loop-block)%,%floor(y location of loop-block)%,%floor(z location of loop-block)%::%loop-index%} to loop-value-2
  129. set {CPRB::%floor(x location of loop-block)%,%floor(y location of loop-block)%,%floor(z location of loop-block)%::%{_loop::1}% %{_loop::2}%::*} to {_cprb::*}
  130. set {CPRT::%floor(x location of loop-block)%,%floor(y location of loop-block)%,%floor(z location of loop-block)%::%{_loop::1}% %{_loop::2}%} to now
  131. set {CPRN::%floor(x location of loop-block)%,%floor(y location of loop-block)%,%floor(z location of loop-block)%::%{_loop::1}% %{_loop::2}%} to {_cprn}
  132. message "&aSKCP:&b半径%arg-2%m内のブロックを%arg-4%巻き戻しました"
  133. else:
  134. message "&aSKCP:&c引数が指定されていません!"
  135. message "&aSKCP:&c必要引数指定内容: 引数1=rollback,引数2=半径,引数3=プレイヤー名,引数4=時間"
  136. else if arg-1 is "help":
  137. message "&aSKCP:&fコマンドリスト"
  138. message "&aSKCP:&f/coreprotect help: このヘルプを出力します。"
  139. message "&aSKCP:&f/coreprotect rollback <radius> <user> <timespan>: ロールバックします。"
  140. message "&aSKCP:&f/coreprotect inspect: 監査モードを切り替えます。"
  141. message "&aSKCP:&f/coreprotect redo: ロールバックされた場所をロールバック前に戻します"
  142. else if arg-1 is "redo":
  143. if arg-4 is set:
  144. loop all blocks in radius arg-2 of player:
  145. if {CPR::%floor(x location of loop-block)%,%floor(y location of loop-block)%,%floor(z location of loop-block)%::*} is set:
  146. message "&aSKCP:&b%loop-block's location%を修復しています..."
  147. loop {CPR::%floor(x location of loop-block)%,%floor(y location of loop-block)%,%floor(z location of loop-block)%::*}:
  148. chance of 2%:
  149. wait 2 ticks
  150. clear {_loop::*}
  151. # message "Debug:looping {CPR::%floor(x location of loop-block)%,%floor(y location of loop-block)%,%floor(z location of loop-block)%::*}"
  152. set {_loop::*} to split loop-value-2 at " "
  153. # message "Debug:Splited::%{_loop::*}%"
  154. set {_time} to {CPRT::%floor(x location of loop-block)%,%floor(y location of loop-block)%,%floor(z location of loop-block)%::%{_loop::1}% %{_loop::2}%}
  155. # loop {CPRT::%floor(x location of loop-block)%,%floor(y location of loop-block)%,%floor(z location of loop-block)%::*}:
  156. # message "Debug:Timeindex::%loop-index-2%"
  157. # message "Debug:Time::%{_time}%({CPRT::%floor(x location of loop-block)%,%floor(y location of loop-block)%,%floor(z location of loop-block)%::%{_loop::1}% %{_loop::2}%})"
  158. difference between now and {_time} is smaller than arg-4
  159. # message "Debug:Passed difference"
  160. set {_player} to {_loop::4}
  161. if arg-3 is "all":
  162. set {_player} to arg-3
  163. "%arg-3%" is {_player}
  164. # message "Debug:Passed player"
  165. set {_event} to {_loop::5}
  166. if {_event} is "placed":
  167. set loop-block to {CPRB::%floor(x location of loop-block)%,%floor(y location of loop-block)%,%floor(z location of loop-block)%::%{_loop::1}% %{_loop::2}%}
  168. # message "Debug:block placed(%{CPRB::%floor(x location of loop-block)%,%floor(y location of loop-block)%,%floor(z location of loop-block)%::%{_loop::1}% %{_loop::2}%}%)"
  169. {CPBlock::container::*} contain loop-block
  170. message "%loop-block% is container"
  171. wait 1 seconds
  172. add {CPRN::%floor(x location of loop-block)%,%floor(y location of loop-block)%,%floor(z location of loop-block)%::%{_loop::1}% %{_loop::2}%::*} to loop-block's inventory
  173. # message "Debug:itemadded %{CPRN::%floor(x location of loop-block)%,%floor(y location of loop-block)%,%floor(z location of loop-block)%::%{_loop::1}% %{_loop::2}%::*}%"
  174. if {_event} is "deleted":
  175. set loop-block to air
  176. # message "Debug:block deleted"
  177. clear {CPR::%floor(x location of loop-block)%,%floor(y location of loop-block)%,%floor(z location of loop-block)%::%loop-index%}
  178. clear {CPRB::%floor(x location of loop-block)%,%floor(y location of loop-block)%,%floor(z location of loop-block)%::%{_loop::1}% %{_loop::2}%::*}
  179. clear {CPRT::%floor(x location of loop-block)%,%floor(y location of loop-block)%,%floor(z location of loop-block)%::%{_loop::1}% %{_loop::2}%}
  180. clear {CPRN::%floor(x location of loop-block)%,%floor(y location of loop-block)%,%floor(z location of loop-block)%::%{_loop::1}% %{_loop::2}%}
  181. message "&aSKCP:&b半径%arg-2%m内のブロックを%arg-4%巻き返しました"
  182. else:
  183. message "&aSKCP:&c引数が指定されていません!"
  184. message "&aSKCP:&c必要引数指定内容: 引数1=rollback,引数2=半径,引数3=プレイヤー名,引数4=時間"
  185. function nowdate() :: string:
  186. set {_nowdate1} to "%now%"
  187. set {_nowdate2::*} to split {_nowdate1} at " "
  188. replace "," in {_nowdate2::1} with ""
  189. set {_return} to "%{_nowdate2::1}% %{_nowdate2::2}%%{_nowdate2::3}%"
  190. return {_return}
  191. #command /now:
  192. # trigger:
  193. # message "%now%"
  194. #command /variablescheck <text>:
  195. # permission: skript.add
  196. # trigger:
  197. # message "%{%arg-1%}%"
  198. #command /variabledelete <text>:
  199. # permission: skript.add
  200. # trigger:
  201. # clear {%arg-1%}
  202. # message "Deleted"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement