Advertisement
ALPHADOIDE

SKTeam

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