Advertisement
Guest User

Untitled

a guest
Sep 22nd, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 35.06 KB | None | 0 0
  1.  
  2. options:
  3.  
  4. plugin-version: 0.0.7
  5.  
  6. config-loc: plugins/TheBridge/config.yml
  7.  
  8. on script load:
  9. set {_&} to "&"
  10. if yaml value "CHAT-FORMAT" from file "{@config-loc}" is not set:
  11. set yaml value "CHAT-FORMAT" from file "{@config-loc}" to "{team} %{_&}%3{player} %{_&}%8%{_&}%l- %{_&}%7{message}"
  12. if yaml value "AUTO-JOIN-ON-END" from file "{@config-loc}" is not set:
  13. set yaml value "AUTO-JOIN-ON-END" from file "{@config-loc}" to false
  14. if yaml value "COMMANDS.KILL" from file "{@config-loc}" is not set:
  15. set yaml value "COMMANDS.KILL" from file "{@config-loc}" to "eco give {player} 5"
  16. if yaml value "COMMANDS.WIN" from file "{@config-loc}" is not set:
  17. set yaml value "COMMANDS.WIN" from file "{@config-loc}" to "eco give {player} 20"
  18. if yaml value "COMMANDS.GOAL" from file "{@config-loc}" is not set:
  19. set yaml value "COMMANDS.GOAL" from file "{@config-loc}" to "eco give {player} 10"
  20. if yaml value "ITEMS.LEAVE" from file "{@config-loc}" is not set:
  21. set yaml value "ITEMS.LEAVE" from file "{@config-loc}" to "bed_item"
  22. if yaml value "ITEMS.LEAVE-NAME" from file "{@config-loc}" is not set:
  23. set yaml value "ITEMS.LEAVE-NAME" from file "{@config-loc}" to "%{_&}%c%{_&}%lLEAVE"
  24. if yaml value "MESSAGES.PREFIX" from file "{@config-loc}" is not set:
  25. set yaml value "MESSAGES.PREFIX" from file "{@config-loc}" to "%{_&}%6%{_&}%lTHE BRIDGE %{_&}%8%{_&}%l- %{_&}%7"
  26. if yaml value "MESSAGES.JOIN-MESSAGE" from file "{@config-loc}" is not set:
  27. set yaml value "MESSAGES.JOIN-MESSAGE" from file "{@config-loc}" to "%{_&}%a{player} %{_&}%ehas joined to the game."
  28. if yaml value "MESSAGES.LEFT-MESSAGE" from file "{@config-loc}" is not set:
  29. set yaml value "MESSAGES.LEFT-MESSAGE" from file "{@config-loc}" to "%{_&}%a{player} %{_&}%ehas left the game."
  30. if yaml value "MESSAGES.STARTING-IN" from file "{@config-loc}" is not set:
  31. set yaml value "MESSAGES.STARTING-IN" from file "{@config-loc}" to "%{_&}%eStarting in %{_&}%6{seconds} %{_&}%eseconds"
  32. if yaml value "STATUS.INGAME" from file "{@config-loc}" is not set:
  33. set yaml value "STATUS.INGAME" from file "{@config-loc}" to "%{_&}%cINGAME"
  34. if yaml value "STATUS.STARTING" from file "{@config-loc}" is not set:
  35. set yaml value "STATUS.STARTING" from file "{@config-loc}" to "%{_&}%3STARTING..."
  36. if yaml value "STATUS.WAITING" from file "{@config-loc}" is not set:
  37. set yaml value "STATUS.WAITING" from file "{@config-loc}" to "%{_&}%aWAITING"
  38. if yaml value "MESSAGES.IN-GAME" from file "{@config-loc}" is not set:
  39. set yaml value "MESSAGES.IN-GAME" from file "{@config-loc}" to "%{_&}%cYou are already in game."
  40. if yaml value "MESSAGES.NOT-IN-GAME" from file "{@config-loc}" is not set:
  41. set yaml value "MESSAGES.NOT-IN-GAME" from file "{@config-loc}" to "%{_&}%c%{_&}%lYou are not in game."
  42. if yaml value "MESSAGES.KILL-MESSAGE" from file "{@config-loc}" is not set:
  43. set yaml value "MESSAGES.KILL-MESSAGE" from file "{@config-loc}" to "%{_&}%c{victim} %{_&}%ewas killed by %{_&}%c{killer}"
  44. delete {THEBRIDGE::*}
  45. loop "CHAT-FORMAT", "ITEMS.LEAVE", "ITEMS.LEAVE-NAME", "AUTO-JOIN-ON-END", "COMMANDS.KILL", "COMMANDS.WIN", "MESSAGES.PREFIX", "MESSAGES.JOIN-MESSAGE", "MESSAGES.LEFT-MESSAGE", "MESSAGES.IN-GAME", "STATUS.WAITING", "STATUS.INGAME", "STATUS-STARTING", "MESSAGES.NOT-IN-GAME", "MESSAGES.NOT-IN-GAME", "MESSAGES.KILL-MESSAGE" and "MESSAGES.STARTING-IN":
  46. set {THEBRIDGE::CONFIG::%loop-value%} to yaml value "%loop-value%" from file "{@config-loc}"
  47. loop {THEBRIDGE::CONFIG::*}:
  48. replace all "&" with "§" in {THEBRIDGE::CONFIG::%loop-index%}
  49. replace all "{arrow-right}" with "»" in {THEBRIDGE::CONFIG::%loop-index%}
  50.  
  51.  
  52.  
  53.  
  54. #
  55. # \\ CODE //
  56. #
  57.  
  58.  
  59.  
  60. command /bridge [<text>] [<text>] [<text>]:
  61. executable by: players
  62. trigger:
  63. if arg-1 is "help" or "createarena" or "setspawn" or "join" or "leave" or "setlobby" or "deleteArena" or "list" or "autojoin" or "savearena" or "setPortalPos1" or "setPortalPos2" or "autojoin" or "stats" or "SetMaxBuildHeight":
  64. if arg 1 is "help":
  65. if player have permission "bridge.player":
  66. send "&7&l----------------&8[ %{THEBRIDGE::CONFIG::MESSAGES.PREFIX}% &8]&7&l----------------"
  67. send "&7/bridge list"
  68. send "&7/bridge join &8(&7arena_name&8)"
  69. send "&7/bridge autojoin"
  70. send "&7/bridge leave"
  71. if player have permission "bridge.admin":
  72. send "&7/bridge resetstats &8(&7player_name&8)"
  73. send "&7/bridge setlobby"
  74. send "&7/bridge createArena &8(&7arena_name&8) "
  75. send "&7/bridge savearena &8(&7arena_name&8) "
  76. send "&7/bridge deleteArena &8(&7arena_name&8) "
  77. send "&7/bridge setspawn &8(&7arena_name&8) &cred&7/&3blue&7/&alobby"
  78. send "&7/bridge setPortalPos1 &8(&7arena_name&8) &cred&7/&3blue&7"
  79. send "&7/bridge setPortalPos2 &8(&7arena_name&8) &cred&7/&3blue&7"
  80. send "&7/bridge SetMaxBuildHeight &8(&7arena_name&8), optional"
  81. send "&7&l---------------------------------------------"
  82. stop
  83. if arg 1 is "join":
  84. if {bridge.player::%uuid of player%.state} is not set:
  85. if {bridge.arena.%arg-2%.saved} is true:
  86. if {bridge.arena.%arg-2%.status} is "WAITING":
  87. if size of {bridge.arena.%arg-2%.ninjas::*} < 2:
  88. bridge_clear_player(player)
  89. bridge_tag(player, "clear")
  90. set {bridge.player::%uuid of player%.state} to "IN-GAME"
  91. set {bridge.player::%uuid of player%.arena} to arg-2
  92. set {bridge.player::%uuid of player%.kills} to 0
  93. set slot 8 of player to {THEBRIDGE::CONFIG::ITEMS.LEAVE} named "%{THEBRIDGE::CONFIG::ITEMS.LEAVE-NAME}%"
  94. add player to {bridge.arena.%arg-2%.ninjas::*}
  95. if size of {bridge.arena.%arg-2%.ninjas::*} = 2:
  96. bridge_start_countdown(arg-2)
  97. set {_x} to {THEBRIDGE::CONFIG::MESSAGES.JOIN-MESSAGE}
  98. replace all "{player}" in {_x} with player's displayname
  99. replace all "{players-count}" in {_x} with "%size of {bridge.arena.%arg-2%.ninjas::*}%"
  100. send "%{THEBRIDGE::CONFIG::MESSAGES.PREFIX}% %{_x}%" to {bridge.arena.%arg-2%.ninjas::*}
  101. delete stylish scoreboard "LOBBY-%player%"
  102. teleport player to {bridge.arena.%arg-2%.spawn.lobby}
  103. bridge_waiting_scoreboard(player)
  104. else:
  105. send "%{THEBRIDGE::CONFIG::MESSAGES.PREFIX}% &7This arena is full"
  106. stop
  107. else:
  108. send "%{THEBRIDGE::CONFIG::MESSAGES.PREFIX}% &7This game is running"
  109. stop
  110. else:
  111. send "%{THEBRIDGE::CONFIG::MESSAGES.PREFIX}% &7This arena not exists"
  112. stop
  113. else:
  114. send "%{THEBRIDGE::CONFIG::MESSAGES.PREFIX}% %{THEBRIDGE::CONFIG::MESSAGES.IN-GAME}%"
  115. stop
  116. if arg 1 is "list":
  117. if {bridge.player::%uuid of player%.state} is not set:
  118. open chest inventory with 6 rows named "&8&l» &7THE BRIDGE - ARENAS" to player
  119. set {_slot} to 10
  120. wait 2 ticks
  121. make a gui slot 0, 1, 2, 3, 4, 5, 6, 7, 17, 26, 35, 44, 18, 27, 36, 9, 45, 46, 47, 48, 49, 50, 51, 52, 53 and 8 of player with green glass named "&8 " to do nothing
  122. loop {bridge.arenas::*}:
  123. make a gui slot {_slot} of player with green clay named "&7" with lore "&8&l» &7NAME: &c&l%loop-value%||||&8&l» &7PLAYING: &3%size of {bridge.arena.%loop-value%.ninjas::*}%||||&8&l» &7STATE: &a%{bridge.arena.%loop-value%.status}%" to run player command "bridge join %loop-value%"
  124. add 1 to {_slot}
  125. if {_slot} is 17 or 26 or 35:
  126. add 2 to {_slot}
  127. if arg 1 is "leave":
  128. if {bridge.player::%uuid of player%.state} is "IN-GAME":
  129. set {_x} to {THEBRIDGE::CONFIG::MESSAGES.LEFT-MESSAGE}
  130. replace all "{player}" in {_x} with player's displayname
  131. send "%{THEBRIDGE::CONFIG::MESSAGES.PREFIX}% %{_x}%" to {bridge.arena.%{bridge.player::%uuid of player%.arena}%.ninjas::*}
  132. remove player from {bridge.arena.%{bridge.player::%uuid of player%.arena}%.ninjas::*}
  133. if {bridge.arena.%{bridge.player::%uuid of player%.arena}%.status} is "INGAME":
  134. if {bridge.player::%uuid of player%.team} is "BLUE":
  135. bridge_winner({bridge.arena.%{bridge.player::%uuid of player%.arena}%.red}, {bridge.player::%uuid of player%.arena})
  136. if {bridge.player::%uuid of player%.team} is "RED":
  137. bridge_winner({bridge.arena.%{bridge.player::%uuid of player%.arena}%.blue}, {bridge.player::%uuid of player%.arena})
  138. delete stylish scoreboard "BR2-%player%"
  139. delete stylish scoreboard "BR1-%player%"
  140. loop "arena", "team" and "state":
  141. delete {bridge.player::%uuid of player%.%loop-value%}
  142. bridge_clear_player(player)
  143. bridge_tag(player, "clear")
  144. teleport player to {bridge.lobby}
  145. else:
  146. send "%{THEBRIDGE::CONFIG::MESSAGES.PREFIX}% %{THEBRIDGE::CONFIG::MESSAGES.NOT-IN-GAME}%"
  147. stop
  148. if arg 1 is "autojoin":
  149. if {bridge.player::%uuid of player%.state} is not set:
  150. loop {bridge.arenas::*}:
  151. if {bridge.arena.%loop-value%.status} is "WAITING":
  152. make player execute command "bridge join %loop-value%"
  153. stop
  154. if arg-1 is "stats":
  155. send "&8&l●&7&l&m----------------------&8&l●"
  156. send ""
  157. send "&3&l» &7&lWINS &c%{bridge.stats.wins::%uuid of player%}%"
  158. send "&3&l» &7&lKILLS &c%{bridge.stats.kills::%uuid of player%}%"
  159. send "&3&l» &7&lGOALS &c%{bridge.stats.goals::%uuid of player%}%"
  160. send "&3&l» &7&lDEATHS &c%{bridge.stats.deaths::%uuid of player%}%"
  161. send ""
  162. send "&8&l●&7&l&m----------------------&8&l●"
  163. if arg 1 is "createarena":
  164. if player has permission "bridge.admin":
  165. if arg-2 is set:
  166. if {bridge.arena.%arg-2%.created} is not set:
  167. set {bridge.arena.%arg-2%.created} to true
  168. send "%{THEBRIDGE::CONFIG::MESSAGES.PREFIX}% &aArena &c%arg-2% &ahas been created!"
  169. else:
  170. send "%{THEBRIDGE::CONFIG::MESSAGES.PREFIX}% &aThis arena already exists!"
  171. else:
  172. send "%{THEBRIDGE::CONFIG::MESSAGES.PREFIX}% &aSpecify Arena!"
  173. if arg 1 is "setspawn":
  174. if player has permission "bridge.admin":
  175. if {bridge.arena.%arg-2%.created} is true:
  176. if arg-3 is "RED" or "BLUE" or "lobby":
  177. set {bridge.arena.%arg-2%.spawn.%arg-3%} to location of player
  178. send "%{THEBRIDGE::CONFIG::MESSAGES.PREFIX}% &aSpawn for &e%arg-3% &aon Arena &3%arg-2% &ahas been set!"
  179. else:
  180. send "%{THEBRIDGE::CONFIG::MESSAGES.PREFIX}% &aSpecify team."
  181. else:
  182. send "%{THEBRIDGE::CONFIG::MESSAGES.PREFIX}% &aThis arena not exists"
  183. if arg 1 is "setPortalPos1":
  184. if player has permission "bridge.admin":
  185. if {bridge.arena.%arg-2%.created} is true:
  186. if arg-3 is "RED" or "BLUE":
  187. set {bridge.arena.%arg-2%.portal.%arg-3%.pos1} to location of player
  188. send "%{THEBRIDGE::CONFIG::MESSAGES.PREFIX}% &aPos&8(&c1&8) &c%arg-3% &aon Arena &3%arg-2% &ahas been set!"
  189. else:
  190. send "%{THEBRIDGE::CONFIG::MESSAGES.PREFIX}% &aSpecify team."
  191. else:
  192. send "%{THEBRIDGE::CONFIG::MESSAGES.PREFIX}% &aThis arena not exists"
  193. if arg 1 is "SetMaxBuildHeight":
  194. if player has permission "bridge.admin":
  195. if {bridge.arena.%arg-2%.created} is true:
  196. set {bridge.arena.%arg-2%.Y-COORDS} to y-coords of player
  197. send "%{THEBRIDGE::CONFIG::MESSAGES.PREFIX}% &aMax Build Height For Arena &3%arg-2% &ahas been set!"
  198. else:
  199. send "%{THEBRIDGE::CONFIG::MESSAGES.PREFIX}% &aThis arena not exists"
  200. if arg 1 is "setPortalPos2":
  201. if player has permission "bridge.admin":
  202. if {bridge.arena.%arg-2%.created} is true:
  203. if arg-3 is "RED" or "BLUE":
  204. set {bridge.arena.%arg-2%.portal.%arg-3%.pos2} to location of player
  205. send "%{THEBRIDGE::CONFIG::MESSAGES.PREFIX}% &aPos&8(&c2&8) &c%arg-3% &aon Arena &3%arg-2% &ahas been set!"
  206. else:
  207. send "%{THEBRIDGE::CONFIG::MESSAGES.PREFIX}% &aSpecify team."
  208. else:
  209. send "%{THEBRIDGE::CONFIG::MESSAGES.PREFIX}% &aThis arena not exists"
  210. if arg 1 is "setlobby":
  211. if player has permission "bridge.admin":
  212. set {bridge.lobby} to location of player
  213. send "%{THEBRIDGE::CONFIG::MESSAGES.PREFIX}% &aLobby set."
  214. if arg 1 is "resetstats":
  215. if player has permission "bridge.admin":
  216. set {_p} to arg-2 parsed as player
  217. bridge_reset_stats({_p})
  218. send "%{THEBRIDGE::CONFIG::MESSAGES.PREFIX}% &cReseted Stats for &a%{_p}%"
  219. if arg 1 is "savearena":
  220. if player has permission "bridge.admin":
  221. if {bridge.arena.%arg-2%.created} is true:
  222. if {bridge.arena.%arg-2%.spawn.red} is set:
  223. if {bridge.arena.%arg-2%.spawn.blue} is set:
  224. if {bridge.arena.%arg-2%.spawn.lobby} is set:
  225. if {bridge.arena.%arg-2%.portal.RED.pos2} is set:
  226. if {bridge.arena.%arg-2%.portal.RED.pos1} is set:
  227. if {bridge.arena.%arg-2%.portal.BLUE.pos2} is set:
  228. if {bridge.arena.%arg-2%.portal.BLUE.pos1} is set:
  229. delete {bridge.arena.%arg-2%.created}
  230. set {bridge.arena.%arg-2%.saved} to true
  231. add arg-2 to {bridge.arenas::*}
  232. send "%{THEBRIDGE::CONFIG::MESSAGES.PREFIX}% &aArena &c%arg-2% &ahas been saved."
  233. bridge_resetarena(arg-2)
  234. else:
  235. send "%{THEBRIDGE::CONFIG::MESSAGES.PREFIX}% &aPortal Pos1 For team &1blue is not set!"
  236. else:
  237. send "%{THEBRIDGE::CONFIG::MESSAGES.PREFIX}% &aPortal Pos2 For team &1blue is not set!"
  238. else:
  239. send "%{THEBRIDGE::CONFIG::MESSAGES.PREFIX}% &aPortal Pos1 For team &cred is not set!"
  240. else:
  241. send "%{THEBRIDGE::CONFIG::MESSAGES.PREFIX}% &aPortal Pos2 For team &cred is not set!"
  242. else:
  243. send "%{THEBRIDGE::CONFIG::MESSAGES.PREFIX}% &aLobby is not set!"
  244. else:
  245. send "%{THEBRIDGE::CONFIG::MESSAGES.PREFIX}% &aSpawn &3blue &a is not set!"
  246. else:
  247. send "%{THEBRIDGE::CONFIG::MESSAGES.PREFIX}% &aSpawn &cred &a is not set!"
  248. else:
  249. send "%{THEBRIDGE::CONFIG::MESSAGES.PREFIX}% &aThis arena not exists"
  250. if arg 1 is "deletearena":
  251. if player has permission "bridge.admin":
  252. if {bridge.arena.%arg-2%.created} or {bridge.arena.%arg-2%.saved} is true:
  253. delete {bridge.arena.%arg-2%.spawn.red}
  254. delete {bridge.arena.%arg-2%.spawn.blue}
  255. delete {bridge.arena.%arg-2%.spawn.lobby}
  256. delete {bridge.arena.%arg-2%.goals.red}
  257. delete {bridge.arena.%arg-2%.goals.blue}
  258. delete {bridge.arena.%arg-2%.seconds}
  259. delete {bridge.arena.%arg-2%.status}
  260. delete {bridge.arena.%arg-2%.ninjas::*}
  261. delete {bridge.arena.%arg-2%::OMAE-MO-SHINDEIRU::*}
  262. delete {bridge.arena.%arg-2%.KILLMEPLS::*}
  263. remove arg-2 from {bridge.arenas::*}
  264. send "%{THEBRIDGE::CONFIG::MESSAGES.PREFIX}% &aArena &c%arg-2% &ahas been deleted."
  265. else:
  266. send "%{THEBRIDGE::CONFIG::MESSAGES.PREFIX}% &aThis arena not exists"
  267. else:
  268. make player execute command "bridge help"
  269.  
  270.  
  271.  
  272. on chat:
  273. if {bridge.player::%uuid of player%.state} is "IN-GAME":
  274. cancel event
  275. set {_x} to {THEBRIDGE::CONFIG::CHAT-FORMAT}
  276. replace all "{player}" in {_x} with player's displayname
  277. replace all "&" with " " in message
  278. replace all "{message}" with message in {_x}
  279. if {bridge.arena.%{_arena}%.status} is "INGAME":
  280. if {bridge.player::%uuid of player%.team} is "red":
  281. replace all "{team}" in {_x} with "&c&lRED"
  282. if {bridge.player::%uuid of player%.team} is "blue":
  283. replace all "{team}" in {_x} with "&1&lBLUE"
  284. else:
  285. replace all "{team}" in {_x} with ""
  286. send {_x} to {bridge.arena.%{bridge.player::%uuid of player%.arena}%.ninjas::*}
  287.  
  288. on hunger bar change:
  289. if {bridge.player::%uuid of player%.state} is "IN-GAME":
  290. set player's hunger to 20
  291.  
  292.  
  293. on damage of player:
  294. if {bridge.player::%uuid of victim%.state} is "IN-GAME":
  295. if {bridge.arena.%{bridge.player::%uuid of victim%.arena}%.status} is "STARTING" or "WAITING":
  296. cancel event
  297. damage cause is void
  298. teleport victim to {bridge.arena.%{bridge.player::%uuid of victim%.arena}%.spawn.lobby}
  299. if {bridge.arena.%{bridge.player::%uuid of victim%.arena}%.status} is "INGAME":
  300. if attacker is player:
  301. attacker is not victim
  302. set metadata value "LAST-HIT" of victim to attacker
  303. if damage cause is fall:
  304. cancel event
  305. if damage cause is void:
  306. cancel event
  307. kill victim
  308.  
  309. on load:
  310. delete {bridge.player::*}
  311.  
  312. on death of player:
  313. if {bridge.player::%uuid of victim%.state} is "IN-GAME":
  314. set death message to ""
  315. add 1 to {bridge.stats.deaths::%uuid of victim%}
  316. cancel drops
  317. if metadata value "LAST-HIT" of victim is not set:
  318. set {_y} to "void"
  319. else:
  320. set {_y} to metadata value "LAST-HIT" of victim
  321. set {_uuid} to uuid of {_y}
  322. add 1 to {bridge.stats.kills::%{_uuid}%}
  323. add 1 to {bridge.player::%{_uuid}%.kills}
  324. set {_o-o} to {THEBRIDGE::CONFIG::COMMANDS.KILL}
  325. replace all "{player}" in {_o-o} with "%{_y}%"
  326. make console execute command "%{_o-o}%"
  327. set {_x} to {THEBRIDGE::CONFIG::MESSAGES.KILL-MESSAGE}
  328. replace all "{victim}" in {_x} with "%victim%"
  329. replace all "{killer}" in {_x} with "%{_y}%"
  330. send "%{THEBRIDGE::CONFIG::MESSAGES.PREFIX}% %{_x}%" to {bridge.arena.%{bridge.player::%uuid of victim%.arena}%.ninjas::*}
  331. delete metadata value "PORTAL" of victim
  332. wait 0.2 seconds
  333. force victim to respawn
  334. wait 0.2 seconds
  335. teleport victim to {bridge.arena.%{bridge.player::%uuid of victim%.arena}%.spawn.%{bridge.player::%uuid of victim%.team}%}
  336. bridge_equip(victim, {bridge.player::%uuid of victim%.team})
  337.  
  338. on place:
  339. if {bridge.player::%uuid of player%.state} is "IN-GAME":
  340. if {bridge.arena.%{bridge.player::%uuid of player%.arena}%.status} is "INGAME":
  341. if {bridge.arena.%{bridge.player::%uuid of player%.arena}%.Y-COORDS} is set:
  342. if y-coords of location of event-block < {bridge.arena.%{bridge.player::%uuid of player%.arena}%.Y-COORDS}:
  343. if {bridge.arena.%{bridge.player::%uuid of player%.arena}%.KILLMEPLS::%location of event-block%} is not set:
  344. set {bridge.arena.%{bridge.player::%uuid of player%.arena}%.KILLMEPLS::%location of event-block%} to location of event-block
  345. else:
  346. cancel event
  347. else:
  348. if {bridge.arena.%{bridge.player::%uuid of player%.arena}%.KILLMEPLS::%location of event-block%} is not set:
  349. set {bridge.arena.%{bridge.player::%uuid of player%.arena}%.KILLMEPLS::%location of event-block%} to location of event-block
  350. else:
  351. cancel event
  352.  
  353. on load:
  354. send "&7&l--------------------------------------------" to console
  355. send " " to console
  356. send "%{THEBRIDGE::CONFIG::MESSAGES.PREFIX}% &aLoading &ev.{@plugin-version}&a..." to console
  357. wait a tick
  358. send "%{THEBRIDGE::CONFIG::MESSAGES.PREFIX}% &a&lPlugin loaded!" to console
  359. send " " to console
  360. send "&7&l--------------------------------------------" to console
  361. loop {bridge.arenas::*}:
  362. delete {bridge.arena.%loop-value%.ninjas::*}
  363. bridge_resetarena(loop-value)
  364.  
  365. on unload:
  366. send "&7&l--------------------------------------------" to console
  367. send " " to console
  368. send "%{THEBRIDGE::CONFIG::MESSAGES.PREFIX}% &aDisabling &ev.{@plugin-version}&a..." to console
  369. send "%{THEBRIDGE::CONFIG::MESSAGES.PREFIX}% &ev.{@plugin-version} &adisabled!" to console
  370. send " " to console
  371. send "&7&l--------------------------------------------" to console
  372. stop
  373.  
  374. on portal:
  375. if {bridge.player::%uuid of player%.state} is "IN-GAME":
  376. if {bridge.arena.%{bridge.player::%uuid of player%.arena}%.status} is "INGAME":
  377. metadata value "PORTAL" of player is not set
  378. set metadata value "PORTAL" of player to "true"
  379. if {bridge.player::%uuid of player%.team} is "RED":
  380. if location of player is within {bridge.arena.%{bridge.player::%uuid of player%.arena}%.portal.BLUE.pos1} to {bridge.arena.%{bridge.player::%uuid of player%.arena}%.portal.BLUE.pos2}:
  381. bridge_goal(player, {bridge.player::%uuid of player%.arena})
  382. if {bridge.player::%uuid of player%.team} is "BLUE":
  383. if location of player is within {bridge.arena.%{bridge.player::%uuid of player%.arena}%.portal.RED.pos1} to {bridge.arena.%{bridge.player::%uuid of player%.arena}%.portal.RED.pos2}:
  384. bridge_goal(player, {bridge.player::%uuid of player%.arena})
  385. wait 5 seconds
  386. delete metadata value "PORTAL" of player
  387.  
  388.  
  389. on join:
  390. if {bridge.stats.goals::%uuid of player%} is not set:
  391. bridge_reset_stats(player)
  392.  
  393.  
  394. on consume of golden_apple:
  395. if {bridge.player::%uuid of player%.state} is "IN-GAME":
  396. heal player
  397.  
  398. on inventory click:
  399. if {bridge.player::%uuid of player%.state} is "IN-GAME":
  400. if name of event-item is "%{THEBRIDGE::CONFIG::ITEMS.LEAVE-NAME}%":
  401. cancel event
  402. if event-item is any chestplate or any helmet or any boots or any leggings:
  403. cancel event
  404.  
  405. on drop:
  406. if {bridge.player::%uuid of player%.state} is "IN-GAME":
  407. cancel event
  408.  
  409. on right click with anything:
  410. if {bridge.player::%uuid of player%.state} is "IN-GAME":
  411. if name of event-item is {THEBRIDGE::CONFIG::ITEMS.LEAVE-NAME}:
  412. cancel event
  413. make player execute command "bridge leave"
  414.  
  415. on quit:
  416. if {bridge.player::%uuid of player%.state} is "IN-GAME":
  417. make player execute command "bridge leave"
  418. stop
  419.  
  420.  
  421. on break:
  422. if {bridge.player::%uuid of player%.state} is "IN-GAME":
  423. if {bridge.arena.%{bridge.player::%uuid of player%.arena}%.KILLMEPLS::%location of event-block%} is set:
  424. delete {bridge.arena.%{bridge.player::%uuid of player%.arena}%.KILLMEPLS::%location of event-block%}
  425. stop
  426. else:
  427. if event-block is clay:
  428. if {bridge.arena.%{bridge.player::%uuid of player%.arena}%::PLACEBLOCKS::%location of event-block%} is not set:
  429. set {bridge.arena.%{bridge.player::%uuid of player%.arena}%::OMAE-MO-SHINDEIRU::%location of event-block%} to location of event-block
  430. set {bridge.arena.%{bridge.player::%uuid of player%.arena}%::NANI?!::%location of event-block%} to "%event-block%" parsed as item
  431. else:
  432. cancel event
  433.  
  434.  
  435. function bridge_reset_stats(p: player):
  436. set {_uuid} to uuid of {_p}
  437. loop "kills", "deaths", "wins" and "goals":
  438. set {bridge.stats.%loop-value%::%{_uuid}%} to 0
  439.  
  440. function bridge_cage_timer(arena: text):
  441. set {_x.%{_arena}%} to 3
  442. loop 4 times:
  443. if {bridge.arena.%{_arena}%.status} is "INGAME":
  444. {_x.%{_arena}%} = 3 or 2 or 1:
  445. send {bridge.arena.%{_arena}%.ninjas::*} title "&e&lCAGES OPEN IN &a&l%{_x.%{_arena}%}% &e&lSECONDS" for 1 seconds
  446. remove 1 from {_x.%{_arena}%}
  447. wait 1 seconds
  448. {_x.%{_arena}%} = 0:
  449. bridge_setcage({bridge.arena.%{_arena}%.spawn.blue}, "AIR")
  450. bridge_setcage({bridge.arena.%{_arena}%.spawn.red}, "AIR")
  451. send {bridge.arena.%{_arena}%.ninjas::*} title "&3&lFIGHT!" for 1 second
  452.  
  453. function bridge_tag(p: player, do: text):
  454. set {_uuid} to uuid of {_p}
  455. if {_do} is "setteam":
  456. if {bridge.player::%{_uuid}%.team} is "RED":
  457. set {_team} to "&c&lRED"
  458. if {bridge.player::%{_uuid}%.team} is "BLUE":
  459. set {_team} to "&1&lBLUE"
  460. make console execute command "nte player %{_p}% prefix %{_team}% &7"
  461. if {_do} is "clear":
  462. make console execute command "nte player %{_p}% clear"
  463.  
  464. function bridge_setcage(loc: location, team: text):
  465. if {_team} is "RED":
  466. set {_b} to red glass block
  467. if {_team} is "BLUE":
  468. set {_b} to blue glass block
  469. if {_team} is "AIR":
  470. set {_b} to air
  471. loop blocks within block at block 2 above west 3 east 3 south {_loc} to block at block 1 under east 3 west 3 north {_loc}:
  472. set loop-block to {_b}
  473. loop blocks within block at block 2 above west 2 east 2 south {_loc} to block at block 0 under east 2 west 2 north {_loc}:
  474. set loop-block to air
  475.  
  476.  
  477.  
  478. function bridge_equip(p: player, team: text):
  479. bridge_clear_player({_p})
  480. wait 0.5 seconds
  481. equip {_p} with all leather armor
  482. set slot 0 of {_p} to iron_sword
  483. set slot 1 of {_p} to bow
  484. set slot 2 of {_p} to diamond_pickaxe of efficiency 2
  485. set slot 5 of {_p} to 8 golden_apple
  486. set slot 8 of {_p} to arrow
  487. if {_team} is "RED":
  488. set {_p}'s helmet to air
  489. dye {_p}'s chestplate red
  490. dye {_p}'s boots red
  491. dye {_p}'s leggings red
  492. set slot 3 of {_p} to 64 red clay
  493. set slot 4 of {_p} to 64 red clay
  494. if {_team} is "BLUE":
  495. set {_p}'s helmet to air
  496. dye {_p}'s chestplate blue
  497. dye {_p}'s boots blue
  498. dye {_p}'s leggings blue
  499. set slot 3 of {_p} to 64 blue clay
  500. set slot 4 of {_p} to 64 blue clay
  501.  
  502. on shoot:
  503. if {bridge.player::%uuid of shooter%.state} is "IN-GAME":
  504. if projectile is arrow:
  505. set metadata value "GAME" of projectile to "bridge"
  506. set {_x} to 3
  507. loop {_x} times:
  508. set shooter's level to {_x}
  509. wait 1 seconds
  510. remove 1 from {_x}
  511. {_x} = 0:
  512. if {bridge.player::%uuid of shooter%.state} is "IN-GAME":
  513. give 1 arrow to shooter
  514.  
  515.  
  516. on projectile hit:
  517. if metadata value "GAME" of projectile is "bridge":
  518. delete projectile
  519.  
  520. function bridge_put_in_team(p: player, arena: text):
  521. set {_uuid} to uuid of {_p}
  522. if {bridge.arena.%{_arena}%.red} is not set:
  523. set {bridge.arena.%{_arena}%.red} to {_p}
  524. set {bridge.player::%{_uuid}%.team} to "RED"
  525. stop
  526. if {bridge.arena.%{_arena}%.blue} is not set:
  527. set {bridge.arena.%{_arena}%.blue} to {_p}
  528. set {bridge.player::%{_uuid}%.team} to "BLUE"
  529. stop
  530.  
  531. function bridge_start_countdown(arena: text):
  532. set {bridge.arena.%{_arena}%.status} to "STARTING"
  533. while {bridge.arena.%{_arena}%.seconds} > 0:
  534. if size of {bridge.arena.%{_arena}%.ninjas::*} = 2:
  535. wait 1 seconds
  536. remove 1 from {bridge.arena.%{_arena}%.seconds}
  537. if {bridge.arena.%{_arena}%.seconds} = 1 or 2 or 3 or 4 or 5 or 10:
  538. set {_x} to {THEBRIDGE::CONFIG::MESSAGES.STARTING-IN}
  539. replace all "{seconds}" in {_x} with "%{bridge.arena.%{_arena}%.seconds}%"
  540. send "%{THEBRIDGE::CONFIG::MESSAGES.PREFIX}% %{_x}%" to {bridge.arena.%{_arena}%.ninjas::*}
  541. if {bridge.arena.%{_arena}%.seconds} = 1:
  542. set {bridge.arena.%{_arena}%.status} to "INGAME"
  543. loop {bridge.arena.%{_arena}%.ninjas::*}:
  544. bridge_put_in_team(loop-value, {_arena})
  545. delete stylish scoreboard "BR2-%loop-value%"
  546. bridge_game_scoreboard(loop-value)
  547. set {bridge.arena.%{_arena}%.goals.red} to 0
  548. set {bridge.arena.%{_arena}%.goals.blue} to 0
  549. bridge_setcage({bridge.arena.%{_arena}%.spawn.blue}, "BLUE")
  550. bridge_setcage({bridge.arena.%{_arena}%.spawn.red}, "RED")
  551. teleport {bridge.arena.%{_arena}%.red} to {bridge.arena.%{_arena}%.spawn.red}
  552. teleport {bridge.arena.%{_arena}%.blue} to {bridge.arena.%{_arena}%.spawn.blue}
  553. bridge_equip({bridge.arena.%{_arena}%.red}, "RED")
  554. bridge_equip({bridge.arena.%{_arena}%.blue}, "BLUE")
  555. bridge_tag({bridge.arena.%{_arena}%.red}, "setteam")
  556. bridge_tag({bridge.arena.%{_arena}%.blue}, "setteam")
  557. bridge_cage_timer({_arena})
  558. stop
  559. else:
  560. set {bridge.arena.%{_arena}%.status} to "WAITING"
  561. set {bridge.arena.%{_arena}%.seconds} to 10
  562. stop
  563.  
  564. function bridge_goal(p: player, arena: text):
  565. set {_uuid} to uuid of {_p}
  566. add 1 to {bridge.arena.%{_arena}%.goals.%{bridge.player::%{_uuid}%.team}%}
  567. add 1 to {bridge.stats.goals::%{_uuid}%}
  568. set {_o-o} to {THEBRIDGE::CONFIG::COMMANDS.GOAL}
  569. replace all "{player}" in {_o-o} with "%{_p}%"
  570. make console execute command "%{_o-o}%"
  571. if {bridge.player::%{_uuid}%.team} is "RED":
  572. set {_team} to "&3&lRED"
  573. if {bridge.player::%{_uuid}%.team} is "BLUE":
  574. set {_team} to "&1&lBLUE"
  575. send "&a&l■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■" to {bridge.arena.%{_arena}%.ninjas::*}
  576. send " " to {bridge.arena.%{_arena}%.ninjas::*}
  577. send " &e%{_p}% &7(&a%{_p}'s health% &c&l❤&7) &escored! &7(&6%{bridge.arena.%{_arena}%.goals.%{bridge.player::%{_uuid}%.team}%}%&6th goal&7)" to {bridge.arena.%{_arena}%.ninjas::*}
  578. send " &c&l%{bridge.arena.%{_arena}%.goals.red}% &7- &1&l%{bridge.arena.%{_arena}%.goals.blue}%" to {bridge.arena.%{_arena}%.ninjas::*}
  579. send " " to {bridge.arena.%{_arena}%.ninjas::*}
  580. send " " to {bridge.arena.%{_arena}%.ninjas::*}
  581. send "&a&l■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■" to {bridge.arena.%{_arena}%.ninjas::*}
  582. teleport {bridge.arena.%{_arena}%.red} to {bridge.arena.%{_arena}%.spawn.red}
  583. teleport {bridge.arena.%{_arena}%.blue} to {bridge.arena.%{_arena}%.spawn.blue}
  584. if {bridge.arena.%{_arena}%.goals.%{bridge.player::%{_uuid}%.team}%} is not 5:
  585. bridge_setcage({bridge.arena.%{_arena}%.spawn.blue}, "BLUE")
  586. bridge_setcage({bridge.arena.%{_arena}%.spawn.red}, "RED")
  587. bridge_cage_timer({_arena})
  588. bridge_equip({bridge.arena.%{_arena}%.blue}, "BLUE")
  589. bridge_equip({bridge.arena.%{_arena}%.red}, "RED")
  590. if {bridge.arena.%{_arena}%.goals.%{bridge.player::%{_uuid}%.team}%} is 5:
  591. bridge_winner({_p}, {_arena})
  592.  
  593.  
  594. function bridge_winner(p: player, arena: text):
  595. set {_uuid} to uuid of {_p}
  596. if {bridge.player::%{_uuid}%.team} is "RED":
  597. set {_team} to "&c&lRED"
  598. if {bridge.player::%{_uuid}%.team} is "BLUE":
  599. set {_team} to "&1&lBLUE"
  600. send "&a&l■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■" to {bridge.arena.%{_arena}%.ninjas::*}
  601. send " " to {bridge.arena.%{_arena}%.ninjas::*}
  602. send " &f&lTHE BRIDGE &a&l1v1" to {bridge.arena.%{_arena}%.ninjas::*}
  603. send " " to {bridge.arena.%{_arena}%.ninjas::*}
  604. send " %{_team}% &7&lWINS" to {bridge.arena.%{_arena}%.ninjas::*}
  605. send " &c&l%{bridge.arena.%{_arena}%.goals.red}% &7- &1&l%{bridge.arena.%{_arena}%.goals.blue}%" to {bridge.arena.%{_arena}%.ninjas::*}
  606. send " " to {bridge.arena.%{_arena}%.ninjas::*}
  607. send "&a&l■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■" to {bridge.arena.%{_arena}%.ninjas::*}
  608. add 1 to {bridge.stats.wins::%{_uuid}%}
  609. set {_o-o} to {THEBRIDGE::CONFIG::COMMANDS.WIN}
  610. replace all "{player}" in {_o-o} with "%{_p}%"
  611. make console execute command "%{_o-o}%"
  612. loop 10 times:
  613. if {bridge.player::%{_uuid}%.state} is "IN-GAME":
  614. launch trailing flickering star coloured purple and red fading to yellow at {_p}'s location timed 1
  615. wait 10 ticks
  616. bridge_resetarena({_arena})
  617.  
  618.  
  619.  
  620. function bridge_resetarena(arena: text):
  621. loop {bridge.arena.%{_arena}%.ninjas::*}:
  622. delete {bridge.player::%uuid of loop-value%.state}
  623. delete {bridge.player::%uuid of loop-value%.arena}
  624. bridge_clear_player(loop-value-1)
  625. bridge_tag(loop-value-1, "clear")
  626. delete stylish scoreboard "BR2-%loop-value-1%"
  627. if {THEBRIDGE::CONFIG::AUTO-JOIN-ON-END} is true:
  628. loop {bridge.arenas::*}:
  629. if {bridge.arena.%loop-value-2%.status} is "WAITING":
  630. make loop-value-1 execute command "bridge join %loop-value-2%"
  631. set {_x} to true
  632. if {_x} is not set:
  633. teleport loop-value-1 to {bridge.lobby}
  634. else:
  635. teleport loop-value-1 to {bridge.lobby}
  636. loop {bridge.arena.%{_arena}%.KILLMEPLS::*}:
  637. set block at loop-value to air
  638. wait 1 tick
  639. loop {bridge.arena.%{_arena}%::OMAE-MO-SHINDEIRU::*}:
  640. set block at location of {bridge.arena.%{_arena}%::OMAE-MO-SHINDEIRU::%loop-index%} to {bridge.arena.%{_arena}%::NANI?!::%loop-index%}
  641. wait 1 ticks
  642. delete {bridge.arena.%{_arena}%::OMAE-MO-SHINDEIRU::*}
  643. delete {bridge.arena.%{_arena}%::NANI?!::*}
  644. delete {bridge.arena.%{_arena}%.KILLMEPLS::*}
  645. delete {bridge.arena.%{_arena}%.ninjas::*}
  646. delete {bridge.arena.%{_arena}%.red}
  647. delete {bridge.arena.%{_arena}%.blue}
  648. loop all entities in radius 500 around {bridge.arena.%{_arena}%.spawn.blue}:
  649. clear loop-entity
  650. bridge_setcage({bridge.arena.%{_arena}%.spawn.blue}, "AIR")
  651. bridge_setcage({bridge.arena.%{_arena}%.spawn.red}, "AIR")
  652. set {bridge.arena.%{_arena}%.goals.red} to 0
  653. set {bridge.arena.%{_arena}%.goals.blue} to 0
  654. set {bridge.arena.%{_arena}%.seconds} to 10
  655. set {bridge.arena.%{_arena}%.status} to "WAITING"
  656.  
  657.  
  658.  
  659. function bridge_clear_player(p: player):
  660. remove REGENERATION, SPEED, FIRE RESISTANCE, POISON, WEAKNESS, INCREASE DAMAGE, SLOW, WATER BREATHING, INVISIBILITY, DAMAGE RESISTANCE and ABSORPTION from {_p}
  661. heal {_p}
  662. extinguish {_p}
  663. set {_p}'s food to 20
  664. clear {_p}'s level
  665. clear {_p}'s inventory
  666. set {_p}'s gamemode to survival
  667. set {_p}'s flight mode to false
  668. delete metadata value "PORTAL" of {_p}
  669. delete metadata value "LAST-HIT" of {_p}
  670.  
  671.  
  672.  
  673.  
  674. function bridge_waiting_scoreboard(p: player):
  675. set {_uuid} to uuid of {_p}
  676. if stylish scoreboard "BR1-%{_p}%" does not exist:
  677. create new stylish scoreboard named "BR1-%{_p}%"
  678. loop 10 times:
  679. create a new id based score "BR1-%{_p}%Slot%loop-number%" with text "&%loop-number%" slot loop-number for stylish scoreboard "BR1-%{_p}%"
  680. while {bridge.arena.%{bridge.player::%{_uuid}%.arena}%.status} is "WAITING" or "STARTING":
  681. set stylish scoreboard of {_p} to "BR1-%{_p}%"
  682. set title of stylish scoreboard "BR1-%{_p}%" to "&e&lTHE BRIDGE"
  683. set the text of id "BR1-%{_p}%Slot10" to "&7%now%"
  684. set the text of id "BR1-%{_p}%Slot9" to "&9&2"
  685. set the text of id "BR1-%{_p}%Slot8" to "&8&fPlayers: &a%size of {bridge.arena.%{bridge.player::%{_uuid}%.arena}%.ninjas::*}%"
  686. set the text of id "BR1-%{_p}%Slot7" to "&7&2"
  687. set the text of id "BR1-%{_p}%Slot6" to "&6&fStarting in &a%{bridge.arena.%{bridge.player::%{_uuid}%.arena}%.seconds}%s"
  688. set the text of id "BR1-%{_p}%Slot5" to "&5&2"
  689. set the text of id "BR1-%{_p}%Slot4" to "&4&fMode: &e1v1"
  690. set the text of id "BR1-%{_p}%Slot3" to "&3&fMap: &a%{bridge.player::%{_uuid}%.arena}%"
  691. set the text of id "BR1-%{_p}%Slot2" to "&2&2"
  692. set the text of id "BR1-%{_p}%Slot1" to "&1&e&lMC.SERVER.ORG"
  693. wait a second
  694.  
  695. function bridge_game_scoreboard(p: player):
  696. set {_uuid} to uuid of {_p}
  697. if stylish scoreboard "BR2-%{_p}%" does not exist:
  698. create new stylish scoreboard named "BR2-%{_p}%"
  699. loop 12 times:
  700. create a new id based score "BR2-%{_p}%Slot%loop-number%" with text "&%loop-number%" slot loop-number for stylish scoreboard "BR2-%{_p}%"
  701. while {bridge.arena.%{bridge.player::%{_uuid}%.arena}%.status} is "INGAME":
  702. set stylish scoreboard of {_p} to "BR2-%{_p}%"
  703. set title of stylish scoreboard "BR2-%{_p}%" to "&e&lTHE BRIDGE"
  704. set the text of id "BR2-%{_p}%Slot12" to "&c&7%now%"
  705. set the text of id "BR2-%{_p}%Slot11" to "&d&2"
  706. set the text of id "BR2-%{_p}%Slot10" to "&e&1&lBlue Team: &e%{bridge.arena.%{bridge.player::%{_uuid}%.arena}%.goals.blue}%&7/5"
  707. set the text of id "BR2-%{_p}%Slot9" to "&9&c&lRed Team: &e%{bridge.arena.%{bridge.player::%{_uuid}%.arena}%.goals.red}%&7/5"
  708. set the text of id "BR2-%{_p}%Slot8" to "&8&2"
  709. set the text of id "BR2-%{_p}%Slot7" to "&7&fKills: &a%{bridge.player::%{_uuid}%.kills}%"
  710. set the text of id "BR2-%{_p}%Slot6" to "&6&fGoals: &a%{bridge.arena.%{bridge.player::%{_uuid}%.arena}%.goals.%{bridge.player::%{_uuid}%.team}%}%"
  711. set the text of id "BR2-%{_p}%Slot5" to "&5&2"
  712. set the text of id "BR2-%{_p}%Slot4" to "&4&fMode: &e1v1"
  713. set the text of id "BR2-%{_p}%Slot3" to "&3&fMap: &a%{bridge.player::%{_uuid}%.arena}%"
  714. set the text of id "BR2-%{_p}%Slot2" to "&2&2"
  715. set the text of id "BR2-%{_p}%Slot1" to "&1&e&lMC.SERVER.ORG"
  716. wait a second
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement