Advertisement
sora200507

Untitled

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