Advertisement
ALPHADOIDE

Untitled

Feb 11th, 2024
31
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 14.38 KB | None | 0 0
  1. command /skteam [<text>] [<text>] [<text>]:
  2. permission: skteam
  3. trigger:
  4. if arg-1 is not set:
  5. send "&a&l[SKTeam]&r&cコマンドの使い方が違います /skteam helpで使い方を表示します"
  6. else if arg-1 is "add":
  7. if arg-2 is not set:
  8. send "&a&l[Team]&r&c追加するチーム名を入力してください(例:/skteam add 赤チーム)"
  9. else:
  10. if {skteam::%arg-2%} is not set:
  11. send "&a&l[SKTeam]&r&b「%arg-2%」をチームとして登録しました"
  12. set {skteam::%arg-2%} to 0
  13. else:
  14. send "&a&l[SKTeam]&r&c「%arg-2%」は既にチームとして登録されています"
  15. else if arg-1 is "remove":
  16. if arg-2 is not set:
  17. send "&a&l[SKTeam]&r&c削除するチーム名を入力してください(例:/skteam remove 赤チーム)"
  18.  
  19. else:
  20. if {skteam::%arg-2%} is not set:
  21. send "&a&l[SKTeam]&r&c指定したチーム名が登録されていません"
  22. else:
  23. delete {skteam::%arg-2%}
  24. delete {skteam.team.color.%arg-2%}
  25. delete {skteam.team.spawnpoint.%arg-2%}
  26. send "&a&l[SKTeam]&r&b「%arg-2%」の削除をしました"
  27. loop all players:
  28. if {skteam.player.team.%loop-player's uuid%} is set:
  29. removePlayer(loop-player)
  30.  
  31. else if arg-1 is "list":
  32. set {_teamnum} to size of {skteam::*}
  33. if {_teamnum} = 0:
  34. send "&a&l[SKTeam]&r&b現在登録されているチームはありません"
  35. else:
  36. send "&a&l[SKTeam]&r&b現在登録されているチーム数:%size of {skteam::*}%"
  37. send "&a---------------------"
  38. loop {skteam::*}:
  39. if {skteam.team.color.%loop-index%} is set:
  40. set {_colorStatus} to colored "&a[カラーコード:登録済み(%{skteam.team.color.%loop-index%}%このように表示されます&a)]"
  41. else:
  42. set {_colorStatus} to colored "&c[カラーコード:未登録]"
  43.  
  44. if {skteam.team.spawnpoint.%loop-index%} is set:
  45. set {_spawnpointStatus} to "&a[スポーン地点:登録済み"
  46. set {_spawnpointCommand} to text component from "&d(ここをクリックで設定した地点にテレポートします)"
  47. set click event of {_spawnpointCommand} to a new click event to run command "/skteam teleport %loop-index%"
  48. else:
  49. set {_spawnpointStatus} to colored "&c[スポーン地点:未登録]"
  50. send "&r&b[%loop-index%]"
  51. send "[現在の人数]:%loop-value%"
  52. send {_colorStatus}
  53. send {_spawnpointStatus}
  54. if {_spawnpointCommand} is set:
  55. send component {_spawnpointCommand}
  56. send "&a---------------------"
  57. else if arg-1 is "setplayer":
  58. if arg-2 is not set:
  59. send "&a&l[SKTeam]&r&cチームに入れるプレイヤー、チーム名を指定してください(例:/skteam setplayer プレイヤー名 チーム名)"
  60. else if arg-3 is not set:
  61. send "&a&l[SKTeam]&r&cチームに入れるプレイヤー、チーム名を指定してください(例:/skteam setplayer プレイヤー名 チーム名)"
  62. else:
  63. set {_player} to arg-2 parsed as player
  64. if {_player} is online:
  65. if {skteam::%arg-3%} is not set:
  66. send "&a&l[SKTeam]&r&c入力したチームが登録されていません"
  67. else:
  68. send "&a&l[SKTeam]&r&b%{_player}%を「%arg-3%」に入れました"
  69. removePlayer({_player})
  70. add 1 to {skteam::%arg-3%}
  71. set {skteam.player.team.%{_player}'s uuid%} to arg-3
  72. updatePlayer({_player})
  73. else:
  74. send "&a&l[SKTeam]&r&c指定したプレイヤー(%arg-2%)がオンラインではありません"
  75. else if arg-1 is "setplayerrandom":
  76. if size of {skteam::*} = 0:
  77. send "&a&l[SKTeam]&r&cまだチームが一つも登録されていません。/skteam add <チーム名>でチームを登録してください"
  78. else:
  79. set {_player} to arg-2 parsed as player
  80. if {_player} is online:
  81. removePlayer({_player})
  82. loop {skteam::*}:
  83. if loop-iteration = 1:
  84. set {_onlinenum} to loop-value
  85. set {_result} to loop-index
  86. else:
  87. if loop-value <= {_onlinenum}:
  88. set {_rnd} to random integer between 1 and 2
  89. if {_rnd} = 1:
  90. continue
  91. set {_onlinenum} to loop-value
  92. set {_result} to loop-index-1
  93. set {skteam.player.team.%{_player}'s uuid%} to {_result}
  94. add 1 to {skteam::%{_result}%}
  95. send "&a&l[SKTeam]&e「%{_result}%」&aチームになりました" to {_player}
  96. updatePlayer({_player})
  97. else:
  98. send "&a&l[SKTeam]&r&c指定したプレイヤー(%arg-2%)がオンラインではありません"
  99. else if arg-1 is "setallplayer":
  100. if size of {skteam::*} = 0:
  101. send "&a&l[SKTeam]&r&cまだチームが一つも登録されていません。/skteam add <チーム名>でチームを登録してください"
  102. else:
  103. broadcast "&a&l[SKTeam]&r&a全員にチームを割り当てました"
  104. loop all players:
  105. set {_p::%loop-iteration%} to loop-player
  106. removePlayer(loop-player)
  107. set {_num} to size of {_p::*}
  108. loop {_num} times:
  109. set {_p} to random element out of {_p::*}
  110. loop {skteam::*}:
  111. if loop-iteration-2 = 1:
  112. set {_onlinenum} to loop-value-2
  113. set {_result} to loop-index-1
  114. else:
  115. if loop-value-2 <= {_onlinenum}:
  116. set {_rnd} to random integer between 1 and 2
  117. if {_rnd} = 1:
  118. continue
  119. set {_onlinenum} to loop-value-2
  120. set {_result} to loop-index-1
  121. set {skteam.player.team.%{_p}'s uuid%} to {_result}
  122. add 1 to {skteam::%{_result}%}
  123. send "&a&l[SKTeam]あなたは&e「%{_result}%」&aチームになりました" to {_p}
  124. remove {_p} from {_p::*}
  125. updatePlayers()
  126. else if arg-1 is "removeplayer":
  127. if arg-2 is not set:
  128. send "&a&l[SKTeam]&r&cチームに入れるプレイヤー、チーム名を指定してください(例:/skteam setplayer プレイヤー名 チーム名)"
  129. else:
  130. set {_p} to arg-2 parsed as player
  131. if {_p} is online:
  132. if {skteam.player.team.%{_p}'s uuid%} is not set:
  133. send "&a&l[SKTeam]&r&c指定したプレイヤー(%{_p}%)はチームに入っていません"
  134. else:
  135. removePlayer({_p})
  136. send "&a&l[SKTeam]&r&bプレイヤーをチームから外しました"
  137. else:
  138. send "&a&l[SKTeam]&r&cプレイヤーがオンラインではありません"
  139. else if arg-1 is "removeallplayer":
  140. loop all players:
  141. removePlayer(loop-player)
  142. broadcast "&a&l[SKTeam]&r&a全員をチームから外しました"
  143. else if arg-1 is "setcolor":
  144. if arg-2 is not set:
  145. send "&a&l[SKTeam]&r&cカラーコード、チーム名を指定してください(例:/skteam setcolor カラーコード チーム名)"
  146. else if arg-3 is not set:
  147. send "&a&l[SKTeam]&r&cカラーコード、チーム名を指定してください(例:/skteam setcolor カラーコード チーム名)"
  148. else:
  149. if {skteam::%arg-3%} is not set:
  150. send "&a&l[SKTeam]&r&c入力したチームが登録されていません"
  151. else:
  152. send "&a&l[SKTeam]&r&bカラーを設定しました"
  153. set {skteam.team.color.%arg-3%} to arg-2
  154. updatePlayers()
  155. else if arg-1 is "setspawn":
  156. if arg-2 is not set:
  157. send "&a&l[SKTeam]&r&cチーム名を指定してください(例:/skteam setspawn チーム名)"
  158. else:
  159. if {skteam::%arg-2%} is not set:
  160. send "&a&l[SKTeam]&r&cチーム名が登録されていません"
  161. else:
  162. send "&a&l[SKTeam]&r&b「%arg-2%」のスポーン地点をセットしました"
  163. set {skteam.team.spawnpoint.%arg-2%} to player's location
  164. else if arg-1 is "removespawn":
  165. if arg-2 is not set:
  166. send "&a&l[SKTeam]&r&cチーム名を指定してください(例:/skteam removespawn チーム名)"
  167. else:
  168. if {skteam::%arg-2%} is not set:
  169. send "&a&l[SKTeam]&r&cチーム名が登録されていません"
  170. else:
  171. if {skteam.team.spawnpoint.%arg-2%} is set:
  172. send "&a&l[SKTeam]&r&b「%arg-2%」のスポーン地点を削除しました"
  173. delete {skteam.team.spawnpoint.%arg-2%}
  174. else:
  175. send "&a&l[SKTeam]&r&c「%arg-2%」のスポーン地点はまだ登録されていません"
  176. else if arg-1 is "teleport":
  177. if {skteam.team.spawnpoint.%arg-2%} is set:
  178. teleport player to {skteam.team.spawnpoint.%arg-2%}
  179. else if arg-1 is "friendlyFire":
  180. if arg-2 is not set:
  181. if {skteam.friendlyFire} is set:
  182. send "&a&l[SKTeam]現在フレンドリーファイアは&bON&aになっています"
  183. else:
  184. send "&a&l[SKTeam]現在フレンドリーファイアは&bOFF&aになっています"
  185. if arg-2 is "on":
  186. set {skteam.friendlyFire} to true
  187. send "&a&l[SKTeam]フレンドリーファイアを&bON&aにしました"
  188. if arg-2 is "off":
  189. delete {skteam.friendlyFire}
  190. send "&a&l[SKTeam]フレンドリーファイアを&bOFF&aにしました"
  191. else if arg-1 is "help":
  192. send "&a&l[SKTeam]&r&bSKTeamの使い方"
  193. send "&a---------------------"
  194. send "&e/skteam add <チーム名>:&dチームを登録します"
  195. send "&e/skteam remove <チーム名>:&dチームを削除します"
  196. send "&e/skteam list:&d登録されている全てのチームの情報を表示します"
  197. send "&e/skteam setplayer <プレイヤー名> <チーム名>:&d指定したプレイヤーをチームに入れます"
  198. send "&e/skteam setcolor <カラーコード> <チーム名>:&dカラーコードを入力することでそのチームに色を付けます(チャット欄、ネームタグ、タブリスト)"
  199. send "&e/skteam setspawn <チーム名>:&dそのチームがリスポーンする場所を設定できます このコマンドを入力した時の場所が登録されます"
  200. send "&e/skteam removespawn <チーム名>:&dリスポーン地点が設定されている場合、削除することが出来ます"
  201. send "&e/skteam friendlyFire <on/off>:&d同じチーム同士の攻撃を有効化あるいは無効化するか選べます"
  202.  
  203.  
  204. on tab complete of "/skteam":
  205. set tab completions for position 1 to "add" and "remove" and "list" and "setplayer" and "setplayerrandom" and "removeplayer" and "setcolor" and "setspawn" and "removespawn" and "help" and "friendlyFire"
  206. if tab arg-1 is "remove":
  207. set tab completions for position 2 to indexes of {skteam::*}
  208. if tab arg-1 is "setplayer":
  209. set tab completions for position 2 to all players
  210. set tab completions for position 3 to indexes of {skteam::*}
  211. if tab arg-1 is "setplayerrandom":
  212. set tab completions for position 2 to all players
  213. if tab arg-1 is "removeplayer":
  214. set tab completions for position 2 to all players
  215. if tab arg-1 is "setcolor":
  216. set tab completions for position 3 to indexes of {skteam::*}
  217. if tab arg-1 is "setspawn":
  218. set tab completions for position 2 to indexes of {skteam::*}
  219. if tab arg-1 is "removespawn":
  220. set tab completions for position 2 to indexes of {skteam::*}
  221. if tab arg-1 is "friendlyFire":
  222. set tab completions for position 2 to "on" and "off"
  223.  
  224. function updatePlayers():
  225. loop all players:
  226. if {skteam.player.team.%loop-player's uuid%} is set:
  227. set {_team} to {skteam.player.team.%loop-player's uuid%}
  228. if {skteam.team.color.%{_team}%} is set:
  229. set the loop-player's tablist name to colored "%{skteam.team.color.%{_team}%}%[%{_team}%]%loop-player%"
  230. set the loop-player's display name to colored "%{skteam.team.color.%{_team}%}%[%{_team}%]%loop-player%"
  231. else:
  232. set the loop-player's tablist name to "[%{_team}%]%loop-player%"
  233. set the loop-player's display name to "[%{_team}%]%loop-player%"
  234.  
  235. function updatePlayer(p: player):
  236. if {skteam.player.team.%{_p}'s uuid%} is set:
  237. set {_team} to {skteam.player.team.%{_p}'s uuid%}
  238. if {skteam.team.color.%{_team}%} is set:
  239. set {_p}'s tablist name to colored "%{skteam.team.color.%{_team}%}%[%{_team}%]%{_p}%"
  240. set {_p}'s display name to colored "%{skteam.team.color.%{_team}%}%[%{_team}%]%{_p}%"
  241. else:
  242. set {_p}'s tablist name to "[%{_team}%]%{_p}%"
  243. set {_p}'s display name to "[%{_team}%]%{_p}%"
  244.  
  245. function removePlayer(p: player):
  246. if {skteam.player.team.%{_p}'s uuid%} is set:
  247. remove 1 from {skteam::%{skteam.player.team.%{_p}'s uuid%}%}
  248. delete {skteam.player.team.%{_p}'s uuid%}
  249. set {_p}'s tablist name to "%{_p}%"
  250. set {_p}'s display name to "%{_p}%"
  251.  
  252. on chat:
  253. if {skteam.player.team.%player's uuid%} is set:
  254. if {skteam.team.color.%{skteam.player.team.%player's uuid%}%} is set:
  255. set chat format to colored "%{skteam.team.color.%{skteam.player.team.%player's uuid%}%}%[%{skteam.player.team.%player's uuid%}%]%player% &6>> &r %message%"
  256. else:
  257. set chat format to "[%{skteam.player.team.%player's uuid%}%]%player% &6>> &r %message%"
  258. else:
  259. set chat format to "%player% &6>> &r %message%"
  260.  
  261. on respawn:
  262. if {skteam.team.spawnpoint.%{skteam.player.team.%player's uuid%}%} is set:
  263. set respawn location to {skteam.team.spawnpoint.%{skteam.player.team.%player's uuid%}%}
  264.  
  265. on leave:
  266. removePlayer(player)
  267.  
  268. on damage by player:
  269. if victim is player:
  270. if {skteam.player.team.%victim's uuid%} = {skteam.player.team.%attacker's uuid%}:
  271. if {skteam.player.team.%victim's uuid%} is set:
  272. if {skteam.friendlyFire} is not set:
  273. cancel event
  274.  
  275. on rightclick holding a lime dye:
  276. if {skteam.player.team.%player's uuid%} is not set:
  277. if size of {skteam::*} = 0:
  278. send "&a&l[SKTeam]&r&cチーム分けが出来ない状態です!運営が対応するまでお待ちください" to player
  279. else:
  280. removePlayer(player)
  281. loop {skteam::*}:
  282. if loop-iteration = 1:
  283. set {_onlinenum} to loop-value
  284. set {_result} to loop-index
  285. else:
  286. if loop-value <= {_onlinenum}:
  287. set {_rnd} to random integer between 1 and 2
  288. if {_rnd} = 1:
  289. continue
  290. set {_onlinenum} to loop-value
  291. set {_result} to loop-index-1
  292. set {skteam.player.team.%player's uuid%} to {_result}
  293. add 1 to {skteam::%{_result}%}
  294. send "&a&l[SKTeam]&e「%{_result}%」&aチームになりました" to player
  295. updatePlayer(player)
  296. if {skteam.team.spawnpoint.%{_result}%} is set:
  297. teleport player to {skteam.team.spawnpoint.%{_result}%}
  298.  
  299. on rightclick holding a red dye:
  300. if {skteam.player.team.%player's uuid%} is set:
  301. removePlayer(player)
  302. send "&a&l[SKTeam]&e&aチームから外れました" to player
  303.  
  304. command /setkillreward:
  305. trigger:
  306. set {killReward} to player's held item
  307. send "&a&l[KillReward]&r&b%{killReward}%をキル報酬に設定しました"
  308.  
  309. on death of player:
  310. if attacker is player:
  311. if {killReward} is set:
  312. give {killReward} to attacker
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement