Advertisement
hubs

Untitled

Mar 18th, 2019
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 85.06 KB | None | 0 0
  1. #SPHERE BATTLE
  2. #Skript code made by KabanFriends
  3. #
  4. #REQUIRED PLUGINS:
  5. # Skript
  6. # skript-mirror
  7. # SkQuery
  8. # Skellett
  9. # skript-yaml
  10. # TuSKe
  11. # SkUtilities
  12. # MundoSK
  13. # HolographicDisplaysAddon
  14. # ProtocolLib
  15. # Multiverse-Core
  16. # HolographicDisplays
  17.  
  18. options:
  19. DefaultLanguage: en_us
  20. NeededPlayersToStart: 2
  21. StartingCountdownTime: 30
  22. RespawnCooldownTime: 3
  23. MapHandlerName: kfSphereBattleMapHandler
  24.  
  25. import:
  26. org.bukkit.event.player.PlayerSwapHandItemsEvent
  27. org.bukkit.event.player.PlayerChatEvent
  28.  
  29. on script stop:
  30. loop all players:
  31. {kfsb.ingame::%loop-player%} is set
  32. kfsbLeaveGame(loop-player)
  33. kfsbResetStatus()
  34.  
  35. function kfsbSetFacing(player: player, facing: text, location: location):
  36. if {_facing} is "south":
  37. set {_yaw} to 360
  38. set {_pitch} to 0.01
  39. else if {_facing} is "north":
  40. set {_yaw} to -180
  41. set {_pitch} to 0.01
  42. else if {_facing} is "east":
  43. set {_yaw} to -90
  44. set {_pitch} to 0.01
  45. else if {_facing} is "west":
  46. set {_yaw} to 90
  47. set {_pitch} to 0.01
  48. else if {_facing} is "below":
  49. set {_yaw} to 0.01
  50. set {_pitch} to 90
  51. else if {_facing} is "above":
  52. set {_yaw} to 0.01
  53. set {_pitch} to -90
  54. set yaw of {_location} to {_yaw}
  55. set pitch of {_location} to {_pitch}
  56. teleport {_player} to {_location}
  57.  
  58. function kfsbDeleteHologram(player: player):
  59. {kfsb.hologram::%{_player}%} is set
  60. unregister hologram {kfsb.hologram::%{_player}%}
  61. delete {kfsb.hologram::%{_player}%}
  62.  
  63. function kfsbPlaceHologram(player: player):
  64. {kfsb.ingame::%{_player}%} is set
  65. if {kfsb.team::%{_player}%} is "red":
  66. set {_temp1} to yaml value "hologram-redspawn-1" from {kfsb.lang.%{_player}%}
  67. set {_temp2} to yaml value "hologram-redspawn-2" from {kfsb.lang.%{_player}%}
  68. if {kfsb.hologram::%{_player}%} is set:
  69. kfsbDeleteHologram({_player})
  70. set {kfsb.hologram::%{_player}%} to new hologram at location 1.5 meter above {kfsb.mapdata.redspawn}
  71. hide hologram {kfsb.hologram::%{_player}%} from all players
  72. add text {_temp1} to hologram {kfsb.hologram::%{_player}%}
  73. add text {_temp2} to hologram {kfsb.hologram::%{_player}%}
  74. else if {kfsb.team::%{_player}%} is "blue":
  75. set {_temp1} to yaml value "hologram-bluespawn-1" from {kfsb.lang.%{_player}%}
  76. set {_temp2} to yaml value "hologram-bluespawn-2" from {kfsb.lang.%{_player}%}
  77. if {kfsb.hologram::%{_player}%} is set:
  78. kfsbDeleteHologram({_player})
  79. set {kfsb.hologram::%{_player}%} to new hologram at location 1.5 meter above {kfsb.mapdata.bluespawn}
  80. hide hologram {kfsb.hologram::%{_player}%} from all players
  81. add text {_temp1} to hologram {kfsb.hologram::%{_player}%}
  82. add text {_temp2} to hologram {kfsb.hologram::%{_player}%}
  83. set {_temp1} to yaml value "hologram-%{kfsb.team::%{_player}%}%spawn-1" from {kfsb.lang.%{_player}%}
  84. show hologram {kfsb.hologram::%{_player}%} to {_player}
  85.  
  86. function kfsbEndgame():
  87. set {_temp2} to ""
  88. loop all players:
  89. if "%{kfsb.team::%loop-player%}%" is "%{kfsb.winteam}%":
  90. set {_temp2} to "%{_temp2}% %loop-player%"
  91. loop all players:
  92. if {kfsb.ingame::%loop-player%} is set:
  93. send yaml value "chat-greenbar" from "%{kfsb.lang.%loop-player%}%" to loop-player
  94. send centered yaml value "chat-winmessage-1" from "%{kfsb.lang.%loop-player%}%" to loop-player
  95. send centered yaml value "chat-winmessage-2" from "%{kfsb.lang.%loop-player%}%" to loop-player
  96. send centered yaml value "chat-winmessage-3-%{kfsb.winteam}%" from "%{kfsb.lang.%loop-player%}%" to loop-player
  97. set {_temp.%loop-player%} to yaml value "chat-winmessage-4" from "%{kfsb.lang.%loop-player%}%"
  98. replace every "{members}" with {_temp2} in {_temp.%loop-player%}
  99. send centered {_temp.%loop-player%} to loop-player
  100. send centered yaml value "chat-winmessage-5" from "%{kfsb.lang.%loop-player%}%" to loop-player
  101. send yaml value "chat-greenbar" from "%{kfsb.lang.%loop-player%}%" to loop-player
  102. wait 10 seconds
  103. kfsbResetGame()
  104.  
  105. function kfsbOpenTeleporterGui(player: player):
  106. set {_size} to size of {kfsb.redalive::*} + size of {kfsb.bluealive::*}
  107. set {_row} to ceil({_size} / 9) + 1
  108. if {_player} doesn't have a gui:
  109. set {_temp} to yaml value "gui-teleporter-title" from {kfsb.lang.%{_player}%}
  110. set {_guiname} to "%{_temp}%&1&2&3&4&f&r"
  111. open chest with {_row} row named {_guiname} to {_player}
  112. inventory name of {_player}'s current inventory contains "&1&2&3&4&f&r"
  113. create a gui slot 4 of {_player} with barrier named yaml value "item-gui-close-name" from {kfsb.lang.%{_player}%} to close
  114. set {_slot} to 9
  115. set {_temp} to yaml value "gui-clicktoteleport" from {kfsb.lang.%{_player}%}
  116. loop {kfsb.redalive::*}:
  117. create a gui slot {_slot} of {_player} with skull of ("%loop-value%" parsed as an offline player) named "&c&l[RED]&a %loop-value%" with lore "||%{_temp}%" to close then run function kfsbTeleport({_player}, location of {kfsb.redalive::%loop-index%})
  118. add 1 to {_slot}
  119. loop {kfsb.bluealive::*}:
  120. create a gui slot {_slot} of {_player} with skull of ("%loop-value%" parsed as an offline player) named "&9&l[BLUE]&a %loop-value%" with lore "||%{_temp}%" to close then run function kfsbTeleport({_player}, location of {kfsb.bluealive::%loop-index%})
  121. add 1 to {_slot}
  122.  
  123. function kfsbTeleport(player: player, location: location):
  124. teleport {_player} to {_location}
  125.  
  126. function kfsbSetSpectator(player: player, isSpectator: boolean):
  127. if {_isSpectator} is true:
  128. set {_player}'s gamemode to survival
  129. {_player}.setAllowFlight(true)
  130. {_player}.setFlying(true)
  131. hide {_player} from all players
  132. set {_count} to 0
  133. loop 41 times:
  134. set slot {_count} of {_player}'s inventory to air
  135. add 1 to {_count}
  136. set hunger of {_player} to 10
  137. set saturation of {_player} to 10
  138. set health of {_player} to 10
  139. set max health of {_player} to 10
  140. clear potion effects of {_player}
  141. set {_temp} to yaml value "item-returntolobby-name" from {kfsb.lang.%{_player}%}
  142. set {_itemname} to "%{_temp}%&1&2&3&4&r&2&l"
  143. set slot 8 of {_player} to {_item}
  144. set {_x} to (x coordinate of {kfsb.mapdata.redspawn} + x coordinate of {kfsb.mapdata.bluespawn}) / 2
  145. set {_y} to (y coordinate of {kfsb.mapdata.redspawn} + y coordinate of {kfsb.mapdata.bluespawn}) / 2 + 15
  146. set {_z} to (z coordinate of {kfsb.mapdata.redspawn} + z coordinate of {kfsb.mapdata.bluespawn}) / 2
  147. set {_centerLocation} to location({_x}, {_y}, {_z}, world of {_player})
  148. set {kfsb.isSpectator::%{_player}%} to true
  149. teleport {_player} to {_centerLocation}
  150. wait 10 ticks
  151. set {_temp} to yaml value "item-teleporter-name" from {kfsb.lang.%{_player}%}
  152. set {_itemname} to "%{_temp}%&1&2&3&4&r&e&m"
  153. set slot 4 of {_player}'s inventory to a minecart named {_itemname} with lore yaml value "item-teleporter-lore" from {kfsb.lang.%{_player}%}
  154. else if {_isSpectator} is false:
  155. reveal {_player} to all players
  156. clear {_player}'s inventory
  157. set hunger of {_player} to 10
  158. set saturation of {_player} to 10
  159. set health of {_player} to 10
  160. set max health of {_player} to 10
  161. clear potion effects of {_player}
  162. {_player}.setAllowFlight(false)
  163. {_player}.setFlying(false)
  164.  
  165. function kfsbGetUsername(player: player) :: text:
  166. set {_temp} to "&e%{_player}%"
  167. if {kfsb.ingame::%{_player}%} is set:
  168. if {kfsb.team::%{_player}%} is "red":
  169. set {_temp} to "&c%{_player}%"
  170. else if {kfsb.team::%{_player}%} is "blue":
  171. set {_temp} to "&9%{_player}%"
  172. return {_temp}
  173.  
  174. function kfsbDeathEvent(player: player):
  175. if {kfsb.status} is "ingame":
  176. delete {kfsb.respawnCountdown.%{_player}%}
  177. loop name of all items of {_player}:
  178. if loop-string contains "&1&2&3&4&r&1":
  179. set {kfsb.spawnmoving.red} to true
  180. set {kfsb.spawnbroken.red} to true
  181. loop all players:
  182. {kfsb.ingame::%loop-player%} is set
  183. set {_temp.%loop-player%} to yaml value "chat-diedwithspawnblock-red" from {kfsb.lang.%loop-player%}
  184. replace every "{player}" with kfsbGetUsername({_player}) in {_temp.%loop-player%}
  185. send {_temp.%loop-player%} to loop-player
  186. {kfsb.team::%loop-player%} is "red"
  187. send title yaml value "title-spawn-has-lost" from {kfsb.lang.%loop-player%} with subtitle yaml value "title-spawn-destroyed-sub" from {kfsb.lang.%loop-player%} to loop-player for 4 seconds and 0 ticks and 0 ticks
  188. play "ENTITY_ENDERDRAGON_GROWL" to loop-player at volume 10 at pitch 5
  189. else if loop-string contains "&1&2&3&4&b&1":
  190. set {kfsb.spawnmoving.blue} to true
  191. set {kfsb.spawnbroken.blue} to true
  192. loop all players:
  193. {kfsb.ingame::%loop-player%} is set
  194. set {_temp.%loop-player%} to yaml value "chat-diedwithspawnblock-red" from {kfsb.lang.%loop-player%}
  195. replace every "{player}" with kfsbGetUsername({_player}) in {_temp.%loop-player%}
  196. send {_temp.%loop-player%} to loop-player
  197. {kfsb.team::%loop-player%} is "blue"
  198. send title yaml value "title-spawn-has-lost" from {kfsb.lang.%loop-player%} with subtitle yaml value "title-spawn-destroyed-sub" from {kfsb.lang.%loop-player%} to loop-player for 4 seconds and 0 ticks and 0 ticks
  199. play "ENTITY_ENDERDRAGON_GROWL" to loop-player at volume 10 at pitch 5
  200. if {kfsb.redalive::%{_player}%} is set:
  201. delete {kfsb.redalive::%{_player}%}
  202. if {kfsb.bluealive::%{_player}%} is set:
  203. delete {kfsb.bluealive::%{_player}%}
  204. if {kfsb.noSetSpectator.%{_player}%} is not set:
  205. kfsbSetSpectator({_player}, true)
  206. else:
  207. delete {kfsb.noSetSpectator.%{_player}%}
  208.  
  209. function kfsbResetGame():
  210. delete {kfsb.status}
  211. loop {kfsb.redalive::*}:
  212. delete {kfsb.redalive::%loop-index%}
  213. loop {kfsb.bluealive::*}:
  214. delete {kfsb.bluealive::%loop-index%}
  215. loop {kfsb.kills::*}:
  216. delete {kfsb.kills::%loop-index%}
  217. loop {kfsb.team::*}:
  218. delete {kfsb.team::%loop-index%}
  219. loop {kfsb.playerstatus::*}:
  220. delete {kfsb.playerstatus::%loop-index%}
  221. loop {kfsb.isSpectator::*}:
  222. delete {kfsb.isSpectator::%loop-index%}
  223. loop {kfsb.lastteam::*}:
  224. delete {kfsb.lastteam::%loop-index%}
  225. loop {kfsb.lastvotedmap::*}:
  226. delete {kfsb.lastvotedmap::%loop-index%}
  227. loop {kfsb.map::*}:
  228. loop {kfsb.votes.%loop-value%::*}:
  229. delete {kfsb.votes.%loop-value-1%::%loop-index-2%}
  230. loop all players:
  231. {kfsb.ingame::%loop-player%} is set
  232. kfsbDeleteHologram(loop-player)
  233. clear potion effects of loop-player
  234. reveal loop-player to all players
  235. teleport loop-player to {kfsb.lobby}
  236. set loop-player's health to 10
  237. set loop-player's max health to 10
  238. set loop-player's health to 10
  239. set loop-player's hunger to 10
  240. set loop-player's level to 0
  241. set loop-player's level progress to 0
  242. set loop-player's saturation to 10
  243. set loop-player's health to 10
  244. clear potion effects of loop-player
  245. clear inventory of loop-player
  246. set {_temp.%loop-player%} to yaml value "item-vote-name" from {kfsb.lang.%loop-player%}
  247. set {_itemname.%loop-player%} to "%{_temp.%loop-player%}%&1&2&3&4&e&o"
  248. set slot 4 of loop-player's inventory to emerald named {_itemname.%loop-player%} with lore yaml value "item-vote-lore" from {kfsb.lang.%loop-player%}
  249. loop-player.setAllowFlight(false)
  250. loop-player.setFlying(false)
  251. delete {kfsb.noSetSpectator.%loop-player%}
  252. delete {kfsb.startCountDown}
  253. delete {kfsb.spawnmoving.red}
  254. delete {kfsb.spawnmoving.blue}
  255. delete {kfsb.spawnbroken.red}
  256. delete {kfsb.spawnbroken.blue}
  257.  
  258. function kfsbResetStatus():
  259. delete {kfsb.status}
  260. loop {kfsb.redalive::*}:
  261. delete {kfsb.redalive::%loop-index%}
  262. loop {kfsb.bluealive::*}:
  263. delete {kfsb.bluealive::%loop-index%}
  264. loop {kfsb.kills::*}:
  265. delete {kfsb.kills::%loop-index%}
  266. loop {kfsb.team::*}:
  267. delete {kfsb.team::%loop-index%}
  268. loop {kfsb.playerstatus::*}:
  269. delete {kfsb.playerstatus::%loop-index%}
  270. loop {kfsb.isSpectator::*}:
  271. delete {kfsb.isSpectator::%loop-index%}
  272. loop {kfsb.lastteam::*}:
  273. delete {kfsb.lastteam::%loop-index%}
  274. loop {kfsb.lastvotedmap::*}:
  275. delete {kfsb.lastvotedmap::%loop-index%}
  276. loop {kfsb.map::*}:
  277. loop {kfsb.votes.%loop-value%::*}:
  278. delete {kfsb.votes.%loop-value-1%::%loop-index-2%}
  279. loop all players:
  280. {kfsb.ingame::%loop-player%} is set
  281. kfsbDeleteHologram(loop-player)
  282. reveal loop-player to all players
  283. clear potion effects of loop-player
  284. loop-player.setAllowFlight(false)
  285. loop-player.setFlying(false)
  286. delete {kfsb.noSetSpectator.%loop-player%}
  287. loop {kfsb.ingame::*}:
  288. delete {kfsb.ingame::%loop-index%}
  289. delete {kfsb.startCountDown}
  290. delete {kfsb.spawnmoving.red}
  291. delete {kfsb.spawnmoving.blue}
  292. delete {kfsb.spawnbroken.red}
  293. delete {kfsb.spawnbroken.blue}
  294.  
  295. function kfsbOpenMapVoteGui(player: player):
  296. loop {kfsb.map::*}:
  297. delete {kfsb.validmap::%loop-index%}
  298. {kfsb.location::%loop-index%::redspawn} is set
  299. {kfsb.location::%loop-index%::bluespawn} is set
  300. {kfsb.location::%loop-index%::pos1} is set
  301. {kfsb.location::%loop-index%::pos2} is set
  302. set {kfsb.validmap::%loop-index%} to loop-value
  303. set {_row} to ceil((size of {kfsb.validmap::*} + 1 ) / 9) + 1
  304. if {_player} doesn't have a gui:
  305. set {_temp} to yaml value "gui-mapvote-title" from {kfsb.lang.%{_player}%}
  306. set {_guiname} to "%{_temp}%&1&2&3&4&e&o"
  307. open chest with {_row} row named {_guiname} to {_player}
  308. inventory name of {_player}'s current inventory contains "&1&2&3&4&e&o"
  309. create a gui slot 4 of {_player} with barrier named yaml value "item-gui-close-name" from {kfsb.lang.%{_player}%} to close
  310. set {_temp} to yaml value "gui-clicktoselect" from {kfsb.lang.%{_player}%}
  311. create a gui slot 9 of {_player} with paper named yaml value "item-gui-novote-name" from {kfsb.lang.%{_player}%} with lore "||%{_temp}%" to run {_player} command "spherebattle vote"
  312. set {_slot} to 10
  313. loop {kfsb.validmap::*}:
  314. if {kfsb.votes.%loop-value%::%{_player}%} is set:
  315. set {_temp} to yaml value "gui-currentvotes" from {kfsb.lang.%{_player}%}
  316. replace every "{votes}" with "%size of {kfsb.votes.%loop-value%::*}%" in {_temp}
  317. set {_temp2} to yaml value "gui-alreadyvoted" from {kfsb.lang.%{_player}%}
  318. create a gui slot {_slot} of {_player} with glowing map named "&a&l%loop-value%" with lore "%{_temp2}%||||%{_temp}%"
  319. else:
  320. set {_temp} to yaml value "gui-clicktovote" from {kfsb.lang.%{_player}%}
  321. set {_temp2} to yaml value "gui-currentvotes" from {kfsb.lang.%{_player}%}
  322. replace every "{votes}" with "%size of {kfsb.votes.%loop-value%::*}%" in {_temp2}
  323. create a gui slot {_slot} of {_player} with map named "&a&l%loop-value%" with lore "||%{_temp2}%||%{_temp}%" to run {_player} command "spherebattle vote %loop-value%"
  324. add 1 to {_slot}
  325.  
  326. function kfsbClearScoreboard(player: player):
  327. {kfsb.ingame::%{_player}%} is set
  328. set {_slot} to 1
  329. loop 15 times:
  330. delete id based score "kfsbLine%{_slot}%.%{_player}%" from stylish scoreboard "kfsbScoreboard-%{_player}%"
  331. add 1 to {_slot}
  332.  
  333. function kfsbUpdateScoreboard(player: player):
  334. {kfsb.ingame::%{_player}%} is set
  335. set the title of stylish scoreboard "kfsbScoreboard-%{_player}%" to yaml value "scoreboard-title" from {kfsb.lang.%{_player}%}
  336. if {kfsb.playerstatus::%{_player}%} is not set:
  337. if {kfsb.lastScoreboard.%{_player}%} is not "waiting":
  338. set {kfsb.lastScoreboard.%{_player}%} to "waiting"
  339. kfsbClearScoreboard({_player})
  340. if {kfsb.startCountDown} is set:
  341. create a new id based score "kfsbLine1.%{_player}%" with text yaml value "scoreboard-website" from {kfsb.lang.%{_player}%} slot 1 for stylish scoreboard "kfsbScoreboard-%{_player}%"
  342. create a new id based score "kfsbLine2.%{_player}%" with text "&r" slot 2 for stylish scoreboard "kfsbScoreboard-%{_player}%"
  343. set {_temp} to yaml value "scoreboard-starting" from {kfsb.lang.%{_player}%}
  344. replace every "{seconds}" with "%{kfsb.startCountDown}%" in {_temp}
  345. create a new id based score "kfsbLine3.%{_player}%" with text {_temp} slot 3 for stylish scoreboard "kfsbScoreboard-%{_player}%"
  346. create a new id based score "kfsbLine4.%{_player}%" with text "&r&r" slot 4 for stylish scoreboard "kfsbScoreboard-%{_player}%"
  347. set {_temp} to yaml value "scoreboard-players" from {kfsb.lang.%{_player}%}
  348. replace every "{players}" with "%size of {kfsb.ingame::*}%" in {_temp}
  349. create a new id based score "kfsbLine5.%{_player}%" with text {_temp} slot 5 for stylish scoreboard "kfsbScoreboard-%{_player}%"
  350. create a new id based score "kfsbLine6.%{_player}%" with text "&r&r&r" slot 6 for stylish scoreboard "kfsbScoreboard-%{_player}%"
  351. else:
  352. create a new id based score "kfsbLine1.%{_player}%" with text yaml value "scoreboard-website" from {kfsb.lang.%{_player}%} slot 1 for stylish scoreboard "kfsbScoreboard-%{_player}%"
  353. create a new id based score "kfsbLine2.%{_player}%" with text "&r" slot 2 for stylish scoreboard "kfsbScoreboard-%{_player}%"
  354. create a new id based score "kfsbLine3.%{_player}%" with text yaml value "scoreboard-waiting" from {kfsb.lang.%{_player}%} slot 3 for stylish scoreboard "kfsbScoreboard-%{_player}%"
  355. create a new id based score "kfsbLine4.%{_player}%" with text "&r&r" slot 4 for stylish scoreboard "kfsbScoreboard-%{_player}%"
  356. set {_temp} to yaml value "scoreboard-players" from {kfsb.lang.%{_player}%}
  357. replace every "{players}" with "%size of {kfsb.ingame::*}%" in {_temp}
  358. create a new id based score "kfsbLine5.%{_player}%" with text {_temp} slot 5 for stylish scoreboard "kfsbScoreboard-%{_player}%"
  359. create a new id based score "kfsbLine6.%{_player}%" with text "&r&r&r" slot 6 for stylish scoreboard "kfsbScoreboard-%{_player}%"
  360. else:
  361. if {kfsb.startCountDown} is set:
  362. set name of id based score "kfsbLine1.%{_player}%" to yaml value "scoreboard-website" from {kfsb.lang.%{_player}%}
  363. set name of id based score "kfsbLine2.%{_player}%" to "&r"
  364. set {_temp} to yaml value "scoreboard-starting" from {kfsb.lang.%{_player}%}
  365. replace every "{seconds}" with "%{kfsb.startCountDown}%" in {_temp}
  366. set name of id based score "kfsbLine3.%{_player}%" to {_temp}
  367. set name of id based score "kfsbLine4.%{_player}%" to "&r&r"
  368. set {_temp} to yaml value "scoreboard-players" from {kfsb.lang.%{_player}%}
  369. replace every "{players}" with "%size of {kfsb.ingame::*}%" in {_temp}
  370. set name of id based score "kfsbLine5.%{_player}%" to {_temp}
  371. set name of id based score "kfsbLine6.%{_player}%" to "&r&r&r"
  372. else:
  373. set name of id based score "kfsbLine1.%{_player}%" to yaml value "scoreboard-website" from {kfsb.lang.%{_player}%}
  374. set name of id based score "kfsbLine2.%{_player}%" to "&r"
  375. set name of id based score "kfsbLine3.%{_player}%" to yaml value "scoreboard-waiting" from {kfsb.lang.%{_player}%}
  376. set name of id based score "kfsbLine4.%{_player}%" to "&r&r"
  377. set {_temp} to yaml value "scoreboard-players" from {kfsb.lang.%{_player}%}
  378. replace every "{players}" with "%size of {kfsb.ingame::*}%" in {_temp}
  379. set name of id based score "kfsbLine5.%{_player}%" to {_temp}
  380. set name of id based score "kfsbLine6.%{_player}%" to "&r&r&r"
  381. else if {kfsb.playerstatus::%{_player}%} is "ingame" or "ending":
  382. if {kfsb.lastScoreboard.%{_player}%} is not "ingame":
  383. set {kfsb.lastScoreboard.%{_player}%} to "ingame"
  384. kfsbClearScoreboard({_player})
  385. create a new id based score "kfsbLine1.%{_player}%" with text yaml value "scoreboard-website" from {kfsb.lang.%{_player}%} slot 1 for stylish scoreboard "kfsbScoreboard-%{_player}%"
  386. create a new id based score "kfsbLine2.%{_player}%" with text "&r" slot 2 for stylish scoreboard "kfsbScoreboard-%{_player}%"
  387. set {_temp} to yaml value "scoreboard-kills" from {kfsb.lang.%{_player}%}
  388. replace every "{kills}" with "%{kfsb.kills::%{_player}%}%" in {_temp}
  389. create a new id based score "kfsbLine3.%{_player}%" with text {_temp} slot 3 for stylish scoreboard "kfsbScoreboard-%{_player}%"
  390. create a new id based score "kfsbLine4.%{_player}%" with text "&r&r" slot 4 for stylish scoreboard "kfsbScoreboard-%{_player}%"
  391. if {kfsb.team::%{_player}%} is "red":
  392. set {_you} to yaml value "scoreboard-team-you" from {kfsb.lang.%{_player}%}
  393. set {_temp} to yaml value "scoreboard-blue" from {kfsb.lang.%{_player}%}
  394. replace every "{status}" with "%{kfsb.bluestatus}%" in {_temp}
  395. create a new id based score "kfsbLine5.%{_player}%" with text {_temp} slot 5 for stylish scoreboard "kfsbScoreboard-%{_player}%"
  396. set {_temp} to yaml value "scoreboard-red" from {kfsb.lang.%{_player}%}
  397. replace every "{status}" with "%{kfsb.redstatus}%" in {_temp}
  398. create a new id based score "kfsbLine6.%{_player}%" with text "%{_temp}% %{_you}%" slot 6 for stylish scoreboard "kfsbScoreboard-%{_player}%"
  399. else if {kfsb.team::%{_player}%} is "blue":
  400. set {_you} to yaml value "scoreboard-team-you" from {kfsb.lang.%{_player}%}
  401. set {_temp} to yaml value "scoreboard-blue" from {kfsb.lang.%{_player}%}
  402. replace every "{status}" with "%{kfsb.bluestatus}%" in {_temp}
  403. create a new id based score "kfsbLine5.%{_player}%" with text "%{_temp}% %{_you}%" slot 5 for stylish scoreboard "kfsbScoreboard-%{_player}%"
  404. set {_temp} to yaml value "scoreboard-red" from {kfsb.lang.%{_player}%}
  405. replace every "{status}" with "%{kfsb.redstatus}%" in {_temp}
  406. create a new id based score "kfsbLine6.%{_player}%" with text {_temp} slot 6 for stylish scoreboard "kfsbScoreboard-%{_player}%"
  407. else:
  408. set {_temp} to yaml value "scoreboard-blue" from {kfsb.lang.%{_player}%}
  409. replace every "{status}" with "%{kfsb.bluestatus}%" in {_temp}
  410. create a new id based score "kfsbLine5.%{_player}%" with text {_temp} slot 5 for stylish scoreboard "kfsbScoreboard-%{_player}%"
  411. set {_temp} to yaml value "scoreboard-red" from {kfsb.lang.%{_player}%}
  412. replace every "{status}" with "%{kfsb.redstatus}%" in {_temp}
  413. create a new id based score "kfsbLine6.%{_player}%" with text {_temp} slot 6 for stylish scoreboard "kfsbScoreboard-%{_player}%"
  414. create a new id based score "kfsbLine7.%{_player}%" with text "&r&r&r" slot 7 for stylish scoreboard "kfsbScoreboard-%{_player}%"
  415. set {_temp} to yaml value "scoreboard-players" from {kfsb.lang.%{_player}%}
  416. replace every "{players}" with "%size of {kfsb.ingame::*}%" in {_temp}
  417. create a new id based score "kfsbLine8.%{_player}%" with text {_temp} slot 8 for stylish scoreboard "kfsbScoreboard-%{_player}%"
  418. set {_temp} to yaml value "scoreboard-map" from {kfsb.lang.%{_player}%}
  419. replace every "{map}" with "%{kfsb.selectedMap}%" in {_temp}
  420. create a new id based score "kfsbLine9.%{_player}%" with text {_temp} slot 9 for stylish scoreboard "kfsbScoreboard-%{_player}%"
  421. create a new id based score "kfsbLine10.%{_player}%" with text "&r&r&r&r" slot 10 for stylish scoreboard "kfsbScoreboard-%{_player}%"
  422. else:
  423. set name of id based score "kfsbLine1.%{_player}%" to yaml value "scoreboard-website" from {kfsb.lang.%{_player}%}
  424. set name of id based score "kfsbLine2.%{_player}%" to "&r"
  425. set {_temp} to yaml value "scoreboard-kills" from {kfsb.lang.%{_player}%}
  426. replace every "{kills}" with "%{kfsb.kills::%{_player}%}%" in {_temp}
  427. set name of id based score "kfsbLine3.%{_player}%" to {_temp}
  428. set name of id based score "kfsbLine4.%{_player}%" to "&r&r"
  429. if {kfsb.team::%{_player}%} is "red":
  430. set {_you} to yaml value "scoreboard-team-you" from {kfsb.lang.%{_player}%}
  431. set {_temp} to yaml value "scoreboard-blue" from {kfsb.lang.%{_player}%}
  432. replace every "{status}" with "%{kfsb.bluestatus}%" in {_temp}
  433. set name of id based score "kfsbLine5.%{_player}%" to {_temp}
  434. set {_temp} to yaml value "scoreboard-red" from {kfsb.lang.%{_player}%}
  435. replace every "{status}" with "%{kfsb.redstatus}%" in {_temp}
  436. set name of id based score "kfsbLine6.%{_player}%" to "%{_temp}% %{_you}%"
  437. else if {kfsb.team::%{_player}%} is "blue":
  438. set {_you} to yaml value "scoreboard-team-you" from {kfsb.lang.%{_player}%}
  439. set {_temp} to yaml value "scoreboard-blue" from {kfsb.lang.%{_player}%}
  440. replace every "{status}" with "%{kfsb.bluestatus}%" in {_temp}
  441. set name of id based score "kfsbLine5.%{_player}%" to "%{_temp}% %{_you}%"
  442. set {_temp} to yaml value "scoreboard-red" from {kfsb.lang.%{_player}%}
  443. replace every "{status}" with "%{kfsb.redstatus}%" in {_temp}
  444. set name of id based score "kfsbLine6.%{_player}%" to {_temp}
  445. else:
  446. set {_temp} to yaml value "scoreboard-blue" from {kfsb.lang.%{_player}%}
  447. replace every "{status}" with "%{kfsb.bluestatus}%" in {_temp}
  448. set name of id based score "kfsbLine5.%{_player}%" to {_temp}
  449. set {_temp} to yaml value "scoreboard-red" from {kfsb.lang.%{_player}%}
  450. replace every "{status}" with "%{kfsb.redstatus}%" in {_temp}
  451. set name of id based score "kfsbLine6.%{_player}%" to {_temp}
  452. set name of id based score "kfsbLine7.%{_player}%" to "&r&r&r"
  453. set {_temp} to yaml value "scoreboard-players" from {kfsb.lang.%{_player}%}
  454. replace every "{players}" with "%size of {kfsb.ingame::*}%" in {_temp}
  455. set name of id based score "kfsbLine8.%{_player}%" to {_temp}
  456. set {_temp} to yaml value "scoreboard-map" from {kfsb.lang.%{_player}%}
  457. replace every "{map}" with "%{kfsb.selectedMap}%" in {_temp}
  458. set name of id based score "kfsbLine9.%{_player}%" to {_temp}
  459. set name of id based score "kfsbLine10.%{_player}%" to "&r&r&r&r"
  460.  
  461. function kfsbJoinGame(player: player):
  462. if {kfsb.ingame::%{_player}%} is not set:
  463. set {kfsb.ingame::%{_player}%} to true
  464. set {kfsb.savedinfo::%{_player}%::location} to location of {_player}
  465. set {kfsb.savedinfo::%{_player}%::maxhealth} to max health of {_player}
  466. set {kfsb.savedinfo::%{_player}%::saturation} to saturation of {_player}
  467. set {kfsb.savedinfo::%{_player}%::currenthealth} to health of {_player}
  468. set {kfsb.savedinfo::%{_player}%::hunger} to hunger of {_player}
  469. set {kfsb.savedinfo::%{_player}%::gamemode} to gamemode of {_player}
  470. teleport {_player} to {kfsb.lobby}
  471. set max health of {_player} to 10
  472. set saturation of {_player} to 10
  473. set health of {_player} to 10
  474. set hunger of {_player} to 10
  475. set gamemode of {_player} to adventure
  476. set {_count} to 0
  477. loop all active potions on {_player}:
  478. set {kfsb.savedinfo::%{_player}%::potion::%{_count}%} to loop-value
  479. add 1 to {_count}
  480. clear potion effects of {_player}
  481. set {_count} to 0
  482. loop 41 times:
  483. set {_call} to slot {_count} of {_player}'s inventory
  484. set {kfsb.savedinfo::%{_player}%::inventory::%{_count}%} to {_call}
  485. set slot {_count} of {_player}'s inventory to air
  486. add 1 to {_count}
  487. set {_temp} to yaml value "item-vote-name" from {kfsb.lang.%{_player}%}
  488. set {_itemname} to "%{_temp}%&1&2&3&4&e&o"
  489. set slot 4 of {_player}'s inventory to emerald named {_itemname} with lore yaml value "item-vote-lore" from {kfsb.lang.%{_player}%}
  490. set {_temp} to yaml value "item-returntolobby-name" from {kfsb.lang.%{_player}%}
  491. set {_itemname} to "%{_temp}%&1&2&3&4&r&2&l"
  492. delete {kfsb.lastScoreboard.%{_player}%}
  493. create a new stylish scoreboard "kfsbScoreboard-%{_player}%"
  494. set {_player}'s stylish scoreboard to "kfsbScoreboard-%{_player}%"
  495. kfsbUpdateScoreboard({_player})
  496. if {kfsb.status} is not set:
  497. loop all players:
  498. {kfsb.ingame::%loop-player%} is set
  499. set {_temp.%loop-player%} to yaml value "chat-joined-lobby" from {kfsb.lang.%loop-player%}
  500. replace every "{playername}" with "%{_player}%" in {_temp.%loop-player%}
  501. send {_temp.%loop-player%} to loop-player
  502. else if {kfsb.status} is "ending":
  503. loop all players:
  504. {kfsb.ingame::%loop-player%} is set
  505. set {_temp.%loop-player%} to yaml value "chat-joined-lobby" from {kfsb.lang.%loop-player%}
  506. replace every "{playername}" with "%{_player}%" in {_temp.%loop-player%}
  507. send {_temp.%loop-player%} to loop-player
  508. else if {kfsb.status} is "ingame":
  509. if {kfsb.isSpectator::%{_player}%} is set:
  510. loop all players:
  511. {kfsb.ingame::%loop-player%} is set
  512. set {_temp.%loop-player%} to yaml value "chat-joined-lobby" from {kfsb.lang.%loop-player%}
  513. replace every "{playername}" with "%{_player}%" in {_temp.%loop-player%}
  514. send {_temp.%loop-player%} to loop-player
  515. else if {kfsb.lastteam::%{_player}%} is set:
  516. set {kfsb.team::%{_player}%} to {kfsb.lastteam::%{_player}%}
  517. delete {kfsb.lastteam::%{_player}%}
  518. if {kfsb.spawnbroken.%{kfsb.team::%{_player}%}%} is true:
  519. delete {kfsb.team::%{_player}%}
  520. loop all players:
  521. {kfsb.ingame::%loop-player%} is set
  522. set {_temp.%loop-player%} to yaml value "chat-joined-lobby" from {kfsb.lang.%loop-player%}
  523. replace every "{playername}" with "%{_player}%" in {_temp.%loop-player%}
  524. send {_temp.%loop-player%} to loop-player
  525. stop
  526. else if {kfsb.spawnmoving.%{kfsb.team::%{_player}%}%} is true:
  527. delete {kfsb.team::%{_player}%}
  528. loop all players:
  529. {kfsb.ingame::%loop-player%} is set
  530. set {_temp.%loop-player%} to yaml value "chat-joined-lobby" from {kfsb.lang.%loop-player%}
  531. replace every "{playername}" with "%{_player}%" in {_temp.%loop-player%}
  532. send {_temp.%loop-player%} to loop-player
  533. stop
  534. else:
  535. set {kfsb.playerstatus::%{_player}%} to "ingame"
  536. delete {kfsb.lastScoreboard.%{_player}%}
  537. create a new stylish scoreboard "kfsbScoreboard-%{_player}%"
  538. set {_player}'s stylish scoreboard to "kfsbScoreboard-%{_player}%"
  539. kfsbUpdateScoreboard({_player})
  540. set {_player}'s health to 10
  541. set {_player}'s max health to 10
  542. set {_player}'s health to 10
  543. set {_player}'s hunger to 10
  544. set {_player}'s level to 0
  545. set {_player}'s level progress to 0
  546. set {_player}'s saturation to 10
  547. set {_player}'s health to 10
  548. set {kfsb.playerstatus::%{_player}%} to "ingame"
  549. if {kfsb.kills::%{_player}%} is not set:
  550. set {kfsb.kills::%{_player}%} to 0
  551. set {kfsb.playerstatus::%{_player}%} to "ingame"
  552. clear {_player}'s inventory
  553. clear potion effects of {_player}
  554. kfsbSetFacing({_player}, "%{kfsb.%{kfsb.team::%{_player}%}%facing.%{kfsb.selectedMap}%}%", location 1 meter above {kfsb.mapdata.%{kfsb.team::%{_player}%}%spawn})
  555. set {kfsb.%{kfsb.team::%{_player}%}%alive::%{_player}%} to {_player}
  556. if {kfsb.team::%{_player}%} is "red":
  557. loop all players:
  558. {kfsb.ingame::%loop-player%} is set
  559. set {_temp.%loop-player%} to yaml value "chat-joined-as-red" from {kfsb.lang.%loop-player%}
  560. replace every "{playername}" with "%{_player}%" in {_temp.%loop-player%}
  561. send {_temp.%loop-player%} to loop-player
  562. else:
  563. loop all players:
  564. {kfsb.ingame::%loop-player%} is set
  565. set {_temp.%loop-player%} to yaml value "chat-joined-as-blue" from {kfsb.lang.%loop-player%}
  566. replace every "{playername}" with "%{_player}%" in {_temp.%loop-player%}
  567. send {_temp.%loop-player%} to loop-player
  568. wait 4 ticks
  569. delete {kfsb.nodeathaction.%{_player}%}
  570. else:
  571. set {kfsb.team::%{_player}%} to {kfsb.nextjointeam}
  572. delete {kfsb.lastteam::%{_player}%}
  573. if {kfsb.spawnbroken.%{kfsb.team::%{_player}%}%} is true:
  574. delete {kfsb.team::%{_player}%}
  575. loop all players:
  576. {kfsb.ingame::%loop-player%} is set
  577. set {_temp.%loop-player%} to yaml value "chat-joined-lobby" from {kfsb.lang.%loop-player%}
  578. replace every "{playername}" with "%{_player}%" in {_temp.%loop-player%}
  579. send {_temp.%loop-player%} to loop-player
  580. stop
  581. else if {kfsb.spawnmoving.%{kfsb.team::%{_player}%}%} is true:
  582. delete {kfsb.team::%{_player}%}
  583. loop all players:
  584. {kfsb.ingame::%loop-player%} is set
  585. set {_temp.%loop-player%} to yaml value "chat-joined-lobby" from {kfsb.lang.%loop-player%}
  586. replace every "{playername}" with "%{_player}%" in {_temp.%loop-player%}
  587. send {_temp.%loop-player%} to loop-player
  588. stop
  589. else:
  590. set {kfsb.playerstatus::%{_player}%} to "ingame"
  591. delete {kfsb.lastScoreboard.%{_player}%}
  592. create a new stylish scoreboard "kfsbScoreboard-%{_player}%"
  593. set {_player}'s stylish scoreboard to "kfsbScoreboard-%{_player}%"
  594. kfsbUpdateScoreboard({_player})
  595. set {_player}'s health to 10
  596. set {_player}'s max health to 10
  597. set {_player}'s health to 10
  598. set {_player}'s hunger to 10
  599. set {_player}'s level to 0
  600. set {_player}'s level progress to 0
  601. set {_player}'s saturation to 10
  602. set {_player}'s health to 10
  603. if {kfsb.kills::%{_player}%} is not set:
  604. set {kfsb.kills::%{_player}%} to 0
  605. set {kfsb.playerstatus::%{_player}%} to "ingame"
  606. clear {_player}'s inventory
  607. clear potion effects of {_player}
  608. kfsbSetFacing({_player}, "%{kfsb.%{kfsb.team::%{_player}%}%facing.%{kfsb.selectedMap}%}%", location 1 meter above {kfsb.mapdata.%{kfsb.team::%{_player}%}%spawn})
  609. set {kfsb.%{kfsb.team::%{_player}%}%alive::%{_player}%} to {_player}
  610. if {kfsb.nextjointeam} is "red":
  611. set {kfsb.nextjointeam} to "blue"
  612. else if {kfsb.nextjointeam} is "blue":
  613. set {kfsb.nextjointeam} to "red"
  614. if {kfsb.team::%{_player}%} is "red":
  615. loop all players:
  616. {kfsb.ingame::%loop-player%} is set
  617. set {_temp.%loop-player%} to yaml value "chat-joined-as-red" from {kfsb.lang.%loop-player%}
  618. replace every "{playername}" with "%{_player}%" in {_temp.%loop-player%}
  619. send {_temp.%loop-player%} to loop-player
  620. else:
  621. loop all players:
  622. {kfsb.ingame::%loop-player%} is set
  623. set {_temp.%loop-player%} to yaml value "chat-joined-as-blue" from {kfsb.lang.%loop-player%}
  624. replace every "{playername}" with "%{_player}%" in {_temp.%loop-player%}
  625. send {_temp.%loop-player%} to loop-player
  626. wait 4 ticks
  627. delete {kfsb.nodeathaction.%{_player}%}
  628. else:
  629. send yaml value "command-join-already" from {kfsb.lang.%{_player}%} to {_player}
  630.  
  631. function kfsbLeaveGame(player: player):
  632. if {kfsb.ingame::%{_player}%} is set:
  633. loop all players:
  634. {kfsb.ingame::%loop-player%} is set
  635. set {_temp.%loop-player%} to yaml value "chat-left" from {kfsb.lang.%loop-player%}
  636. replace every "{playername}" with "%{_player}%" in {_temp.%loop-player%}
  637. send {_temp.%loop-player%} to loop-player
  638. delete {kfsb.ingame::%{_player}%}
  639. if size of {kfsb.ingame::*} is smaller than {@NeededPlayersToStart}:
  640. {kfsb.startCountDown} is set
  641. {kfsb.status} is not set
  642. loop all players:
  643. {kfsb.ingame::%loop-player%} is set
  644. send yaml value "chat-start-cancelled" from {kfsb.lang.%loop-player%} to loop-player
  645. send title yaml value "title-start-cancelled" from {kfsb.lang.%loop-player%} with subtitle "" to loop-player for 3 seconds and 0 ticks and 0 ticks
  646. play sound "UI_BUTTON_CLICK" to loop-player at volume 10 at pitch 5
  647. delete {kfsb.startCountDown}
  648. teleport {_player} to {kfsb.savedinfo::%{_player}%::location}
  649. set {kfsb.lastteam::%{_player}%} to {kfsb.team::%{_player}%}
  650. set {kfsb.noSetSpectator.%{_player}%} to true
  651. kfsbDeathEvent({_player})
  652. set max health of {_player} to {kfsb.savedinfo::%{_player}%::maxhealth}
  653. set saturation of {_player} to {kfsb.savedinfo::%{_player}%::saturation}
  654. set health of {_player} to {kfsb.savedinfo::%{_player}%::currenthealth}
  655. set hunger of {_player} to {kfsb.savedinfo::%{_player}%::hunger}
  656. set gamemode of {_player} to {kfsb.savedinfo::%{_player}%::gamemode}
  657. delete {kfsb.respawnCountdown.%{_player}%}
  658. delete {kfsb.lastScoreboard.%{_player}%}
  659. delete {kfsb.votes.%{kfsb.lastvotedmap::%{_player}%}%::%{_player}%}
  660. delete {kfsb.savedinfo::%{_player}%::location}
  661. delete {kfsb.savedinfo::%{_player}%::maxhealth}
  662. delete {kfsb.savedinfo::%{_player}%::saturation}
  663. delete {kfsb.savedinfo::%{_player}%::currenthealth}
  664. delete {kfsb.savedinfo::%{_player}%::hunger}
  665. delete {kfsb.savedinfo::%{_player}%::gamemode}
  666. delete {kfsb.team::%{_player}%}
  667. delete {kfsb.respawnCountdown.%{_player}%}
  668. delete stylish scoreboard "kfsbScoreboard-%{_player}%"
  669. kfsbDeleteHologram({_player})
  670. reveal {_player} to all players
  671. set {_count} to 0
  672. loop {kfsb.savedinfo::%{_player}%::potion::*}:
  673. delete {kfsb.savedinfo::%{_player}%::potion::%{_count}%}
  674. add 1 to {_count}
  675. set {_count} to 0
  676. loop 41 times:
  677. set slot {_count} of {_player}'s inventory to {kfsb.savedinfo::%{_player}%::inventory::%{_count}%}
  678. delete {kfsb.savedinfo::%{_player}%::inventory::%{_count}%}
  679. add 1 to {_count}
  680. else:
  681. send yaml value "command-leave-notin" from {kfsb.lang.%{_player}%} to {_player}
  682.  
  683. on script load:
  684. if file "plugins/Skript/scripts/SphereBattle/lang/{@DefaultLanguage}.yml" doesn't exist:
  685. create file "plugins/Skript/scripts/SphereBattle/lang/{@DefaultLanguage}.yml"
  686. load yaml "plugins/Skript/scripts/SphereBattle/lang/{@DefaultLanguage}.yml" as "{@DefaultLanguage}"
  687. set skript-yaml value "hello" from "{@DefaultLanguage}" to "I'm sorry, but there was something wrong in the installation of this Skript..."
  688. save yaml "{@DefaultLanguage}"
  689. loop {kfsb.langlist::*}:
  690. delete {kfsb.langlist::%loop-index%}
  691. loop directory "plugins/Skript/scripts/SphereBattle/lang/"'s files:
  692. if loop-string.endsWith(".yml") is true:
  693. set {_temp} to relative path of loop-string
  694. set {_temp2} to {_temp}
  695. replace every ".yml" with "" in {_temp}
  696. replace every "plugins/Skript/scripts/SphereBattle/lang/" with "" in {_temp}
  697. replace every "plugins\Skript\scripts\SphereBattle\lang\" with "" in {_temp}
  698. load yaml "%{_temp2}%" as "%{_temp}%"
  699. set {kfsb.langlist::%{_temp}%} to {_temp}
  700.  
  701. every 5 ticks:
  702. if size of {kfsb.ingame::*} >= {@NeededPlayersToStart}:
  703. if {kfsb.startCountDown} is not set:
  704. {kfsb.status} is not set
  705. set {kfsb.startCountDown} to {@StartingCountdownTime}
  706. while {kfsb.startCountDown} > 0:
  707. if {kfsb.startCountDown} >= 30:
  708. if {kfsb.startCountDown} is {@StartingCountdownTime}:
  709. loop all players:
  710. {kfsb.ingame::%loop-player%} is set
  711. play "BLOCK_NOTE_HAT" to loop-player at volume 10 at pitch 5
  712. set {_temp.%loop-player%} to yaml value "chat-starting-1" from {kfsb.lang.%loop-player%}
  713. replace every "{seconds}" with "%{kfsb.startCountDown}%" in {_temp.%loop-player%}
  714. send {_temp.%loop-player%} to loop-player
  715. else if "%{kfsb.startCountDown}%".endsWith("0") is true:
  716. loop all players:
  717. {kfsb.ingame::%loop-player%} is set
  718. play "BLOCK_NOTE_HAT" to loop-player at volume 10 at pitch 5
  719. set {_temp.%loop-player%} to yaml value "chat-starting-1" from {kfsb.lang.%loop-player%}
  720. replace every "{seconds}" with "%{kfsb.startCountDown}%" in {_temp.%loop-player%}
  721. send {_temp.%loop-player%} to loop-player
  722. else if {kfsb.startCountDown} >= 20:
  723. if {kfsb.startCountDown} is {@StartingCountdownTime}:
  724. loop all players:
  725. play "BLOCK_NOTE_HAT" to loop-player at volume 10 at pitch 5
  726. set {_temp.%loop-player%} to yaml value "chat-starting-2" from {kfsb.lang.%loop-player%}
  727. replace every "{seconds}" with "%{kfsb.startCountDown}%" in {_temp.%loop-player%}
  728. send {_temp.%loop-player%} to loop-player
  729. else if "%{kfsb.startCountDown}%".endsWith("0") is true:
  730. loop all players:
  731. {kfsb.ingame::%loop-player%} is set
  732. play "BLOCK_NOTE_HAT" to loop-player at volume 10 at pitch 5
  733. set {_temp.%loop-player%} to yaml value "chat-starting-2" from {kfsb.lang.%loop-player%}
  734. replace every "{seconds}" with "%{kfsb.startCountDown}%" in {_temp.%loop-player%}
  735. send {_temp.%loop-player%} to loop-player
  736. else if {kfsb.startCountDown} >= 10:
  737. if {kfsb.startCountDown} is {@StartingCountdownTime}:
  738. loop all players:
  739. play "BLOCK_NOTE_HAT" to loop-player at volume 10 at pitch 5
  740. set {_temp.%loop-player%} to yaml value "chat-starting-3" from {kfsb.lang.%loop-player%}
  741. replace every "{seconds}" with "%{kfsb.startCountDown}%" in {_temp.%loop-player%}
  742. send {_temp.%loop-player%} to loop-player
  743. else if "%{kfsb.startCountDown}%".endsWith("0") is true:
  744. loop all players:
  745. {kfsb.ingame::%loop-player%} is set
  746. play "BLOCK_NOTE_HAT" to loop-player at volume 10 at pitch 5
  747. set {_temp.%loop-player%} to yaml value "chat-starting-3" from {kfsb.lang.%loop-player%}
  748. replace every "{seconds}" with "%{kfsb.startCountDown}%" in {_temp.%loop-player%}
  749. send {_temp.%loop-player%} to loop-player
  750. else if {kfsb.startCountDown} <= 5:
  751. loop all players:
  752. {kfsb.ingame::%loop-player%} is set
  753. play "BLOCK_NOTE_HAT" to loop-player at volume 10 at pitch 5
  754. set {_temp.%loop-player%} to yaml value "chat-starting-4" from {kfsb.lang.%loop-player%}
  755. replace every "{seconds}" with "%{kfsb.startCountDown}%" in {_temp.%loop-player%}
  756. if {kfsb.startCountDown} is not 1:
  757. replace every "{s}" with "s" in {_temp.%loop-player%}
  758. else:
  759. replace every "{s}" with "" in {_temp.%loop-player%}
  760. send {_temp.%loop-player%} to loop-player
  761. wait 1 second
  762. if size of {kfsb.ingame::*} is bigger than or equal to {@NeededPlayersToStart}:
  763. remove 1 from {kfsb.startCountDown}
  764. if size of {kfsb.ingame::*} is smaller than {@NeededPlayersToStart}:
  765. stop
  766. set {kfsb.status} to "ingame"
  767. loop {kfsb.map::*}:
  768. delete {kfsb.validmap::%loop-index%}
  769. {kfsb.location::%loop-index%::redspawn} is set
  770. {kfsb.location::%loop-index%::bluespawn} is set
  771. {kfsb.location::%loop-index%::pos1} is set
  772. {kfsb.location::%loop-index%::pos2} is set
  773. set {kfsb.validmap::%loop-index%} to loop-value
  774. loop {kfsb.validmap::*}:
  775. if size of {kfsb.votes.%loop-value%::*} is not 0:
  776. set {_votecheck::%loop-value%} to size of {kfsb.votes.%loop-value%::*}
  777. set {_sortedcheck::*} to sorted {_votecheck::*}
  778. if size of {_votecheck::*} is 0:
  779. set {kfsb.selectedMap} to random object out of {kfsb.validmap::*}
  780. else:
  781. loop {kfsb.validmap::*}:
  782. if size of {kfsb.votes.%loop-value%::*} is {_sortedcheck::1}:
  783. set {_finalcheck::%loop-value%} to loop-value
  784. set {kfsb.selectedMap} to random object out of {_finalcheck::*}
  785. delete {kfsb.startCountDown}
  786. set {_teamplayers1} to floor(size of {kfsb.ingame::*} / 2)
  787. set {_teamplayers2} to size of {kfsb.ingame::*} - {_teamplayers1}
  788. set {_team1} to random object out of "red" or "blue"
  789. if {_team1} is "red":
  790. set {_team2} to "blue"
  791. set {kfsb.nextjointeam} to "red"
  792. if {_team1} is "blue":
  793. set {_team2} to "red"
  794. set {kfsb.nextjointeam} to "blue"
  795. loop all players:
  796. {kfsb.ingame::%loop-player%} is set
  797. set {_selectPlayers::%loop-player%} to loop-player
  798. loop {_teamplayers1} times:
  799. set {_selectedPlayer} to random object out of {_selectPlayers::*}
  800. delete {_selectPlayers::%{_selectedPlayer}%}
  801. set {kfsb.%{_team1}%team::%{_selectedPlayer}%} to {_selectedPlayer}
  802. set {kfsb.team::%{_selectedPlayer}%} to {_team1}
  803. loop all players:
  804. {kfsb.ingame::%loop-player%} is set
  805. {_selectPlayers::%loop-player%} is set
  806. set {kfsb.%{_team2}%team::%loop-player%} to loop-player
  807. set {kfsb.team::%loop-player%} to {_team2}
  808. set {_world} to world of {kfsb.location::%{kfsb.selectedMap}%::pos1}
  809. execute console command "multiverse-core:mv delete {@MapHandlerName}"
  810. execute console command "multiverse-core:mvconfirm"
  811. execute console command "multiverse-core:mv clone %{_world}% {@MapHandlerName}"
  812. execute console command "multiverse-core:mv modify set mode survival {@MapHandlerName}"
  813. execute console command "multiverse-core:mv gamerule doDaylightCycle false {@MapHandlerName}"
  814. execute console command "multiverse-core:mv gamerule doWeatherCycle false {@MapHandlerName}"
  815. execute console command "multiverse-core:mv gamerule doMobSpawning false {@MapHandlerName}"
  816. execute console command "multiverse-core:mv gamerule doMobLoot false {@MapHandlerName}"
  817. execute console command "multiverse-core:mv gamerule doTileDrops true {@MapHandlerName}"
  818. execute console command "multiverse-core:mv gamerule mobGriefing false {@MapHandlerName}"
  819. set {kfsb.mapdata.redspawn} to {kfsb.location::%{kfsb.selectedMap}%::redspawn}
  820. set world of {kfsb.mapdata.redspawn} to "{@MapHandlerName}" parsed as a world
  821. set {kfsb.mapdata.bluespawn} to {kfsb.location::%{kfsb.selectedMap}%::bluespawn}
  822. set world of {kfsb.mapdata.bluespawn} to "{@MapHandlerName}" parsed as a world
  823. set {kfsb.mapdata.pos1} to {kfsb.location::%{kfsb.selectedMap}%::pos1}
  824. set world of {kfsb.mapdata.pos1} to "{@MapHandlerName}" parsed as a world
  825. set {kfsb.mapdata.pos2} to {kfsb.location::%{kfsb.selectedMap}%::pos2}
  826. set world of {kfsb.mapdata.pos2} to "{@MapHandlerName}" parsed as a world
  827. set block at {kfsb.mapdata.redspawn} to red wool
  828. set block at {kfsb.mapdata.bluespawn} to blue wool
  829. set {kfsb.redstatus} to "&a✔"
  830. set {kfsb.bluestatus} to "&a✔"
  831. delete {kfsb.spawnmoving.red}
  832. delete {kfsb.spawnmoving.blue}
  833. delete {kfsb.spawnbroken.red}
  834. delete {kfsb.spawnbroken.blue}
  835. loop {kfsb.redalive::*}:
  836. delete {kfsb.redalive::%loop-index%}
  837. loop {kfsb.bluealive::*}:
  838. delete {kfsb.bluealive::%loop-index%}
  839. loop all players:
  840. {kfsb.ingame::%loop-player%} is set
  841. clear loop-player's inventory
  842. set loop-player's gamemode to survival
  843. set {kfsb.kills::%loop-player%} to 0
  844. set {kfsb.playerstatus::%loop-player%} to "ingame"
  845. if {kfsb.team::%loop-player%} is "red":
  846. kfsbSetFacing(loop-player, "%{kfsb.redfacing.%{kfsb.selectedMap}%}%", {kfsb.mapdata.redspawn})
  847. set {kfsb.redalive::%loop-player%} to loop-player
  848. else if {kfsb.team::%loop-player%} is "blue":
  849. kfsbSetFacing(loop-player, "%{kfsb.bluefacing.%{kfsb.selectedMap}%}%", {kfsb.mapdata.bluespawn})
  850. set {kfsb.bluealive::%loop-player%} to loop-player
  851. send yaml value "chat-greenbar" from {kfsb.lang.%loop-player%} to loop-player
  852. set {_line} to 1
  853. loop 10 times:
  854. loop all players:
  855. {kfsb.ingame::%loop-player%} is set
  856. send centered yaml value "chat-description-%{_line}%" from {kfsb.lang.%loop-player%} to loop-player
  857. add 1 to {_line}
  858. loop all players:
  859. {kfsb.ingame::%loop-player%} is set
  860. send yaml value "chat-greenbar" from {kfsb.lang.%loop-player%} to loop-player
  861. send yaml value "chat-spawntip" from {kfsb.lang.%loop-player%} to loop-player
  862. send yaml value "chat-shouttip" from {kfsb.lang.%loop-player%} to loop-player
  863. kfsbPlaceHologram(loop-player)
  864. if {kfsb.spawnbroken.red} is set:
  865. if size of {kfsb.redalive::*} is 0:
  866. set {kfsb.redstatus} to "&c✗"
  867. else:
  868. set {kfsb.redstatus} to "&e%size of {kfsb.redalive::*}%"
  869. else:
  870. set {kfsb.redstatus} to "&a✔"
  871. if {kfsb.spawnbroken.blue} is set:
  872. if size of {kfsb.bluealive::*} is 0:
  873. set {kfsb.bluestatus} to "&c✗"
  874. else:
  875. set {kfsb.bluestatus} to "&e%size of {kfsb.bluealive::*}%"
  876. else:
  877. set {kfsb.bluestatus} to "&a✔"
  878. if {kfsb.status} is "ingame":
  879. if size of {kfsb.ingame::*} < {@NeededPlayersToStart}:
  880. kfsbResetGame()
  881. loop all players:
  882. if {kfsb.playerstatus::%loop-player%} is "ingame":
  883. if location of loop-player is not within {kfsb.mapdata.pos1} to {kfsb.mapdata.pos2}:
  884. set {_temp} to loop-player.isOnGround()
  885. if {_temp} is true:
  886. teleport loop-player to {kfsb.playerlocation.%loop-player%}
  887. else:
  888. set {kfsb.playerlocation.%loop-player%} to location of loop-player
  889. loop all players:
  890. if {kfsb.ingame::%loop-player%} is set:
  891. if {kfsb.playerstatus::%loop-player%} is not set:
  892. set loop-player's health to 10
  893. set loop-player's saturation to 10
  894. set loop-player's level to 0
  895. set loop-player's level progress to 0
  896. set loop-player's hunger to 10
  897. kfsbUpdateScoreboard(loop-player)
  898. if {kfsb.selfsetlang.%loop-player%} isn't set:
  899. set {kfsb.lang.%loop-player%} to language of loop-player
  900. if {kfsb.langlist::*} does not contain {kfsb.lang.%loop-player%}:
  901. set {kfsb.lang.%loop-player%} to "{@DefaultLanguage}"
  902. if {kfsb.status} is "ingame":
  903. if size of {kfsb.redalive::*} is smaller than 1:
  904. set {kfsb.status} to "ending"
  905. set {kfsb.winteam} to "blue"
  906. kfsbEndgame()
  907. if size of {kfsb.bluealive::*} is smaller than 1:
  908. set {kfsb.status} to "ending"
  909. set {kfsb.winteam} to "red"
  910. kfsbEndgame()
  911.  
  912. command /SphereBattle [<text>] [<text>] [<text>] [<text>]:
  913. aliases: /sb, /sphere
  914. trigger:
  915. if arg 1 is "setlang" or "lang":
  916. if arg 2 isn't set:
  917. send skript-yaml value "detecting-language" from "%{kfsb.lang.%player%}%"
  918. set {kfsb.lang.%player%} to player.getLocale()
  919. delete {kfsb.selfsetlang.%player%}
  920. else:
  921. set {kfsb.selfsetlang.%player%} to 1
  922. set {kfsb.lang.%player%} to arg 2
  923. if {kfsb.langlist::*} does not contain {kfsb.lang.%player%}:
  924. set {kfsb.lang.%player%} to "{@DefaultLanguage}"
  925. send skript-yaml value "language-detected" from "%{kfsb.lang.%player%}%"
  926. if arg 1 is "reload":
  927. if player doesn't have permission "kfsb.reload":
  928. send yaml value "no-permission" from "%{kfsb.lang.%player%}%"
  929. else:
  930. loop {kfsb.langlist::*}:
  931. delete {kfsb.langlist::%loop-index%}
  932. loop directory "plugins/Skript/scripts/SphereBattle/lang/"'s files:
  933. if loop-string.endsWith(".yml") is true:
  934. set {_temp} to relative path of loop-string
  935. set {_temp2} to {_temp}
  936. replace every ".yml" with "" in {_temp}
  937. replace every "plugins/Skript/scripts/SphereBattle/lang/" with "" in {_temp}
  938. replace every "plugins\Skript\scripts\SphereBattle\lang\" with "" in {_temp}
  939. load yaml "%{_temp2}%" as "%{_temp}%"
  940. set {kfsb.langlist::%{_temp}%} to {_temp}
  941. send yaml value "reloaded" from "%{kfsb.lang.%player%}%"
  942. if arg 1 is not set:
  943. set {_showHelp} to true
  944. else if arg 1 is "help":
  945. set {_showHelp} to true
  946. if {_showHelp} is true:
  947. send yaml value "command-help" from "%{kfsb.lang.%player%}%"
  948. if arg 1 is "admin":
  949. if player has permission "spherebattle.admin":
  950. if arg 2 is not set:
  951. set {_showHelp} to true
  952. else if arg 2 is "help":
  953. set {_showHelp} to true
  954. if {_showHelp} is true:
  955. send yaml value "command-admin-help" from {kfsb.lang.%player%}
  956. else if arg 2 is "addmap":
  957. if arg 3 is not set:
  958. send yaml value "command-addmap-noname" from {kfsb.lang.%player%}
  959. else if {kfsb.map::%arg 3%} is set:
  960. send yaml value "command-addmap-dupe" from {kfsb.lang.%player%}
  961. else:
  962. set {_temp} to yaml value "command-addmap-success" from {kfsb.lang.%player%}
  963. replace every "{mapname}" with arg 3 in {_temp}
  964. send {_temp}
  965. set {kfsb.map::%arg 3%} to arg 3
  966. else if arg 2 is "removemap":
  967. if arg 3 is not set:
  968. send yaml value "command-removemap-noname" from {kfsb.lang.%player%}
  969. else if {kfsb.map::%arg 3%} is not set:
  970. send yaml value "command-removemap-unexist" from {kfsb.lang.%player%}
  971. else:
  972. set {_temp} to yaml value "command-removemap-success" from {kfsb.lang.%player%}
  973. replace every "{mapname}" with arg 3 in {_temp}
  974. send {_temp}
  975. delete {kfsb.map::%arg 3%}
  976. delete {kfsb.location::%arg 3%::redspawn}
  977. delete {kfsb.location::%arg 3%::bluespawn}
  978. delete {kfsb.location::%arg 3%::pos1}
  979. delete {kfsb.location::%arg 3%::pos2}
  980. delete {kfsb.redfacing.%arg 3%}
  981. delete {kfsb.bluefacing.%arg 3%}
  982. else if arg 2 is "setspawn":
  983. if arg 3 is not set:
  984. send yaml value "command-setspawn-nomap" from {kfsb.lang.%player%}
  985. else if {kfsb.map::%arg 3%} is not set:
  986. send yaml value "command-setspawn-mapunexist" from {kfsb.lang.%player%}
  987. else if arg 4 is not set:
  988. send yaml value "command-setspawn-noteam" from {kfsb.lang.%player%}
  989. else if arg 4 is not "red" or "blue":
  990. send yaml value "command-setspawn-invalidteam" from {kfsb.lang.%player%}
  991. else:
  992. set {_temp} to yaml value "command-setspawn-success" from {kfsb.lang.%player%}
  993. replace every "{team}" with arg 4 in {_temp}
  994. replace every "{mapname}" with arg 3 in {_temp}
  995. send {_temp}
  996. set {_loc} to location of player
  997. if arg 4 is "red":
  998. set {_temp} to red wool
  999. else if arg 4 is "blue":
  1000. set {_temp} to blue wool
  1001. set block at {_loc} to {_temp}
  1002. set {kfsb.location::%arg 3%::%uncolored arg 4%spawn} to location of block at {_loc}
  1003. set {kfsb.%uncolored arg 4%facing.%arg 3%} to facing of player
  1004. kfsbSetFacing(player, "%{kfsb.%uncolored arg 4%facing.%arg 3%}%", location above {kfsb.location::%arg 3%::%uncolored arg 4%spawn})
  1005. else if arg 2 is "wand":
  1006. send yaml value "command-wand-success" from {kfsb.lang.%player%}
  1007. set {_itemname} to yaml value "item-wand-name" from {kfsb.lang.%player%}
  1008. set {_itemname} to "%{_itemname}%&1&2&3&4&f&r"
  1009. give player 1 of glowing blaze rod named {_itemname} with lore yaml value "item-wand-lore" from {kfsb.lang.%player%}
  1010. else if arg 2 is "setregion":
  1011. if arg 3 is not set:
  1012. send yaml value "command-setregion-noname" from {kfsb.lang.%player%}
  1013. else if {kfsb.map::%arg 3%} is not set:
  1014. send yaml value "command-setregion-unexist" from {kfsb.lang.%player%}
  1015. else if {kfsb.selection.pos1.%player%} is not set:
  1016. send yaml value "command-setregion-noregion" from {kfsb.lang.%player%}
  1017. else if {kfsb.selection.pos2.%player%} is not set:
  1018. send yaml value "command-setregion-noregion" from {kfsb.lang.%player%}
  1019. else:
  1020. set {_temp} to yaml value "command-setregion-success" from {kfsb.lang.%player%}
  1021. replace every "{mapname}" with arg 3 in {_temp}
  1022. set {kfsb.location::%arg 3%::pos1} to {kfsb.selection.pos1.%player%}
  1023. set {kfsb.location::%arg 3%::pos2} to {kfsb.selection.pos2.%player%}
  1024. send {_temp}
  1025. else if arg 2 is "setlobby":
  1026. send yaml value "command-setlobby-success" from {kfsb.lang.%player%}
  1027. set {kfsb.lobby} to location of player
  1028. if pitch of {kfsb.lobby} is 0:
  1029. set pitch of {kfsb.lobby} to 0.01
  1030. if yaw of {kfsb.lobby} is 0:
  1031. set yaw of {kfsb.lobby} to 0.01
  1032. teleport player to {kfsb.lobby}
  1033. else if arg 2 is "start":
  1034. if {kfsb.status} is not set:
  1035. if size of {kfsb.ingame::*} >= {@NeededPlayersToStart}:
  1036. send yaml value "command-start-success" from {kfsb.lang.%player%}
  1037. set {kfsb.startCountDown} to 1
  1038. else:
  1039. send yaml value "command-start-notenough" from {kfsb.lang.%player%}
  1040. else:
  1041. send yaml value "command-start-alreadystarted" from {kfsb.lang.%player%}
  1042. else:
  1043. send yaml value "no-permission" from {kfsb.lang.%player%}
  1044. else if arg 1 is "join":
  1045. kfsbJoinGame(player)
  1046. else if arg 1 is "leave":
  1047. kfsbLeaveGame(player)
  1048. else if arg 1 is "vote":
  1049. if {kfsb.ingame::%player%} is set:
  1050. if {kfsb.playerstatus::%{_player}%} is not set:
  1051. if arg 2 is not set:
  1052. send yaml value "command-vote-unvote" from {kfsb.lang.%player%}
  1053. delete {kfsb.votes.%{kfsb.lastvotedmap::%player%}%::%player%}
  1054. if player has a gui:
  1055. kfsbOpenMapVoteGui(player)
  1056. else if {kfsb.map::%arg 2%} is not set:
  1057. send yaml value "command-vote-unexist" from {kfsb.lang.%player%}
  1058. else:
  1059. delete {kfsb.votes.%{kfsb.lastvotedmap::%player%}%::%player%}
  1060. set {_temp} to yaml value "command-vote-success" from {kfsb.lang.%player%}
  1061. replace every "{mapname}" with arg 2 in {_temp}
  1062. send {_temp}
  1063. set {kfsb.lastvotedmap::%player%} to arg 2
  1064. set {kfsb.votes.%arg 2%::%player%} to true
  1065. if player has a gui:
  1066. kfsbOpenMapVoteGui(player)
  1067. loop all players:
  1068. if loop-player has a gui:
  1069. if inventory name of loop-player's current inventory contains "&1&2&3&4&e&o":
  1070. kfsbOpenMapVoteGui(loop-player)
  1071. else:
  1072. send yaml value "command-vote-disabled" from {kfsb.lang.%player%}
  1073. else:
  1074. send yaml value "command-vote-disabled" from {kfsb.lang.%player%}
  1075. else if arg 1 is "shout":
  1076. if {kfsb.ingame::%player%} is set:
  1077. if {kfsb.playerstatus::%player%} is "ingame" or "ending":
  1078. if arg 2 is not set:
  1079. send yaml value "command-shout-nomessage" from {kfsb.lang.%player%}
  1080. else:
  1081. set {kfsb.shoutchat.%player%} to true
  1082. set {_temp} to arg 2
  1083. if arg 3 is set:
  1084. set {_temp} to "%arg 2% %arg 3%"
  1085. if arg 4 is set:
  1086. set {_temp} to "%arg 2% %arg 3% %arg 4%"
  1087. player.chat({_temp})
  1088. else:
  1089. send yaml value "command-shout-disabled" from {kfsb.lang.%player%}
  1090. else:
  1091. send yaml value "command-shout-disabled" from {kfsb.lang.%player%}
  1092.  
  1093. on break:
  1094. if {kfsb.respawnCountdown.%player%} is set:
  1095. cancel event
  1096. stop
  1097. if name of player's tool contains "&1&2&3&4&f&r":
  1098. player has permission "spherebattle.admin"
  1099. cancel event
  1100.  
  1101. on left click:
  1102. if name of player's tool contains "&1&2&3&4&f&r":
  1103. player's target block is set
  1104. player has permission "spherebattle.admin"
  1105. set {_temp} to yaml value "chat-wand-pos1" from {kfsb.lang.%player%}
  1106. replace every "{location}" with "%location of target block%" in {_temp}
  1107. set {kfsb.selection.pos1.%player%} to location of target block
  1108. send {_temp}
  1109.  
  1110. on right click:
  1111. if {kfsb.isSpectator::%player%} is set:
  1112. cancel event
  1113. if name of player's tool contains "&1&2&3&4&f&r":
  1114. player's target block is set
  1115. player has permission "spherebattle.admin"
  1116. cancel event
  1117. set {_temp} to yaml value "chat-wand-pos2" from {kfsb.lang.%player%}
  1118. replace every "{location}" with "%location of target block%" in {_temp}
  1119. set {kfsb.selection.pos2.%player%} to location of target block
  1120. send {_temp}
  1121. else if name of player's tool contains "&1&2&3&4&e&o":
  1122. {kfsb.ingame::%player%} is set
  1123. kfsbOpenMapVoteGui(player)
  1124. else if name of player's tool contains "&1&2&3&4&r&e&m":
  1125. {kfsb.ingame::%player%} is set
  1126. kfsbOpenTeleporterGui(player)
  1127. else if {kfsb.ingame::%player%} is set:
  1128. if {kfsb.isSpectator::%player%} is set:
  1129. cancel event
  1130. if target block of player is chest:
  1131. open "CHEST" to player
  1132. set {_opened} to true
  1133. if target block of player is furnace:
  1134. open "FURNACE" to player
  1135. set {_opened} to true
  1136. if target block of player is hopper:
  1137. open "HOPPER" to player
  1138. set {_opened} to true
  1139. if target block of player is dispenser:
  1140. open "DISPENSER" to player
  1141. set {_opened} to true
  1142. if target block of player is dropper:
  1143. open "DROPPER" to player
  1144. set {_opened} to true
  1145. if target block of player is trapped chest:
  1146. open "CHEST" to player
  1147. set {_opened} to true
  1148. if {_opened} is true:
  1149. set {ksfb.blockloc.%player%} to location of target block of player
  1150. set {_slot} to 0
  1151. loop 27 times:
  1152. set {_invitem::%{_slot}%} to slot {_slot} of target block of player's inventory
  1153. create a gui slot {_slot} of player with {_invitem::%{_slot}%}
  1154. add 1 to {_slot}
  1155.  
  1156. on quit:
  1157. kfsbLeaveGame(player)
  1158. delete {kfsb.selection.pos1.%player%}
  1159. delete {kfsb.selection.pos2.%player%}
  1160.  
  1161. on place:
  1162. if {kfsb.respawnCountdown.%player%} is set:
  1163. cancel event
  1164. stop
  1165. if {kfsb.isSpectator::%player%} is set:
  1166. cancel event
  1167. stop
  1168. if {kfsb.ingame::%player%} is set:
  1169. if {kfsb.playerstatus::%player%} is not set:
  1170. cancel event
  1171. stop
  1172. if {kfsb.respawnCountdown.%player%} is set:
  1173. cancel event
  1174. stop
  1175.  
  1176. on break:
  1177. if {kfsb.isSpectator::%player%} is set:
  1178. cancel event
  1179. stop
  1180. if {kfsb.respawnCountdown.%player%} is set:
  1181. cancel event
  1182. stop
  1183. if {kfsb.ingame::%player%} is set:
  1184. if {kfsb.playerstatus::%player%} is not set:
  1185. cancel event
  1186. else if {kfsb.playerstatus::%player%} is "ingame":
  1187. if location of event-block is not within {kfsb.mapdata.pos1} to {kfsb.mapdata.pos2}:
  1188. cancel event
  1189. send yaml value "chat-cantbreakblocksthere" from {kfsb.lang.%player%}
  1190. else if event-block is blue wool:
  1191. if {kfsb.team::%player%} is "blue":
  1192. "%{kfsb.mapdata.bluespawn}%" is "%location of event-block%"
  1193. cancel event
  1194. set block at location of event-block to air
  1195. set {_temp} to yaml value "item-bluespawn-name" from {kfsb.lang.%player%}
  1196. set {_itemname} to "%{_temp}%&1&2&3&4&b&1"
  1197. give blue wool named {_itemname} to player
  1198. set {kfsb.spawnmoving.blue} to true
  1199. loop all players:
  1200. {kfsb.ingame::%loop-player%} is set
  1201. {kfsb.team::%loop-player%} is "blue"
  1202. send yaml value "chat-spawnismoving" from {kfsb.lang.%loop-player%} to loop-player
  1203. kfsbDeleteHologram(loop-player)
  1204. else:
  1205. "%{kfsb.mapdata.bluespawn}%" is "%location of event-block%"
  1206. cancel event
  1207. set block at location of event-block to air
  1208. set {kfsb.spawnmoving.blue} to true
  1209. set {kfsb.spawnbroken.blue} to true
  1210. loop all players:
  1211. {kfsb.ingame::%loop-player%} is set
  1212. set {_temp.%loop-player%} to yaml value "chat-spawnbroke-blue-broadcast" from {kfsb.lang.%loop-player%}
  1213. replace every "{player}" with kfsbGetUsername(player) in {_temp.%loop-player%}
  1214. send {_temp.%loop-player%} to loop-player
  1215. {kfsb.team::%loop-player%} is "blue"
  1216. kfsbDeleteHologram(loop-player)
  1217. set {_temp.%loop-player%} to yaml value "chat-spawnbroke" from {kfsb.lang.%loop-player%}
  1218. replace every "{player}" with kfsbGetUsername(player) in {_temp.%loop-player%}
  1219. send {_temp.%loop-player%} to loop-player
  1220. play "ENTITY_ENDERDRAGON_GROWL" to loop-player at volume 10 at pitch 5
  1221. send title yaml value "title-spawn-destroyed" from {kfsb.lang.%loop-player%} with subtitle yaml value "title-spawn-destroyed-sub" from {kfsb.lang.%loop-player%} to loop-player for 4 seconds and 0 ticks and 0 ticks
  1222. else if event-block is red wool:
  1223. if {kfsb.team::%player%} is "red":
  1224. "%{kfsb.mapdata.redspawn}%" is "%location of event-block%"
  1225. cancel event
  1226. set block at location of event-block to air
  1227. set {_temp} to yaml value "item-redspawn-name" from {kfsb.lang.%player%}
  1228. set {_itemname} to "%{_temp}%&1&2&3&4&r&1"
  1229. give red wool named {_itemname} to player
  1230. set {kfsb.spawnmoving.red} to true
  1231. loop all players:
  1232. {kfsb.ingame::%loop-player%} is set
  1233. {kfsb.team::%loop-player%} is "red"
  1234. send yaml value "chat-spawnismoving" from {kfsb.lang.%loop-player%} to loop-player
  1235. kfsbDeleteHologram(loop-player)
  1236. else:
  1237. set {kfsb.spawnmoving.red} to true
  1238. set {kfsb.spawnbroken.red} to true
  1239. loop all players:
  1240. "%{kfsb.mapdata.redspawn}%" is "%location of event-block%"
  1241. cancel event
  1242. set block at location of event-block to air
  1243. {kfsb.ingame::%loop-player%} is set
  1244. set {_temp.%loop-player%} to yaml value "chat-spawnbroke-red-broadcast" from {kfsb.lang.%loop-player%}
  1245. replace every "{player}" with kfsbGetUsername(player) in {_temp.%loop-player%}
  1246. send {_temp.%loop-player%} to loop-player
  1247. {kfsb.team::%loop-player%} is "red"
  1248. kfsbDeleteHologram(loop-player)
  1249. set {_temp.%loop-player%} to yaml value "chat-spawnbroke" from {kfsb.lang.%loop-player%}
  1250. replace every "{player}" with kfsbGetUsername(player) in {_temp.%loop-player%}
  1251. send {_temp.%loop-player%} to loop-player
  1252. play "ENTITY_ENDERDRAGON_GROWL" to loop-player at volume 10 at pitch 5
  1253. send title yaml value "title-spawn-destroyed" from {kfsb.lang.%loop-player%} with subtitle yaml value "title-spawn-destroyed-sub" from {kfsb.lang.%loop-player%} to loop-player for 4 seconds and 0 ticks and 0 ticks
  1254.  
  1255. on drop:
  1256. if {kfsb.isSpectator::%player%} is set:
  1257. cancel event
  1258. stop
  1259. if {kfsb.ingame::%player%} is set:
  1260. if {kfsb.playerstatus::%player%} is not set:
  1261. cancel event
  1262. else if {kfsb.playerstatus::%player%} is "ingame":
  1263. if name of event-item contains "&1&2&3&4&b&1":
  1264. cancel event
  1265. else if name of event-item contains "&1&2&3&4&r&1":
  1266. cancel event
  1267.  
  1268. on PlayerSwapHandItemsEvent:
  1269. set {_player} to event.getPlayer()
  1270. if name of event.getOffHandItem() contains "&1&2&3&4&b&1":
  1271. cancel event
  1272. if name of event.getOffHandItem() contains "&1&2&3&4&r&1":
  1273. cancel event
  1274. if {kfsb.isSpectator::%{_player}%} is set:
  1275. cancel event
  1276. stop
  1277. if {kfsb.ingame::%{_player}%} is set:
  1278. if {kfsb.playerstatus::%{_player}%} is not set:
  1279. cancel event
  1280.  
  1281. on inventory click:
  1282. send "%name of event-item%" to console
  1283. if clicked item is blue wool:
  1284. clicked item's name contains "&1&2&3&4&b&1"
  1285. cancel event
  1286. if clicked item is red wool:
  1287. clicked item's name contains "&1&2&3&4&r&1"
  1288. cancel event
  1289. if {kfsb.isSpectator::%player%} is set:
  1290. cancel event
  1291. stop
  1292. if {kfsb.ingame::%player%} is set:
  1293. if {kfsb.playerstatus::%player%} is not set:
  1294. cancel event
  1295.  
  1296. on damage:
  1297. if {kfsb.respawnCountdown.%victim%} is set:
  1298. cancel event
  1299. if {kfsb.respawnCountdown.%attacker%} is set:
  1300. cancel event
  1301. if {kfsb.isSpectator::%victim%} is set:
  1302. cancel event
  1303. if {kfsb.isSpectator::%attacker%} is set:
  1304. cancel event
  1305. victim is a player
  1306. if {kfsb.ingame::%victim%} is set:
  1307. if {kfsb.playerstatus::%victim%} is not set:
  1308. cancel event
  1309. else if {kfsb.status} is "ingame":
  1310. if {kfsb.team::%attacker%} is {kfsb.team::%victim%}:
  1311. cancel event
  1312. stop
  1313. else if {kfsb.status} is "ending":
  1314. cancel event
  1315.  
  1316. on death of player:
  1317. {kfsb.ingame::%player%} is set
  1318. delete {kfsb.noSetSpectator.%victim%}
  1319. set death message to ""
  1320. if victim's tool is totem of undying:
  1321. "%damage cause%" is not "void"
  1322. stop
  1323. if {kfsb.spawnmoving.%{kfsb.team::%victim%}%} is not set:
  1324. heal victim
  1325. set victim's health to 10
  1326. set victim's max health to 10
  1327. set victim's health to 10
  1328. set victim's hunger to 10
  1329. set victim's level to 0
  1330. set victim's level progress to 0
  1331. set victim's saturation to 10
  1332. set victim's health to 10
  1333. loop all items of victim:
  1334. clear loop-item
  1335. clear potion effects of victim
  1336. if "%damage cause%" is "void":
  1337. set {kfsb.nodeathaction.%victim%} to true
  1338. if {kfsb.lasthit::%victim%} is set:
  1339. add 1 to {kfsb.kills::%{kfsb.lasthit::%victim%}%}
  1340. play "ENTITY_EXPERIENCE_ORB_PICKUP" to {kfsb.lasthit::%victim%} at volume 10 at pitch 5
  1341. set {_temp} to yaml value "chat-deathmessage-knockedintothevoid-you" from {kfsb.lang.%victim%}
  1342. replace every "{attacker}" with kfsbGetUsername({kfsb.lasthit::%victim%}) in {_temp}
  1343. send {_temp} to victim
  1344. loop all players:
  1345. {kfsb.ingame::%loop-player%} is set
  1346. if loop-player is not victim:
  1347. set {_temp.%loop-player%} to yaml value "chat-deathmessage-knockedintothevoid" from {kfsb.lang.%loop-player%}
  1348. replace every "{victim}" with kfsbGetUsername(victim) in {_temp.%loop-player%}
  1349. replace every "{attacker}" with kfsbGetUsername({kfsb.lasthit::%victim%}) in {_temp.%loop-player%}
  1350. send {_temp.%loop-player%} to loop-player
  1351. else:
  1352. send yaml value "chat-deathmessage-fellintothevoid-you" from {kfsb.lang.%victim%} to victim
  1353. loop all players:
  1354. {kfsb.ingame::%loop-player%} is set
  1355. if loop-player is not victim:
  1356. {kfsb.ingame::%loop-player%} is set
  1357. set {_temp.%loop-player%} to yaml value "chat-deathmessage-fellintothevoid" from {kfsb.lang.%loop-player%}
  1358. replace every "{victim}" with kfsbGetUsername(victim) in {_temp.%loop-player%}
  1359. send {_temp.%loop-player%} to loop-player
  1360. else if attacker is a player:
  1361. add 1 to {kfsb.kills::%attacker%}
  1362. play "ENTITY_EXPERIENCE_ORB_PICKUP" to attacker at volume 10 at pitch 5
  1363. set {_temp} to yaml value "chat-deathmessage-killed-you" from {kfsb.lang.%victim%}
  1364. replace every "{attacker}" with kfsbGetUsername(attacker) in {_temp}
  1365. send {_temp} to victim
  1366. loop all players:
  1367. {kfsb.ingame::%loop-player%} is set
  1368. if loop-player is not victim:
  1369. set {_temp.%loop-player%} to yaml value "chat-deathmessage-killed" from {kfsb.lang.%loop-player%}
  1370. replace every "{victim}" with kfsbGetUsername(victim) in {_temp.%loop-player%}
  1371. replace every "{attacker}" with kfsbGetUsername(attacker) in {_temp.%loop-player%}
  1372. send {_temp.%loop-player%} to loop-player
  1373. else if "%damage cause%" is "fall":
  1374. send yaml value "chat-deathmessage-fellfromahighplace-you" from {kfsb.lang.%victim%} to victim
  1375. loop all players:
  1376. {kfsb.ingame::%loop-player%} is set
  1377. if loop-player is not victim:
  1378. set {_temp.%loop-player%} to yaml value "chat-deathmessage-fellfromahighplace" from {kfsb.lang.%loop-player%}
  1379. replace every "{victim}" with kfsbGetUsername(victim) in {_temp.%loop-player%}
  1380. send {_temp.%loop-player%} to loop-player
  1381. else:
  1382. send yaml value "chat-deathmessage-died-you" from {kfsb.lang.%victim%} to victim
  1383. loop all players:
  1384. {kfsb.ingame::%loop-player%} is set
  1385. if loop-player is not victim:
  1386. set {_temp.%loop-player%} to yaml value "chat-deathmessage-died" from {kfsb.lang.%loop-player%}
  1387. replace every "{victim}" with kfsbGetUsername(victim) in {_temp.%loop-player%}
  1388. send {_temp.%loop-player%} to loop-player
  1389. set {_stayLocation.%victim%} to location of victim
  1390. victim.setAllowFlight(true)
  1391. victim.setFlying(true)
  1392. apply blindness without particles to victim for 9999 days
  1393. set {kfsb.respawnCountdown.%victim%} to "{@RespawnCooldownTime}" parsed as integer
  1394. hide victim from all players
  1395. loop {@RespawnCooldownTime} times:
  1396. if {kfsb.ingame::%victim%} is not set:
  1397. stop
  1398. play "BLOCK_NOTE_HAT" to victim at volume 10 at pitch 5
  1399. set {_temp} to yaml value "chat-respawning" from {kfsb.lang.%victim%}
  1400. replace every "{seconds}" with "%{kfsb.respawnCountdown.%victim%}%" in {_temp}
  1401. if {kfsb.respawnCountDown.%victim%} < 2:
  1402. replace every "{s}" with "" in {_temp}
  1403. else:
  1404. replace every "{s}" with "s" in {_temp}
  1405. set {_temp2} to {_temp}
  1406. if {_firstmessage} is not set:
  1407. set {_temp3} to yaml value "chat-youdied" from {kfsb.lang.%victim%}
  1408. set {_temp2} to "%{_temp3}% %{_temp}%"
  1409. set {_firstmessage} to true
  1410. send {_temp2} to victim
  1411. set {_temp} to yaml value "title-respawning" from {kfsb.lang.%victim%}
  1412. replace every "{seconds}" with "%{kfsb.respawnCountdown.%victim%}%" in {_temp}
  1413. send title yaml value "title-youdied" from {kfsb.lang.%victim%} with subtitle {_temp} to victim for 2 seconds and 0 ticks and 0 ticks
  1414. remove 1 from {kfsb.respawnCountdown.%victim%}
  1415. loop 20 times:
  1416. teleport victim to {_stayLocation.%victim%}
  1417. wait a tick
  1418. delete {kfsb.respawnCountdown.%victim%}
  1419. remove blindness from victim
  1420. victim.setAllowFlight(false)
  1421. reveal victim to all players
  1422. send yaml value "chat-respawned" from {kfsb.lang.%victim%} to victim
  1423. send title yaml value "title-respawned" from {kfsb.lang.%victim%} with subtitle "" to victim for 1 seconds and 0 ticks and 10 ticks
  1424. kfsbSetFacing(victim, "%{kfsb.%{kfsb.team::%victim%}%facing.%{kfsb.selectedMap}%}%", location of victim)
  1425. set victim's fall distance to 0
  1426. teleport victim to location 1 meter above {kfsb.mapdata.%{kfsb.team::%victim%}%spawn}
  1427. play "BLOCK_NOTE_HARP" to victim at volume 10 at pitch 5
  1428. else if {kfsb.spawnbroken.%{kfsb.team::%victim%}%} is not set:
  1429. heal victim
  1430. set victim's health to 10
  1431. set victim's max health to 10
  1432. set victim's health to 10
  1433. set victim's hunger to 10
  1434. set victim's level to 0
  1435. set victim's level progress to 0
  1436. set victim's saturation to 10
  1437. set victim's health to 10
  1438. loop name of all items of victim:
  1439. if loop-string contains "&1&2&3&4&r&1" or "&1&2&3&4&b&1":
  1440. set {_hasSpawnBlock} to true
  1441. loop all items of victim:
  1442. if name of loop-item contains "&1&2&3&4&r&1" or "&1&2&3&4&b&1":
  1443. remove loop-item from drops
  1444. if {_hasSpawnBlock} is not set:
  1445. clear loop-item
  1446. clear drops
  1447. loop all items of victim:
  1448. if name of loop-item contains "&1&2&3&4&r&1":
  1449. set {_uselessVariable} to true
  1450. else if name of loop-item contains "&1&2&3&4&b&1":
  1451. set {_uselessVariable} to true
  1452. else:
  1453. set {_dropLoc} to location 0.5 meters above victim
  1454. set x-coordinate of {_dropLoc} to x-coordinate of {_dropLoc} + 0.5
  1455. set z-coordinate of {_dropLoc} to z-coordinate of {_dropLoc} + 0.5
  1456. drop loop-item at {_dropLoc}
  1457. clear loop-item
  1458. clear potion effects of victim
  1459. if "%damage cause%" is "void":
  1460. set {kfsb.nodeathaction.%victim%} to true
  1461. if {kfsb.lasthit::%victim%} is set:
  1462. add 1 to {kfsb.kills::%{kfsb.lasthit::%victim%}%}
  1463. play "ENTITY_EXPERIENCE_ORB_PICKUP" to {kfsb.lasthit::%victim%} at volume 10 at pitch 5
  1464. set {_temp} to yaml value "chat-deathmessage-knockedintothevoid-you" from {kfsb.lang.%victim%}
  1465. replace every "{attacker}" with kfsbGetUsername({kfsb.lasthit::%victim%}) in {_temp}
  1466. send {_temp} to victim
  1467. loop all players:
  1468. {kfsb.ingame::%loop-player%} is set
  1469. if loop-player is not victim:
  1470. set {_temp.%loop-player%} to yaml value "chat-deathmessage-knockedintothevoid" from {kfsb.lang.%loop-player%}
  1471. replace every "{victim}" with kfsbGetUsername(victim) in {_temp.%loop-player%}
  1472. replace every "{attacker}" with kfsbGetUsername({kfsb.lasthit::%victim%}) in {_temp.%loop-player%}
  1473. send {_temp.%loop-player%} to loop-player
  1474. else:
  1475. send yaml value "chat-deathmessage-fellintothevoid-you" from {kfsb.lang.%victim%} to victim
  1476. loop all players:
  1477. {kfsb.ingame::%loop-player%} is set
  1478. if loop-player is not victim:
  1479. {kfsb.ingame::%loop-player%} is set
  1480. set {_temp.%loop-player%} to yaml value "chat-deathmessage-fellintothevoid" from {kfsb.lang.%loop-player%}
  1481. replace every "{victim}" with kfsbGetUsername(victim) in {_temp.%loop-player%}
  1482. send {_temp.%loop-player%} to loop-player
  1483. else if attacker is a player:
  1484. add 1 to {kfsb.kills::%attacker%}
  1485. play "ENTITY_EXPERIENCE_ORB_PICKUP" to attacker at volume 10 at pitch 5
  1486. set {_temp} to yaml value "chat-deathmessage-killed-you" from {kfsb.lang.%victim%}
  1487. replace every "{attacker}" with kfsbGetUsername(attacker) in {_temp}
  1488. send {_temp} to victim
  1489. loop all players:
  1490. {kfsb.ingame::%loop-player%} is set
  1491. if loop-player is not victim:
  1492. set {_temp.%loop-player%} to yaml value "chat-deathmessage-killed" from {kfsb.lang.%loop-player%}
  1493. replace every "{victim}" with kfsbGetUsername(victim) in {_temp.%loop-player%}
  1494. replace every "{attacker}" with kfsbGetUsername(attacker) in {_temp.%loop-player%}
  1495. send {_temp.%loop-player%} to loop-player
  1496. else if "%damage cause%" is "fall":
  1497. send yaml value "chat-deathmessage-fellfromahighplace-you" from {kfsb.lang.%victim%} to victim
  1498. loop all players:
  1499. {kfsb.ingame::%loop-player%} is set
  1500. if loop-player is not victim:
  1501. set {_temp.%loop-player%} to yaml value "chat-deathmessage-fellfromahighplace" from {kfsb.lang.%loop-player%}
  1502. replace every "{victim}" with kfsbGetUsername(victim) in {_temp.%loop-player%}
  1503. send {_temp.%loop-player%} to loop-player
  1504. else:
  1505. send yaml value "chat-deathmessage-died-you" from {kfsb.lang.%victim%} to victim
  1506. loop all players:
  1507. {kfsb.ingame::%loop-player%} is set
  1508. if loop-player is not victim:
  1509. set {_temp.%loop-player%} to yaml value "chat-deathmessage-died" from {kfsb.lang.%loop-player%}
  1510. replace every "{victim}" with kfsbGetUsername(victim) in {_temp.%loop-player%}
  1511. send {_temp.%loop-player%} to loop-player
  1512. set {_stayLocation.%victim%} to location of victim
  1513. victim.setAllowFlight(true)
  1514. victim.setFlying(true)
  1515. apply blindness without particles to victim for 9999 days
  1516. hide victim from all players
  1517. if {_hasSpawnBlock} is true:
  1518. delete {kfsb.noSetSpectator.%victim%}
  1519. kfsbDeathEvent(victim)
  1520. else:
  1521. set {kfsb.respawnCountdown.%victim%} to 1
  1522. while {kfsb.spawnmoving.%{kfsb.team::%victim%}%} is true:
  1523. if {kfsb.ingame::%victim%} is not set:
  1524. stop
  1525. if {kfsb.spawnbroken.%{kfsb.team::%victim%}%} is set:
  1526. delete {kfsb.noSetSpectator.%victim%}
  1527. kfsbDeathEvent(victim)
  1528. stop
  1529. if {_firstmessage} is not set:
  1530. set {_firstmessage} to true
  1531. send yaml value "chat-youdied" from {kfsb.lang.%victim%} to victim
  1532. send yaml value "chat-respawnwaiting" from {kfsb.lang.%victim%} to victim
  1533. send title yaml value "title-youdied" from {kfsb.lang.%victim%} with subtitle yaml value "title-respawnwaiting" from {kfsb.lang.%victim%} to victim for 2 seconds and 0 ticks and 0 ticks
  1534. teleport victim to {_stayLocation.%victim%}
  1535. wait a tick
  1536. delete {kfsb.respawnCountdown.%victim%}
  1537. remove blindness from victim
  1538. victim.setAllowFlight(false)
  1539. reveal victim to all players
  1540. send yaml value "chat-respawned" from {kfsb.lang.%victim%} to victim
  1541. send title yaml value "title-respawned" from {kfsb.lang.%victim%} with subtitle "" to victim for 1 seconds and 0 ticks and 10 ticks
  1542. kfsbSetFacing(victim, "%{kfsb.%{kfsb.team::%victim%}%facing.%{kfsb.selectedMap}%}%", location of victim)
  1543. set victim's fall distance to 0
  1544. teleport victim to location 1 meter above {kfsb.mapdata.%{kfsb.team::%victim%}%spawn}
  1545. play "BLOCK_NOTE_HARP" to victim at volume 10 at pitch 5
  1546. else:
  1547. heal victim
  1548. if "%damage cause%" is "void":
  1549. set {kfsb.nodeathaction.%victim%} to true
  1550. if {kfsb.lasthit::%victim%} is set:
  1551. add 1 to {kfsb.kills::%{kfsb.lasthit::%victim%}%}
  1552. play "ENTITY_EXPERIENCE_ORB_PICKUP" to {kfsb.lasthit::%victim%} at volume 10 at pitch 5
  1553. set {_temp} to yaml value "chat-deathmessage-knockedintothevoid-you" from {kfsb.lang.%victim%}
  1554. replace every "{attacker}" with kfsbGetUsername({kfsb.lasthit::%victim%}) in {_temp}
  1555. send {_temp} to victim
  1556. loop all players:
  1557. {kfsb.ingame::%loop-player%} is set
  1558. if loop-player is not victim:
  1559. set {_temp.%loop-player%} to yaml value "chat-deathmessage-knockedintothevoid" from {kfsb.lang.%loop-player%}
  1560. replace every "{victim}" with kfsbGetUsername(victim) in {_temp.%loop-player%}
  1561. replace every "{attacker}" with kfsbGetUsername({kfsb.lasthit::%victim%}) in {_temp.%loop-player%}
  1562. send {_temp.%loop-player%} to loop-player
  1563. else:
  1564. send yaml value "chat-deathmessage-fellintothevoid-you" from {kfsb.lang.%victim%} to victim
  1565. loop all players:
  1566. {kfsb.ingame::%loop-player%} is set
  1567. if loop-player is not victim:
  1568. {kfsb.ingame::%loop-player%} is set
  1569. set {_temp.%loop-player%} to yaml value "chat-deathmessage-fellintothevoid" from {kfsb.lang.%loop-player%}
  1570. replace every "{victim}" with kfsbGetUsername(victim) in {_temp.%loop-player%}
  1571. send {_temp.%loop-player%} to loop-player
  1572. else if attacker is a player:
  1573. add 1 to {kfsb.kills::%attacker%}
  1574. play "ENTITY_EXPERIENCE_ORB_PICKUP" to attacker at volume 10 at pitch 5
  1575. set {_temp} to yaml value "chat-deathmessage-killed-you" from {kfsb.lang.%victim%}
  1576. replace every "{attacker}" with kfsbGetUsername(attacker) in {_temp}
  1577. send {_temp} to victim
  1578. loop all players:
  1579. {kfsb.ingame::%loop-player%} is set
  1580. if loop-player is not victim:
  1581. set {_temp.%loop-player%} to yaml value "chat-deathmessage-killed" from {kfsb.lang.%loop-player%}
  1582. replace every "{victim}" with kfsbGetUsername(victim) in {_temp.%loop-player%}
  1583. replace every "{attacker}" with kfsbGetUsername(attacker) in {_temp.%loop-player%}
  1584. send {_temp.%loop-player%} to loop-player
  1585. else if "%damage cause%" is "fall":
  1586. send yaml value "chat-deathmessage-fellfromahighplace-you" from {kfsb.lang.%victim%} to victim
  1587. loop all players:
  1588. {kfsb.ingame::%loop-player%} is set
  1589. if loop-player is not victim:
  1590. set {_temp.%loop-player%} to yaml value "chat-deathmessage-fellfromahighplace" from {kfsb.lang.%loop-player%}
  1591. replace every "{victim}" with kfsbGetUsername(victim) in {_temp.%loop-player%}
  1592. send {_temp.%loop-player%} to loop-player
  1593. else:
  1594. send yaml value "chat-deathmessage-died-you" from {kfsb.lang.%victim%} to victim
  1595. loop all players:
  1596. {kfsb.ingame::%loop-player%} is set
  1597. if loop-player is not victim:
  1598. set {_temp.%loop-player%} to yaml value "chat-deathmessage-died" from {kfsb.lang.%loop-player%}
  1599. replace every "{victim}" with kfsbGetUsername(victim) in {_temp.%loop-player%}
  1600. send {_temp.%loop-player%} to loop-player
  1601. clear drops
  1602. loop all items of victim:
  1603. if name of loop-item contains "&1&2&3&4&r&1":
  1604. set {_uselessVariable} to true
  1605. else if name of loop-item contains "&1&2&3&4&b&1":
  1606. set {_uselessVariable} to true
  1607. else:
  1608. set {_dropLoc} to location 0.5 meters above victim
  1609. set x-coordinate of {_dropLoc} to x-coordinate of {_dropLoc} + 0.5
  1610. set z-coordinate of {_dropLoc} to z-coordinate of {_dropLoc} + 0.5
  1611. drop loop-item at {_dropLoc}
  1612. clear loop-item
  1613. kfsbDeathEvent(victim)
  1614.  
  1615. on place:
  1616. {kfsb.isSpectator::%player%} is not set
  1617. if {kfsb.ingame::%player%} is set:
  1618. if {kfsb.playerstatus::%player%} is "ingame":
  1619. if location of event-block is not within {kfsb.mapdata.pos1} to {kfsb.mapdata.pos2}:
  1620. cancel event
  1621. send yaml value "chat-cantplaceblocksthere" from {kfsb.lang.%player%}
  1622. else if event-block is blue wool:
  1623. player's tool's name contains "&1&2&3&4&b&1"
  1624. {kfsb.spawnmoving.blue} is true
  1625. delete {kfsb.spawnmoving.blue}
  1626. set {kfsb.mapdata.bluespawn} to location of event-block
  1627. loop all players:
  1628. {kfsb.ingame::%loop-player%} is set
  1629. {kfsb.team::%loop-player%} is "blue"
  1630. send yaml value "chat-spawnplaced" from {kfsb.lang.%loop-player%} to loop-player
  1631. kfsbPlaceHologram(loop-player)
  1632. else if event-block is red wool:
  1633. player's tool's name contains "&1&2&3&4&r&1"
  1634. {kfsb.spawnmoving.red} is true
  1635. delete {kfsb.spawnmoving.red}
  1636. set {kfsb.mapdata.redspawn} to location of event-block
  1637. loop all players:
  1638. {kfsb.ingame::%loop-player%} is set
  1639. {kfsb.team::%loop-player%} is "red"
  1640. send yaml value "chat-spawnplaced" from {kfsb.lang.%loop-player%} to loop-player
  1641. kfsbPlaceHologram(loop-player)
  1642.  
  1643. on damage:
  1644. if {kfsb.respawnCountdown.%victim%} is set:
  1645. cancel event
  1646. stop
  1647. if attacker is a player:
  1648. set {kfsb.lasthit::%victim%} to attacker
  1649.  
  1650.  
  1651. every 5 ticks:
  1652. loop all players:
  1653. set {_temp.%loop-player%} to loop-player.isOnGround()
  1654. if {_temp.%loop-player%} is true:
  1655. delete {kfsb.lasthit::%loop-player%}
  1656.  
  1657. on quit:
  1658. delete {kfsb.lasthit::%player%}
  1659. delete {kfsb.respawnCountdown.%player%}
  1660.  
  1661. on PlayerChatEvent with priority lowest:
  1662. set {_player} to event.getPlayer()
  1663. if {kfsb.ingame::%{_player}%} is set:
  1664. if {kfsb.status} is "ingame":
  1665. if {kfsb.playerstatus::%{_player}%} is "ingame":
  1666. cancel event
  1667. if {kfsb.isSpectator::%{_player}%} is set:
  1668. loop all players:
  1669. {kfsb.ingame::%loop-player%} is set
  1670. {kfsb.isSpectator::%loop-player%} is set
  1671. set {_temp.%loop-player%} to yaml value "chat-playerchat-spectator" from {kfsb.lang.%loop-player%}
  1672. replace every "{player}" with "%{_player}%" in {_temp.%loop-player%}
  1673. replace every "{message}" with event.getMessage() in {_temp.%loop-player%}
  1674. if {kfsb.team::%{_player}%} is "red":
  1675. replace every "{team}" with "&c[RED]" in {_temp.%loop-player%}
  1676. else if {kfsb.team::%{_player}%} is "blue":
  1677. replace every "{team}" with "&9[BLUE]" in {_temp.%loop-player%}
  1678. send {_temp.%loop-player%} to loop-player
  1679. stop
  1680. if {kfsb.shoutchat.%{_player}%} is set:
  1681. delete {kfsb.shoutchat.%{_player}%}
  1682. loop all players:
  1683. {kfsb.ingame::%loop-player%} is set
  1684. set {_temp.%loop-player%} to yaml value "chat-playerchat-shout" from {kfsb.lang.%loop-player%}
  1685. replace every "{player}" with "%{_player}%" in {_temp.%loop-player%}
  1686. replace every "{message}" with event.getMessage() in {_temp.%loop-player%}
  1687. if {kfsb.team::%{_player}%} is "red":
  1688. replace every "{team}" with "&c[RED]" in {_temp.%loop-player%}
  1689. else if {kfsb.team::%{_player}%} is "blue":
  1690. replace every "{team}" with "&9[BLUE]" in {_temp.%loop-player%}
  1691. send "%{_temp.%loop-player%}%" to loop-player
  1692. else:
  1693. loop all players:
  1694. {kfsb.ingame::%loop-player%} is set
  1695. {kfsb.team::%loop-player%} is {kfsb.team::%{_player}%}
  1696. set {_temp.%loop-player%} to yaml value "chat-playerchat-team" from {kfsb.lang.%loop-player%}
  1697. replace every "{player}" with "%{_player}%" in {_temp.%loop-player%}
  1698. replace every "{message}" with event.getMessage() in {_temp.%loop-player%}
  1699. if {kfsb.team::%{_player}%} is "red":
  1700. replace every "{team}" with "&c[RED]" in {_temp.%loop-player%}
  1701. else if {kfsb.team::%{_player}%} is "blue":
  1702. replace every "{team}" with "&9[BLUE]" in {_temp.%loop-player%}
  1703. send "%{_temp.%loop-player%}%" to loop-player
  1704. else if {kfsb.status} is "ending":
  1705. cancel event
  1706. loop all players:
  1707. {kfsb.ingame::%loop-player%} is set
  1708. set {_temp.%loop-player%} to yaml value "chat-playerchat-shout" from {kfsb.lang.%loop-player%}
  1709. replace every "{player}" with "%{_player}%" in {_temp.%loop-player%}
  1710. replace every "{message}" with event.getMessage() in {_temp.%loop-player%}
  1711. if {kfsb.team::%{_player}%} is "red":
  1712. replace every "{team}" with "&c[RED]" in {_temp.%loop-player%}
  1713. else if {kfsb.team::%{_player}%} is "blue":
  1714. replace every "{team}" with "&9[BLUE]" in {_temp.%loop-player%}
  1715. send "%{_temp.%loop-player%}%" to loop-player
  1716. else if {kfsb.playerstatus::%{_player}%} is not "ingame":
  1717. delete {kfsb.shoutchat.%{_player}%}
  1718. else:
  1719. delete {kfsb.shoutchat.%{_player}%}
  1720.  
  1721. every 5 ticks:
  1722. loop all players:
  1723. {kfsb.ingame::%loop-player%} is set
  1724. {kfsb.isSpectator::%loop-player%} is set
  1725. if {kfsb.blockloc.%loop-player%} is set:
  1726. if block at {kfsb.blockloc.%loop-player%} is not chest or furnace or dropper or dispenser or hopper or trapped chest:
  1727. close loop-player's inventory
  1728. delete {kfsb.blockloc.%loop-player%}
  1729. stop
  1730. set {_slot} to 0
  1731. loop 27 times:
  1732. set {_invitem::%{_slot}%} to slot {_slot} of block at {kfsb.blockloc.%loop-player%}'s inventory
  1733. create a gui slot {_slot} of loop-player with {_invitem::%{_slot}%}
  1734. add 1 to {_slot}
  1735. if loop-player does not have a gui:
  1736. delete {kfsb.blockloc.%loop-player%}
  1737.  
  1738. on drop:
  1739. if {kfsb.respawnCountdown.%player%} is set:
  1740. cancel event
  1741. stop
  1742. if {kfsb.isSpectator::%player%} is set:
  1743. cancel event
  1744. stop
  1745. if {kfsb.respawnCountdown.%player%} is set:
  1746. cancel event
  1747. stop
  1748.  
  1749. on pickup:
  1750. if {kfsb.respawnCountdown.%player%} is set:
  1751. cancel event
  1752. stop
  1753. if {kfsb.isSpectator::%player%} is set:
  1754. cancel event
  1755. stop
  1756. if {kfsb.respawnCountdown.%player%} is set:
  1757. cancel event
  1758. stop
  1759.  
  1760. on target:
  1761. if {kfsb.respawnCountdown.%player%} is set:
  1762. cancel event
  1763. stop
  1764. if {kfsb.isSpectator::%player%} is set:
  1765. cancel event
  1766. stop
  1767. if {kfsb.respawnCountdown.%player%} is set:
  1768. cancel event
  1769. stop
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement