Advertisement
ALPHADOIDE

SKTeam(fixed)

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