CREAMPAN0408

Untitled

Feb 15th, 2019
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 85.51 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. on join:
  702. if {kfsb.lang.%player%} is not set:
  703. set {kfsb.lang.%player%} to player.getLocale()
  704. if {kfsb.langlist::*} does not contain {kfsb.lang.%player%}:
  705. set {kfsb.lang.%player%} to "{@DefaultLanguage}"
  706.  
  707. every 5 ticks:
  708. loop all players:
  709. {kfsb.ingame::%loop-player%} is set
  710. {kfsb.isSpectator::%loop-player%} is set
  711. loop all players:
  712. {kfsb.ingame::%loop-player-1%} is set
  713. hide loop-player-1 from loop-player-2
  714. else:
  715. reveal loop-player-1 to loop-player-2
  716. if size of {kfsb.ingame::*} >= {@NeededPlayersToStart}:
  717. if {kfsb.startCountDown} is not set:
  718. {kfsb.status} is not set
  719. set {kfsb.startCountDown} to {@StartingCountdownTime}
  720. while {kfsb.startCountDown} > 0:
  721. if {kfsb.startCountDown} >= 30:
  722. if {kfsb.startCountDown} is {@StartingCountdownTime}:
  723. loop all players:
  724. {kfsb.ingame::%loop-player%} is set
  725. play "BLOCK_NOTE_HAT" to loop-player at volume 10 at pitch 5
  726. set {_temp.%loop-player%} to yaml value "chat-starting-1" 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-1" 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} >= 20:
  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-2" 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-2" 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} >= 10:
  751. if {kfsb.startCountDown} is {@StartingCountdownTime}:
  752. loop all players:
  753. play "BLOCK_NOTE_HAT" to loop-player at volume 10 at pitch 5
  754. set {_temp.%loop-player%} to yaml value "chat-starting-3" from {kfsb.lang.%loop-player%}
  755. replace every "{seconds}" with "%{kfsb.startCountDown}%" in {_temp.%loop-player%}
  756. send {_temp.%loop-player%} to loop-player
  757. else if "%{kfsb.startCountDown}%".endsWith("0") is true:
  758. loop all players:
  759. {kfsb.ingame::%loop-player%} is set
  760. play "BLOCK_NOTE_HAT" to loop-player at volume 10 at pitch 5
  761. set {_temp.%loop-player%} to yaml value "chat-starting-3" from {kfsb.lang.%loop-player%}
  762. replace every "{seconds}" with "%{kfsb.startCountDown}%" in {_temp.%loop-player%}
  763. send {_temp.%loop-player%} to loop-player
  764. else if {kfsb.startCountDown} <= 5:
  765. loop all players:
  766. {kfsb.ingame::%loop-player%} is set
  767. play "BLOCK_NOTE_HAT" to loop-player at volume 10 at pitch 5
  768. set {_temp.%loop-player%} to yaml value "chat-starting-4" from {kfsb.lang.%loop-player%}
  769. replace every "{seconds}" with "%{kfsb.startCountDown}%" in {_temp.%loop-player%}
  770. if {kfsb.startCountDown} is not 1:
  771. replace every "{s}" with "s" in {_temp.%loop-player%}
  772. else:
  773. replace every "{s}" with "" in {_temp.%loop-player%}
  774. send {_temp.%loop-player%} to loop-player
  775. wait 1 second
  776. if size of {kfsb.ingame::*} is bigger than or equal to {@NeededPlayersToStart}:
  777. remove 1 from {kfsb.startCountDown}
  778. if size of {kfsb.ingame::*} is smaller than {@NeededPlayersToStart}:
  779. stop
  780. set {kfsb.status} to "ingame"
  781. loop {kfsb.map::*}:
  782. delete {kfsb.validmap::%loop-index%}
  783. {kfsb.location::%loop-index%::redspawn} is set
  784. {kfsb.location::%loop-index%::bluespawn} is set
  785. {kfsb.location::%loop-index%::pos1} is set
  786. {kfsb.location::%loop-index%::pos2} is set
  787. set {kfsb.validmap::%loop-index%} to loop-value
  788. loop {kfsb.validmap::*}:
  789. if size of {kfsb.votes.%loop-value%::*} is not 0:
  790. set {_votecheck::%loop-value%} to size of {kfsb.votes.%loop-value%::*}
  791. set {_sortedcheck::*} to sorted {_votecheck::*}
  792. if size of {_votecheck::*} is 0:
  793. set {kfsb.selectedMap} to random object out of {kfsb.validmap::*}
  794. else:
  795. loop {kfsb.validmap::*}:
  796. if size of {kfsb.votes.%loop-value%::*} is {_sortedcheck::1}:
  797. set {_finalcheck::%loop-value%} to loop-value
  798. set {kfsb.selectedMap} to random object out of {_finalcheck::*}
  799. delete {kfsb.startCountDown}
  800. set {_teamplayers1} to floor(size of {kfsb.ingame::*} / 2)
  801. set {_teamplayers2} to size of {kfsb.ingame::*} - {_teamplayers1}
  802. set {_team1} to random object out of "red" or "blue"
  803. if {_team1} is "red":
  804. set {_team2} to "blue"
  805. set {kfsb.nextjointeam} to "red"
  806. if {_team1} is "blue":
  807. set {_team2} to "red"
  808. set {kfsb.nextjointeam} to "blue"
  809. loop all players:
  810. {kfsb.ingame::%loop-player%} is set
  811. set {_selectPlayers::%loop-player%} to loop-player
  812. loop {_teamplayers1} times:
  813. set {_selectedPlayer} to random object out of {_selectPlayers::*}
  814. delete {_selectPlayers::%{_selectedPlayer}%}
  815. set {kfsb.%{_team1}%team::%{_selectedPlayer}%} to {_selectedPlayer}
  816. set {kfsb.team::%{_selectedPlayer}%} to {_team1}
  817. loop all players:
  818. {kfsb.ingame::%loop-player%} is set
  819. {_selectPlayers::%loop-player%} is set
  820. set {kfsb.%{_team2}%team::%loop-player%} to loop-player
  821. set {kfsb.team::%loop-player%} to {_team2}
  822. set {_world} to world of {kfsb.location::%{kfsb.selectedMap}%::pos1}
  823. execute console command "multiverse-core:mv delete {@MapHandlerName}"
  824. execute console command "multiverse-core:mvconfirm"
  825. execute console command "multiverse-core:mv clone %{_world}% {@MapHandlerName}"
  826. execute console command "multiverse-core:mv modify set mode survival {@MapHandlerName}"
  827. execute console command "multiverse-core:mv gamerule doDaylightCycle false {@MapHandlerName}"
  828. execute console command "multiverse-core:mv gamerule doWeatherCycle false {@MapHandlerName}"
  829. execute console command "multiverse-core:mv gamerule doMobSpawning false {@MapHandlerName}"
  830. execute console command "multiverse-core:mv gamerule doMobLoot false {@MapHandlerName}"
  831. execute console command "multiverse-core:mv gamerule doTileDrops true {@MapHandlerName}"
  832. execute console command "multiverse-core:mv gamerule mobGriefing false {@MapHandlerName}"
  833. set {kfsb.mapdata.redspawn} to {kfsb.location::%{kfsb.selectedMap}%::redspawn}
  834. set world of {kfsb.mapdata.redspawn} to "{@MapHandlerName}" parsed as a world
  835. set {kfsb.mapdata.bluespawn} to {kfsb.location::%{kfsb.selectedMap}%::bluespawn}
  836. set world of {kfsb.mapdata.bluespawn} to "{@MapHandlerName}" parsed as a world
  837. set {kfsb.mapdata.pos1} to {kfsb.location::%{kfsb.selectedMap}%::pos1}
  838. set world of {kfsb.mapdata.pos1} to "{@MapHandlerName}" parsed as a world
  839. set {kfsb.mapdata.pos2} to {kfsb.location::%{kfsb.selectedMap}%::pos2}
  840. set world of {kfsb.mapdata.pos2} to "{@MapHandlerName}" parsed as a world
  841. set block at {kfsb.mapdata.redspawn} to red wool
  842. set block at {kfsb.mapdata.bluespawn} to blue wool
  843. set {kfsb.redstatus} to "&a?"
  844. set {kfsb.bluestatus} to "&a?"
  845. delete {kfsb.spawnmoving.red}
  846. delete {kfsb.spawnmoving.blue}
  847. delete {kfsb.spawnbroken.red}
  848. delete {kfsb.spawnbroken.blue}
  849. loop {kfsb.redalive::*}:
  850. delete {kfsb.redalive::%loop-index%}
  851. loop {kfsb.bluealive::*}:
  852. delete {kfsb.bluealive::%loop-index%}
  853. loop all players:
  854. {kfsb.ingame::%loop-player%} is set
  855. clear loop-player's inventory
  856. set loop-player's gamemode to survival
  857. set {kfsb.kills::%loop-player%} to 0
  858. set {kfsb.playerstatus::%loop-player%} to "ingame"
  859. if {kfsb.team::%loop-player%} is "red":
  860. kfsbSetFacing(loop-player, "%{kfsb.redfacing.%{kfsb.selectedMap}%}%", {kfsb.mapdata.redspawn})
  861. set {kfsb.redalive::%loop-player%} to loop-player
  862. else if {kfsb.team::%loop-player%} is "blue":
  863. kfsbSetFacing(loop-player, "%{kfsb.bluefacing.%{kfsb.selectedMap}%}%", {kfsb.mapdata.bluespawn})
  864. set {kfsb.bluealive::%loop-player%} to loop-player
  865. send yaml value "chat-greenbar" from {kfsb.lang.%loop-player%} to loop-player
  866. set {_line} to 1
  867. loop 10 times:
  868. loop all players:
  869. {kfsb.ingame::%loop-player%} is set
  870. send centered yaml value "chat-description-%{_line}%" from {kfsb.lang.%loop-player%} to loop-player
  871. add 1 to {_line}
  872. loop all players:
  873. {kfsb.ingame::%loop-player%} is set
  874. send yaml value "chat-greenbar" from {kfsb.lang.%loop-player%} to loop-player
  875. send yaml value "chat-spawntip" from {kfsb.lang.%loop-player%} to loop-player
  876. send yaml value "chat-shouttip" from {kfsb.lang.%loop-player%} to loop-player
  877. kfsbPlaceHologram(loop-player)
  878. if {kfsb.spawnbroken.red} is set:
  879. if size of {kfsb.redalive::*} is 0:
  880. set {kfsb.redstatus} to "&c?"
  881. else:
  882. set {kfsb.redstatus} to "&e%size of {kfsb.redalive::*}%"
  883. else:
  884. set {kfsb.redstatus} to "&a?"
  885. if {kfsb.spawnbroken.blue} is set:
  886. if size of {kfsb.bluealive::*} is 0:
  887. set {kfsb.bluestatus} to "&c?"
  888. else:
  889. set {kfsb.bluestatus} to "&e%size of {kfsb.bluealive::*}%"
  890. else:
  891. set {kfsb.bluestatus} to "&a?"
  892. if {kfsb.status} is "ingame":
  893. if size of {kfsb.ingame::*} < {@NeededPlayersToStart}:
  894. kfsbResetGame()
  895. loop all players:
  896. if {kfsb.playerstatus::%loop-player%} is "ingame":
  897. if location of loop-player is not within {kfsb.mapdata.pos1} to {kfsb.mapdata.pos2}:
  898. set {_temp} to loop-player.isOnGround()
  899. if {_temp} is true:
  900. teleport loop-player to {kfsb.playerlocation.%loop-player%}
  901. else:
  902. set {kfsb.playerlocation.%loop-player%} to location of loop-player
  903. loop all players:
  904. if {kfsb.ingame::%loop-player%} is set:
  905. if {kfsb.playerstatus::%loop-player%} is not set:
  906. set loop-player's health to 10
  907. set loop-player's saturation to 10
  908. set loop-player's level to 0
  909. set loop-player's level progress to 0
  910. set loop-player's hunger to 10
  911. kfsbUpdateScoreboard(loop-player)
  912. if {kfsb.selfsetlang.%loop-player%} isn't set:
  913. set {kfsb.lang.%loop-player%} to loop-player.getLocale()
  914. if {kfsb.langlist::*} does not contain {kfsb.lang.%loop-player%}:
  915. set {kfsb.lang.%loop-player%} to "{@DefaultLanguage}"
  916. if {kfsb.status} is "ingame":
  917. if size of {kfsb.redalive::*} is smaller than 1:
  918. set {kfsb.status} to "ending"
  919. set {kfsb.winteam} to "blue"
  920. kfsbEndgame()
  921. if size of {kfsb.bluealive::*} is smaller than 1:
  922. set {kfsb.status} to "ending"
  923. set {kfsb.winteam} to "red"
  924. kfsbEndgame()
  925.  
  926. command /SphereBattle [<text>] [<text>] [<text>] [<text>]:
  927. aliases: /sb, /sphere
  928. trigger:
  929. if arg 1 is "setlang" or "lang":
  930. if arg 2 isn't set:
  931. send skript-yaml value "detecting-language" from "%{kfsb.lang.%player%}%"
  932. set {kfsb.lang.%player%} to player.getLocale()
  933. delete {kfsb.selfsetlang.%player%}
  934. else:
  935. set {kfsb.selfsetlang.%player%} to 1
  936. set {kfsb.lang.%player%} to arg 2
  937. if {kfsb.langlist::*} does not contain {kfsb.lang.%player%}:
  938. set {kfsb.lang.%player%} to "{@DefaultLanguage}"
  939. send skript-yaml value "language-detected" from "%{kfsb.lang.%player%}%"
  940. if arg 1 is "reload":
  941. if player doesn't have permission "kfsb.reload":
  942. send yaml value "no-permission" from "%{kfsb.lang.%player%}%"
  943. else:
  944. loop {kfsb.langlist::*}:
  945. delete {kfsb.langlist::%loop-index%}
  946. loop directory "plugins/Skript/scripts/SphereBattle/lang/"'s files:
  947. if loop-string.endsWith(".yml") is true:
  948. set {_temp} to relative path of loop-string
  949. set {_temp2} to {_temp}
  950. replace every ".yml" with "" in {_temp}
  951. replace every "plugins/Skript/scripts/SphereBattle/lang/" with "" in {_temp}
  952. replace every "plugins\Skript\scripts\SphereBattle\lang\" with "" in {_temp}
  953. load yaml "%{_temp2}%" as "%{_temp}%"
  954. set {kfsb.langlist::%{_temp}%} to {_temp}
  955. send yaml value "reloaded" from "%{kfsb.lang.%player%}%"
  956. if arg 1 is not set:
  957. set {_showHelp} to true
  958. else if arg 1 is "help":
  959. set {_showHelp} to true
  960. if {_showHelp} is true:
  961. send yaml value "command-help" from "%{kfsb.lang.%player%}%"
  962. if arg 1 is "admin":
  963. if player has permission "spherebattle.admin":
  964. if arg 2 is not set:
  965. set {_showHelp} to true
  966. else if arg 2 is "help":
  967. set {_showHelp} to true
  968. if {_showHelp} is true:
  969. send yaml value "command-admin-help" from {kfsb.lang.%player%}
  970. else if arg 2 is "addmap":
  971. if arg 3 is not set:
  972. send yaml value "command-addmap-noname" from {kfsb.lang.%player%}
  973. else if {kfsb.map::%arg 3%} is set:
  974. send yaml value "command-addmap-dupe" from {kfsb.lang.%player%}
  975. else:
  976. set {_temp} to yaml value "command-addmap-success" from {kfsb.lang.%player%}
  977. replace every "{mapname}" with arg 3 in {_temp}
  978. send {_temp}
  979. set {kfsb.map::%arg 3%} to arg 3
  980. else if arg 2 is "removemap":
  981. if arg 3 is not set:
  982. send yaml value "command-removemap-noname" from {kfsb.lang.%player%}
  983. else if {kfsb.map::%arg 3%} is not set:
  984. send yaml value "command-removemap-unexist" from {kfsb.lang.%player%}
  985. else:
  986. set {_temp} to yaml value "command-removemap-success" from {kfsb.lang.%player%}
  987. replace every "{mapname}" with arg 3 in {_temp}
  988. send {_temp}
  989. delete {kfsb.map::%arg 3%}
  990. delete {kfsb.location::%arg 3%::redspawn}
  991. delete {kfsb.location::%arg 3%::bluespawn}
  992. delete {kfsb.location::%arg 3%::pos1}
  993. delete {kfsb.location::%arg 3%::pos2}
  994. delete {kfsb.redfacing.%arg 3%}
  995. delete {kfsb.bluefacing.%arg 3%}
  996. else if arg 2 is "setspawn":
  997. if arg 3 is not set:
  998. send yaml value "command-setspawn-nomap" from {kfsb.lang.%player%}
  999. else if {kfsb.map::%arg 3%} is not set:
  1000. send yaml value "command-setspawn-mapunexist" from {kfsb.lang.%player%}
  1001. else if arg 4 is not set:
  1002. send yaml value "command-setspawn-noteam" from {kfsb.lang.%player%}
  1003. else if arg 4 is not "red" or "blue":
  1004. send yaml value "command-setspawn-invalidteam" from {kfsb.lang.%player%}
  1005. else:
  1006. set {_temp} to yaml value "command-setspawn-success" from {kfsb.lang.%player%}
  1007. replace every "{team}" with arg 4 in {_temp}
  1008. replace every "{mapname}" with arg 3 in {_temp}
  1009. send {_temp}
  1010. set {_loc} to location of player
  1011. if arg 4 is "red":
  1012. set {_temp} to red wool
  1013. else if arg 4 is "blue":
  1014. set {_temp} to blue wool
  1015. set block at {_loc} to {_temp}
  1016. set {kfsb.location::%arg 3%::%uncolored arg 4%spawn} to location of block at {_loc}
  1017. set {kfsb.%uncolored arg 4%facing.%arg 3%} to facing of player
  1018. kfsbSetFacing(player, "%{kfsb.%uncolored arg 4%facing.%arg 3%}%", location above {kfsb.location::%arg 3%::%uncolored arg 4%spawn})
  1019. else if arg 2 is "wand":
  1020. send yaml value "command-wand-success" from {kfsb.lang.%player%}
  1021. set {_itemname} to yaml value "item-wand-name" from {kfsb.lang.%player%}
  1022. set {_itemname} to "%{_itemname}%&1&2&3&4&f&r"
  1023. give player 1 of glowing blaze rod named {_itemname} with lore yaml value "item-wand-lore" from {kfsb.lang.%player%}
  1024. else if arg 2 is "setregion":
  1025. if arg 3 is not set:
  1026. send yaml value "command-setregion-noname" from {kfsb.lang.%player%}
  1027. else if {kfsb.map::%arg 3%} is not set:
  1028. send yaml value "command-setregion-unexist" from {kfsb.lang.%player%}
  1029. else if {kfsb.selection.pos1.%player%} is not set:
  1030. send yaml value "command-setregion-noregion" from {kfsb.lang.%player%}
  1031. else if {kfsb.selection.pos2.%player%} is not set:
  1032. send yaml value "command-setregion-noregion" from {kfsb.lang.%player%}
  1033. else:
  1034. set {_temp} to yaml value "command-setregion-success" from {kfsb.lang.%player%}
  1035. replace every "{mapname}" with arg 3 in {_temp}
  1036. set {kfsb.location::%arg 3%::pos1} to {kfsb.selection.pos1.%player%}
  1037. set {kfsb.location::%arg 3%::pos2} to {kfsb.selection.pos2.%player%}
  1038. send {_temp}
  1039. else if arg 2 is "setlobby":
  1040. send yaml value "command-setlobby-success" from {kfsb.lang.%player%}
  1041. set {kfsb.lobby} to location of player
  1042. if pitch of {kfsb.lobby} is 0:
  1043. set pitch of {kfsb.lobby} to 0.01
  1044. if yaw of {kfsb.lobby} is 0:
  1045. set yaw of {kfsb.lobby} to 0.01
  1046. teleport player to {kfsb.lobby}
  1047. else if arg 2 is "start":
  1048. if {kfsb.status} is not set:
  1049. if size of {kfsb.ingame::*} >= {@NeededPlayersToStart}:
  1050. send yaml value "command-start-success" from {kfsb.lang.%player%}
  1051. set {kfsb.startCountDown} to 1
  1052. else:
  1053. send yaml value "command-start-notenough" from {kfsb.lang.%player%}
  1054. else:
  1055. send yaml value "command-start-alreadystarted" from {kfsb.lang.%player%}
  1056. else:
  1057. send yaml value "no-permission" from {kfsb.lang.%player%}
  1058. else if arg 1 is "join":
  1059. kfsbJoinGame(player)
  1060. else if arg 1 is "leave":
  1061. kfsbLeaveGame(player)
  1062. else if arg 1 is "vote":
  1063. if {kfsb.ingame::%player%} is set:
  1064. if {kfsb.playerstatus::%{_player}%} is not set:
  1065. if arg 2 is not set:
  1066. send yaml value "command-vote-unvote" from {kfsb.lang.%player%}
  1067. delete {kfsb.votes.%{kfsb.lastvotedmap::%player%}%::%player%}
  1068. if player has a gui:
  1069. kfsbOpenMapVoteGui(player)
  1070. else if {kfsb.map::%arg 2%} is not set:
  1071. send yaml value "command-vote-unexist" from {kfsb.lang.%player%}
  1072. else:
  1073. delete {kfsb.votes.%{kfsb.lastvotedmap::%player%}%::%player%}
  1074. set {_temp} to yaml value "command-vote-success" from {kfsb.lang.%player%}
  1075. replace every "{mapname}" with arg 2 in {_temp}
  1076. send {_temp}
  1077. set {kfsb.lastvotedmap::%player%} to arg 2
  1078. set {kfsb.votes.%arg 2%::%player%} to true
  1079. if player has a gui:
  1080. kfsbOpenMapVoteGui(player)
  1081. loop all players:
  1082. if loop-player has a gui:
  1083. if inventory name of loop-player's current inventory contains "&1&2&3&4&e&o":
  1084. kfsbOpenMapVoteGui(loop-player)
  1085. else:
  1086. send yaml value "command-vote-disabled" from {kfsb.lang.%player%}
  1087. else:
  1088. send yaml value "command-vote-disabled" from {kfsb.lang.%player%}
  1089. else if arg 1 is "shout":
  1090. if {kfsb.ingame::%player%} is set:
  1091. if {kfsb.playerstatus::%player%} is "ingame" or "ending":
  1092. if arg 2 is not set:
  1093. send yaml value "command-shout-nomessage" from {kfsb.lang.%player%}
  1094. else:
  1095. set {kfsb.shoutchat.%player%} to true
  1096. set {_temp} to arg 2
  1097. if arg 3 is set:
  1098. set {_temp} to "%arg 2% %arg 3%"
  1099. if arg 4 is set:
  1100. set {_temp} to "%arg 2% %arg 3% %arg 4%"
  1101. player.chat({_temp})
  1102. else:
  1103. send yaml value "command-shout-disabled" from {kfsb.lang.%player%}
  1104. else:
  1105. send yaml value "command-shout-disabled" from {kfsb.lang.%player%}
  1106.  
  1107. on break:
  1108. if {kfsb.respawnCountdown.%player%} is set:
  1109. cancel event
  1110. stop
  1111. if name of player's tool contains "&1&2&3&4&f&r":
  1112. player has permission "spherebattle.admin"
  1113. cancel event
  1114.  
  1115. on left click:
  1116. if name of player's tool contains "&1&2&3&4&f&r":
  1117. player's target block is set
  1118. player has permission "spherebattle.admin"
  1119. set {_temp} to yaml value "chat-wand-pos1" from {kfsb.lang.%player%}
  1120. replace every "{location}" with "%location of target block%" in {_temp}
  1121. set {kfsb.selection.pos1.%player%} to location of target block
  1122. send {_temp}
  1123.  
  1124. on right click:
  1125. if {kfsb.isSpectator::%player%} is set:
  1126. cancel event
  1127. if name of player's tool contains "&1&2&3&4&f&r":
  1128. player's target block is set
  1129. player has permission "spherebattle.admin"
  1130. cancel event
  1131. set {_temp} to yaml value "chat-wand-pos2" from {kfsb.lang.%player%}
  1132. replace every "{location}" with "%location of target block%" in {_temp}
  1133. set {kfsb.selection.pos2.%player%} to location of target block
  1134. send {_temp}
  1135. else if name of player's tool contains "&1&2&3&4&e&o":
  1136. {kfsb.ingame::%player%} is set
  1137. kfsbOpenMapVoteGui(player)
  1138. else if name of player's tool contains "&1&2&3&4&r&e&m":
  1139. {kfsb.ingame::%player%} is set
  1140. kfsbOpenTeleporterGui(player)
  1141. else if {kfsb.ingame::%player%} is set:
  1142. if {kfsb.isSpectator::%player%} is set:
  1143. cancel event
  1144. if target block of player is chest:
  1145. open "CHEST" to player
  1146. set {_opened} to true
  1147. if target block of player is furnace:
  1148. open "FURNACE" to player
  1149. set {_opened} to true
  1150. if target block of player is hopper:
  1151. open "HOPPER" to player
  1152. set {_opened} to true
  1153. if target block of player is dispenser:
  1154. open "DISPENSER" to player
  1155. set {_opened} to true
  1156. if target block of player is dropper:
  1157. open "DROPPER" to player
  1158. set {_opened} to true
  1159. if target block of player is trapped chest:
  1160. open "CHEST" to player
  1161. set {_opened} to true
  1162. if {_opened} is true:
  1163. set {ksfb.blockloc.%player%} to location of target block of player
  1164. set {_slot} to 0
  1165. loop 27 times:
  1166. set {_invitem::%{_slot}%} to slot {_slot} of target block of player's inventory
  1167. create a gui slot {_slot} of player with {_invitem::%{_slot}%}
  1168. add 1 to {_slot}
  1169.  
  1170. on quit:
  1171. kfsbLeaveGame(player)
  1172. delete {kfsb.selection.pos1.%player%}
  1173. delete {kfsb.selection.pos2.%player%}
  1174.  
  1175. on place:
  1176. if {kfsb.respawnCountdown.%player%} is set:
  1177. cancel event
  1178. stop
  1179. if {kfsb.isSpectator::%player%} is set:
  1180. cancel event
  1181. stop
  1182. if {kfsb.ingame::%player%} is set:
  1183. if {kfsb.playerstatus::%player%} is not set:
  1184. cancel event
  1185. stop
  1186. if {kfsb.respawnCountdown.%player%} is set:
  1187. cancel event
  1188. stop
  1189.  
  1190. on break:
  1191. if {kfsb.isSpectator::%player%} is set:
  1192. cancel event
  1193. stop
  1194. if {kfsb.respawnCountdown.%player%} is set:
  1195. cancel event
  1196. stop
  1197. if {kfsb.ingame::%player%} is set:
  1198. if {kfsb.playerstatus::%player%} is not set:
  1199. cancel event
  1200. else if {kfsb.playerstatus::%player%} is "ingame":
  1201. if location of event-block is not within {kfsb.mapdata.pos1} to {kfsb.mapdata.pos2}:
  1202. cancel event
  1203. send yaml value "chat-cantbreakblocksthere" from {kfsb.lang.%player%}
  1204. else if event-block is blue wool:
  1205. if {kfsb.team::%player%} is "blue":
  1206. "%{kfsb.mapdata.bluespawn}%" is "%location of event-block%"
  1207. cancel event
  1208. set block at location of event-block to air
  1209. set {_temp} to yaml value "item-bluespawn-name" from {kfsb.lang.%player%}
  1210. set {_itemname} to "%{_temp}%&1&2&3&4&b&1"
  1211. give blue wool named {_itemname} to player
  1212. set {kfsb.spawnmoving.blue} to true
  1213. loop all players:
  1214. {kfsb.ingame::%loop-player%} is set
  1215. {kfsb.team::%loop-player%} is "blue"
  1216. send yaml value "chat-spawnismoving" from {kfsb.lang.%loop-player%} to loop-player
  1217. kfsbDeleteHologram(loop-player)
  1218. else:
  1219. "%{kfsb.mapdata.bluespawn}%" is "%location of event-block%"
  1220. cancel event
  1221. set block at location of event-block to air
  1222. set {kfsb.spawnmoving.blue} to true
  1223. set {kfsb.spawnbroken.blue} to true
  1224. loop all players:
  1225. {kfsb.ingame::%loop-player%} is set
  1226. set {_temp.%loop-player%} to yaml value "chat-spawnbroke-blue-broadcast" from {kfsb.lang.%loop-player%}
  1227. replace every "{player}" with kfsbGetUsername(player) in {_temp.%loop-player%}
  1228. send {_temp.%loop-player%} to loop-player
  1229. {kfsb.team::%loop-player%} is "blue"
  1230. kfsbDeleteHologram(loop-player)
  1231. set {_temp.%loop-player%} to yaml value "chat-spawnbroke" from {kfsb.lang.%loop-player%}
  1232. replace every "{player}" with kfsbGetUsername(player) in {_temp.%loop-player%}
  1233. send {_temp.%loop-player%} to loop-player
  1234. play "ENTITY_ENDERDRAGON_GROWL" to loop-player at volume 10 at pitch 5
  1235. 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
  1236. else if event-block is red wool:
  1237. if {kfsb.team::%player%} is "red":
  1238. "%{kfsb.mapdata.redspawn}%" is "%location of event-block%"
  1239. cancel event
  1240. set block at location of event-block to air
  1241. set {_temp} to yaml value "item-redspawn-name" from {kfsb.lang.%player%}
  1242. set {_itemname} to "%{_temp}%&1&2&3&4&r&1"
  1243. give red wool named {_itemname} to player
  1244. set {kfsb.spawnmoving.red} to true
  1245. loop all players:
  1246. {kfsb.ingame::%loop-player%} is set
  1247. {kfsb.team::%loop-player%} is "red"
  1248. send yaml value "chat-spawnismoving" from {kfsb.lang.%loop-player%} to loop-player
  1249. kfsbDeleteHologram(loop-player)
  1250. else:
  1251. set {kfsb.spawnmoving.red} to true
  1252. set {kfsb.spawnbroken.red} to true
  1253. loop all players:
  1254. "%{kfsb.mapdata.redspawn}%" is "%location of event-block%"
  1255. cancel event
  1256. set block at location of event-block to air
  1257. {kfsb.ingame::%loop-player%} is set
  1258. set {_temp.%loop-player%} to yaml value "chat-spawnbroke-red-broadcast" from {kfsb.lang.%loop-player%}
  1259. replace every "{player}" with kfsbGetUsername(player) in {_temp.%loop-player%}
  1260. send {_temp.%loop-player%} to loop-player
  1261. {kfsb.team::%loop-player%} is "red"
  1262. kfsbDeleteHologram(loop-player)
  1263. set {_temp.%loop-player%} to yaml value "chat-spawnbroke" from {kfsb.lang.%loop-player%}
  1264. replace every "{player}" with kfsbGetUsername(player) in {_temp.%loop-player%}
  1265. send {_temp.%loop-player%} to loop-player
  1266. play "ENTITY_ENDERDRAGON_GROWL" to loop-player at volume 10 at pitch 5
  1267. 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
  1268.  
  1269. on drop:
  1270. if {kfsb.isSpectator::%player%} is set:
  1271. cancel event
  1272. stop
  1273. if {kfsb.ingame::%player%} is set:
  1274. if {kfsb.playerstatus::%player%} is not set:
  1275. cancel event
  1276. else if {kfsb.playerstatus::%player%} is "ingame":
  1277. if name of event-item contains "&1&2&3&4&b&1":
  1278. cancel event
  1279. else if name of event-item contains "&1&2&3&4&r&1":
  1280. cancel event
  1281.  
  1282. on PlayerSwapHandItemsEvent:
  1283. set {_player} to event.getPlayer()
  1284. if name of event.getOffHandItem() contains "&1&2&3&4&b&1":
  1285. cancel event
  1286. if name of event.getOffHandItem() contains "&1&2&3&4&r&1":
  1287. cancel event
  1288. if {kfsb.isSpectator::%{_player}%} is set:
  1289. cancel event
  1290. stop
  1291. if {kfsb.ingame::%{_player}%} is set:
  1292. if {kfsb.playerstatus::%{_player}%} is not set:
  1293. cancel event
  1294.  
  1295. on inventory click:
  1296. send "%name of event-item%" to console
  1297. if clicked item is blue wool:
  1298. clicked item's name contains "&1&2&3&4&b&1"
  1299. cancel event
  1300. if clicked item is red wool:
  1301. clicked item's name contains "&1&2&3&4&r&1"
  1302. cancel event
  1303. if {kfsb.isSpectator::%player%} is set:
  1304. cancel event
  1305. stop
  1306. if {kfsb.ingame::%player%} is set:
  1307. if {kfsb.playerstatus::%player%} is not set:
  1308. cancel event
  1309.  
  1310. on damage:
  1311. if {kfsb.respawnCountdown.%victim%} is set:
  1312. cancel event
  1313. if {kfsb.respawnCountdown.%attacker%} is set:
  1314. cancel event
  1315. if {kfsb.isSpectator::%victim%} is set:
  1316. cancel event
  1317. if {kfsb.isSpectator::%attacker%} is set:
  1318. cancel event
  1319. victim is a player
  1320. if {kfsb.ingame::%victim%} is set:
  1321. if {kfsb.playerstatus::%victim%} is not set:
  1322. cancel event
  1323. else if {kfsb.status} is "ingame":
  1324. if {kfsb.team::%attacker%} is {kfsb.team::%victim%}:
  1325. cancel event
  1326. stop
  1327. else if {kfsb.status} is "ending":
  1328. cancel event
  1329.  
  1330. on death of player:
  1331. {kfsb.ingame::%player%} is set
  1332. delete {kfsb.noSetSpectator.%victim%}
  1333. set death message to ""
  1334. if victim's tool is totem of undying:
  1335. "%damage cause%" is not "void"
  1336. stop
  1337. if {kfsb.spawnmoving.%{kfsb.team::%victim%}%} is not set:
  1338. heal victim
  1339. set victim's health to 10
  1340. set victim's max health to 10
  1341. set victim's health to 10
  1342. set victim's hunger to 10
  1343. set victim's level to 0
  1344. set victim's level progress to 0
  1345. set victim's saturation to 10
  1346. set victim's health to 10
  1347. loop all items of victim:
  1348. clear loop-item
  1349. clear potion effects of victim
  1350. if "%damage cause%" is "void":
  1351. set {kfsb.nodeathaction.%victim%} to true
  1352. if {kfsb.lasthit::%victim%} is set:
  1353. add 1 to {kfsb.kills::%{kfsb.lasthit::%victim%}%}
  1354. play "ENTITY_EXPERIENCE_ORB_PICKUP" to {kfsb.lasthit::%victim%} at volume 10 at pitch 5
  1355. set {_temp} to yaml value "chat-deathmessage-knockedintothevoid-you" from {kfsb.lang.%victim%}
  1356. replace every "{attacker}" with kfsbGetUsername({kfsb.lasthit::%victim%}) in {_temp}
  1357. send {_temp} to victim
  1358. loop all players:
  1359. {kfsb.ingame::%loop-player%} is set
  1360. if loop-player is not victim:
  1361. set {_temp.%loop-player%} to yaml value "chat-deathmessage-knockedintothevoid" from {kfsb.lang.%loop-player%}
  1362. replace every "{victim}" with kfsbGetUsername(victim) in {_temp.%loop-player%}
  1363. replace every "{attacker}" with kfsbGetUsername({kfsb.lasthit::%victim%}) in {_temp.%loop-player%}
  1364. send {_temp.%loop-player%} to loop-player
  1365. else:
  1366. send yaml value "chat-deathmessage-fellintothevoid-you" from {kfsb.lang.%victim%} to victim
  1367. loop all players:
  1368. {kfsb.ingame::%loop-player%} is set
  1369. if loop-player is not victim:
  1370. {kfsb.ingame::%loop-player%} is set
  1371. set {_temp.%loop-player%} to yaml value "chat-deathmessage-fellintothevoid" from {kfsb.lang.%loop-player%}
  1372. replace every "{victim}" with kfsbGetUsername(victim) in {_temp.%loop-player%}
  1373. send {_temp.%loop-player%} to loop-player
  1374. else if attacker is a player:
  1375. add 1 to {kfsb.kills::%attacker%}
  1376. play "ENTITY_EXPERIENCE_ORB_PICKUP" to attacker at volume 10 at pitch 5
  1377. set {_temp} to yaml value "chat-deathmessage-killed-you" from {kfsb.lang.%victim%}
  1378. replace every "{attacker}" with kfsbGetUsername(attacker) in {_temp}
  1379. send {_temp} to victim
  1380. loop all players:
  1381. {kfsb.ingame::%loop-player%} is set
  1382. if loop-player is not victim:
  1383. set {_temp.%loop-player%} to yaml value "chat-deathmessage-killed" from {kfsb.lang.%loop-player%}
  1384. replace every "{victim}" with kfsbGetUsername(victim) in {_temp.%loop-player%}
  1385. replace every "{attacker}" with kfsbGetUsername(attacker) in {_temp.%loop-player%}
  1386. send {_temp.%loop-player%} to loop-player
  1387. else if "%damage cause%" is "fall":
  1388. send yaml value "chat-deathmessage-fellfromahighplace-you" from {kfsb.lang.%victim%} to victim
  1389. loop all players:
  1390. {kfsb.ingame::%loop-player%} is set
  1391. if loop-player is not victim:
  1392. set {_temp.%loop-player%} to yaml value "chat-deathmessage-fellfromahighplace" from {kfsb.lang.%loop-player%}
  1393. replace every "{victim}" with kfsbGetUsername(victim) in {_temp.%loop-player%}
  1394. send {_temp.%loop-player%} to loop-player
  1395. else:
  1396. send yaml value "chat-deathmessage-died-you" from {kfsb.lang.%victim%} to victim
  1397. loop all players:
  1398. {kfsb.ingame::%loop-player%} is set
  1399. if loop-player is not victim:
  1400. set {_temp.%loop-player%} to yaml value "chat-deathmessage-died" from {kfsb.lang.%loop-player%}
  1401. replace every "{victim}" with kfsbGetUsername(victim) in {_temp.%loop-player%}
  1402. send {_temp.%loop-player%} to loop-player
  1403. set {_stayLocation.%victim%} to location of victim
  1404. victim.setAllowFlight(true)
  1405. victim.setFlying(true)
  1406. apply blindness without particles to victim for 9999 days
  1407. set {kfsb.respawnCountdown.%victim%} to "{@RespawnCooldownTime}" parsed as integer
  1408. hide victim from all players
  1409. loop {@RespawnCooldownTime} times:
  1410. if {kfsb.ingame::%victim%} is not set:
  1411. stop
  1412. play "BLOCK_NOTE_HAT" to victim at volume 10 at pitch 5
  1413. set {_temp} to yaml value "chat-respawning" from {kfsb.lang.%victim%}
  1414. replace every "{seconds}" with "%{kfsb.respawnCountdown.%victim%}%" in {_temp}
  1415. if {kfsb.respawnCountDown.%victim%} < 2:
  1416. replace every "{s}" with "" in {_temp}
  1417. else:
  1418. replace every "{s}" with "s" in {_temp}
  1419. set {_temp2} to {_temp}
  1420. if {_firstmessage} is not set:
  1421. set {_temp3} to yaml value "chat-youdied" from {kfsb.lang.%victim%}
  1422. set {_temp2} to "%{_temp3}% %{_temp}%"
  1423. set {_firstmessage} to true
  1424. send {_temp2} to victim
  1425. set {_temp} to yaml value "title-respawning" from {kfsb.lang.%victim%}
  1426. replace every "{seconds}" with "%{kfsb.respawnCountdown.%victim%}%" in {_temp}
  1427. send title yaml value "title-youdied" from {kfsb.lang.%victim%} with subtitle {_temp} to victim for 2 seconds and 0 ticks and 0 ticks
  1428. remove 1 from {kfsb.respawnCountdown.%victim%}
  1429. loop 20 times:
  1430. teleport victim to {_stayLocation.%victim%}
  1431. wait a tick
  1432. delete {kfsb.respawnCountdown.%victim%}
  1433. remove blindness from victim
  1434. victim.setAllowFlight(false)
  1435. reveal victim to all players
  1436. send yaml value "chat-respawned" from {kfsb.lang.%victim%} to victim
  1437. send title yaml value "title-respawned" from {kfsb.lang.%victim%} with subtitle "" to victim for 1 seconds and 0 ticks and 10 ticks
  1438. kfsbSetFacing(victim, "%{kfsb.%{kfsb.team::%victim%}%facing.%{kfsb.selectedMap}%}%", location of victim)
  1439. set victim's fall distance to 0
  1440. teleport victim to location 1 meter above {kfsb.mapdata.%{kfsb.team::%victim%}%spawn}
  1441. play "BLOCK_NOTE_HARP" to victim at volume 10 at pitch 5
  1442. else if {kfsb.spawnbroken.%{kfsb.team::%victim%}%} is not set:
  1443. heal victim
  1444. set victim's health to 10
  1445. set victim's max health to 10
  1446. set victim's health to 10
  1447. set victim's hunger to 10
  1448. set victim's level to 0
  1449. set victim's level progress to 0
  1450. set victim's saturation to 10
  1451. set victim's health to 10
  1452. loop name of all items of victim:
  1453. if loop-string contains "&1&2&3&4&r&1" or "&1&2&3&4&b&1":
  1454. set {_hasSpawnBlock} to true
  1455. loop all items of victim:
  1456. if name of loop-item contains "&1&2&3&4&r&1" or "&1&2&3&4&b&1":
  1457. remove loop-item from drops
  1458. if {_hasSpawnBlock} is not set:
  1459. clear loop-item
  1460. clear drops
  1461. loop all items of victim:
  1462. if name of loop-item contains "&1&2&3&4&r&1":
  1463. set {_uselessVariable} to true
  1464. else if name of loop-item contains "&1&2&3&4&b&1":
  1465. set {_uselessVariable} to true
  1466. else:
  1467. set {_dropLoc} to location 0.5 meters above victim
  1468. set x-coordinate of {_dropLoc} to x-coordinate of {_dropLoc} + 0.5
  1469. set z-coordinate of {_dropLoc} to z-coordinate of {_dropLoc} + 0.5
  1470. drop loop-item at {_dropLoc}
  1471. clear loop-item
  1472. clear potion effects of victim
  1473. if "%damage cause%" is "void":
  1474. set {kfsb.nodeathaction.%victim%} to true
  1475. if {kfsb.lasthit::%victim%} is set:
  1476. add 1 to {kfsb.kills::%{kfsb.lasthit::%victim%}%}
  1477. play "ENTITY_EXPERIENCE_ORB_PICKUP" to {kfsb.lasthit::%victim%} at volume 10 at pitch 5
  1478. set {_temp} to yaml value "chat-deathmessage-knockedintothevoid-you" from {kfsb.lang.%victim%}
  1479. replace every "{attacker}" with kfsbGetUsername({kfsb.lasthit::%victim%}) in {_temp}
  1480. send {_temp} to victim
  1481. loop all players:
  1482. {kfsb.ingame::%loop-player%} is set
  1483. if loop-player is not victim:
  1484. set {_temp.%loop-player%} to yaml value "chat-deathmessage-knockedintothevoid" from {kfsb.lang.%loop-player%}
  1485. replace every "{victim}" with kfsbGetUsername(victim) in {_temp.%loop-player%}
  1486. replace every "{attacker}" with kfsbGetUsername({kfsb.lasthit::%victim%}) in {_temp.%loop-player%}
  1487. send {_temp.%loop-player%} to loop-player
  1488. else:
  1489. send yaml value "chat-deathmessage-fellintothevoid-you" from {kfsb.lang.%victim%} to victim
  1490. loop all players:
  1491. {kfsb.ingame::%loop-player%} is set
  1492. if loop-player is not victim:
  1493. {kfsb.ingame::%loop-player%} is set
  1494. set {_temp.%loop-player%} to yaml value "chat-deathmessage-fellintothevoid" from {kfsb.lang.%loop-player%}
  1495. replace every "{victim}" with kfsbGetUsername(victim) in {_temp.%loop-player%}
  1496. send {_temp.%loop-player%} to loop-player
  1497. else if attacker is a player:
  1498. add 1 to {kfsb.kills::%attacker%}
  1499. play "ENTITY_EXPERIENCE_ORB_PICKUP" to attacker at volume 10 at pitch 5
  1500. set {_temp} to yaml value "chat-deathmessage-killed-you" from {kfsb.lang.%victim%}
  1501. replace every "{attacker}" with kfsbGetUsername(attacker) in {_temp}
  1502. send {_temp} to victim
  1503. loop all players:
  1504. {kfsb.ingame::%loop-player%} is set
  1505. if loop-player is not victim:
  1506. set {_temp.%loop-player%} to yaml value "chat-deathmessage-killed" from {kfsb.lang.%loop-player%}
  1507. replace every "{victim}" with kfsbGetUsername(victim) in {_temp.%loop-player%}
  1508. replace every "{attacker}" with kfsbGetUsername(attacker) in {_temp.%loop-player%}
  1509. send {_temp.%loop-player%} to loop-player
  1510. else if "%damage cause%" is "fall":
  1511. send yaml value "chat-deathmessage-fellfromahighplace-you" from {kfsb.lang.%victim%} to victim
  1512. loop all players:
  1513. {kfsb.ingame::%loop-player%} is set
  1514. if loop-player is not victim:
  1515. set {_temp.%loop-player%} to yaml value "chat-deathmessage-fellfromahighplace" from {kfsb.lang.%loop-player%}
  1516. replace every "{victim}" with kfsbGetUsername(victim) in {_temp.%loop-player%}
  1517. send {_temp.%loop-player%} to loop-player
  1518. else:
  1519. send yaml value "chat-deathmessage-died-you" from {kfsb.lang.%victim%} to victim
  1520. loop all players:
  1521. {kfsb.ingame::%loop-player%} is set
  1522. if loop-player is not victim:
  1523. set {_temp.%loop-player%} to yaml value "chat-deathmessage-died" from {kfsb.lang.%loop-player%}
  1524. replace every "{victim}" with kfsbGetUsername(victim) in {_temp.%loop-player%}
  1525. send {_temp.%loop-player%} to loop-player
  1526. set {_stayLocation.%victim%} to location of victim
  1527. victim.setAllowFlight(true)
  1528. victim.setFlying(true)
  1529. apply blindness without particles to victim for 9999 days
  1530. hide victim from all players
  1531. if {_hasSpawnBlock} is true:
  1532. delete {kfsb.noSetSpectator.%victim%}
  1533. kfsbDeathEvent(victim)
  1534. else:
  1535. set {kfsb.respawnCountdown.%victim%} to 1
  1536. while {kfsb.spawnmoving.%{kfsb.team::%victim%}%} is true:
  1537. if {kfsb.ingame::%victim%} is not set:
  1538. stop
  1539. if {kfsb.spawnbroken.%{kfsb.team::%victim%}%} is set:
  1540. delete {kfsb.noSetSpectator.%victim%}
  1541. kfsbDeathEvent(victim)
  1542. stop
  1543. if {_firstmessage} is not set:
  1544. set {_firstmessage} to true
  1545. send yaml value "chat-youdied" from {kfsb.lang.%victim%} to victim
  1546. send yaml value "chat-respawnwaiting" from {kfsb.lang.%victim%} to victim
  1547. 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
  1548. teleport victim to {_stayLocation.%victim%}
  1549. wait a tick
  1550. delete {kfsb.respawnCountdown.%victim%}
  1551. remove blindness from victim
  1552. victim.setAllowFlight(false)
  1553. reveal victim to all players
  1554. send yaml value "chat-respawned" from {kfsb.lang.%victim%} to victim
  1555. send title yaml value "title-respawned" from {kfsb.lang.%victim%} with subtitle "" to victim for 1 seconds and 0 ticks and 10 ticks
  1556. kfsbSetFacing(victim, "%{kfsb.%{kfsb.team::%victim%}%facing.%{kfsb.selectedMap}%}%", location of victim)
  1557. set victim's fall distance to 0
  1558. teleport victim to location 1 meter above {kfsb.mapdata.%{kfsb.team::%victim%}%spawn}
  1559. play "BLOCK_NOTE_HARP" to victim at volume 10 at pitch 5
  1560. else:
  1561. heal victim
  1562. if "%damage cause%" is "void":
  1563. set {kfsb.nodeathaction.%victim%} to true
  1564. if {kfsb.lasthit::%victim%} is set:
  1565. add 1 to {kfsb.kills::%{kfsb.lasthit::%victim%}%}
  1566. play "ENTITY_EXPERIENCE_ORB_PICKUP" to {kfsb.lasthit::%victim%} at volume 10 at pitch 5
  1567. set {_temp} to yaml value "chat-deathmessage-knockedintothevoid-you" from {kfsb.lang.%victim%}
  1568. replace every "{attacker}" with kfsbGetUsername({kfsb.lasthit::%victim%}) in {_temp}
  1569. send {_temp} to victim
  1570. loop all players:
  1571. {kfsb.ingame::%loop-player%} is set
  1572. if loop-player is not victim:
  1573. set {_temp.%loop-player%} to yaml value "chat-deathmessage-knockedintothevoid" from {kfsb.lang.%loop-player%}
  1574. replace every "{victim}" with kfsbGetUsername(victim) in {_temp.%loop-player%}
  1575. replace every "{attacker}" with kfsbGetUsername({kfsb.lasthit::%victim%}) in {_temp.%loop-player%}
  1576. send {_temp.%loop-player%} to loop-player
  1577. else:
  1578. send yaml value "chat-deathmessage-fellintothevoid-you" from {kfsb.lang.%victim%} to victim
  1579. loop all players:
  1580. {kfsb.ingame::%loop-player%} is set
  1581. if loop-player is not victim:
  1582. {kfsb.ingame::%loop-player%} is set
  1583. set {_temp.%loop-player%} to yaml value "chat-deathmessage-fellintothevoid" from {kfsb.lang.%loop-player%}
  1584. replace every "{victim}" with kfsbGetUsername(victim) in {_temp.%loop-player%}
  1585. send {_temp.%loop-player%} to loop-player
  1586. else if attacker is a player:
  1587. add 1 to {kfsb.kills::%attacker%}
  1588. play "ENTITY_EXPERIENCE_ORB_PICKUP" to attacker at volume 10 at pitch 5
  1589. set {_temp} to yaml value "chat-deathmessage-killed-you" from {kfsb.lang.%victim%}
  1590. replace every "{attacker}" with kfsbGetUsername(attacker) in {_temp}
  1591. send {_temp} to victim
  1592. loop all players:
  1593. {kfsb.ingame::%loop-player%} is set
  1594. if loop-player is not victim:
  1595. set {_temp.%loop-player%} to yaml value "chat-deathmessage-killed" from {kfsb.lang.%loop-player%}
  1596. replace every "{victim}" with kfsbGetUsername(victim) in {_temp.%loop-player%}
  1597. replace every "{attacker}" with kfsbGetUsername(attacker) in {_temp.%loop-player%}
  1598. send {_temp.%loop-player%} to loop-player
  1599. else if "%damage cause%" is "fall":
  1600. send yaml value "chat-deathmessage-fellfromahighplace-you" from {kfsb.lang.%victim%} to victim
  1601. loop all players:
  1602. {kfsb.ingame::%loop-player%} is set
  1603. if loop-player is not victim:
  1604. set {_temp.%loop-player%} to yaml value "chat-deathmessage-fellfromahighplace" from {kfsb.lang.%loop-player%}
  1605. replace every "{victim}" with kfsbGetUsername(victim) in {_temp.%loop-player%}
  1606. send {_temp.%loop-player%} to loop-player
  1607. else:
  1608. send yaml value "chat-deathmessage-died-you" from {kfsb.lang.%victim%} to victim
  1609. loop all players:
  1610. {kfsb.ingame::%loop-player%} is set
  1611. if loop-player is not victim:
  1612. set {_temp.%loop-player%} to yaml value "chat-deathmessage-died" from {kfsb.lang.%loop-player%}
  1613. replace every "{victim}" with kfsbGetUsername(victim) in {_temp.%loop-player%}
  1614. send {_temp.%loop-player%} to loop-player
  1615. clear drops
  1616. loop all items of victim:
  1617. if name of loop-item contains "&1&2&3&4&r&1":
  1618. set {_uselessVariable} to true
  1619. else if name of loop-item contains "&1&2&3&4&b&1":
  1620. set {_uselessVariable} to true
  1621. else:
  1622. set {_dropLoc} to location 0.5 meters above victim
  1623. set x-coordinate of {_dropLoc} to x-coordinate of {_dropLoc} + 0.5
  1624. set z-coordinate of {_dropLoc} to z-coordinate of {_dropLoc} + 0.5
  1625. drop loop-item at {_dropLoc}
  1626. clear loop-item
  1627. kfsbDeathEvent(victim)
  1628.  
  1629. on place:
  1630. {kfsb.isSpectator::%player%} is not set
  1631. if {kfsb.ingame::%player%} is set:
  1632. if {kfsb.playerstatus::%player%} is "ingame":
  1633. if location of event-block is not within {kfsb.mapdata.pos1} to {kfsb.mapdata.pos2}:
  1634. cancel event
  1635. send yaml value "chat-cantplaceblocksthere" from {kfsb.lang.%player%}
  1636. else if event-block is blue wool:
  1637. player's tool's name contains "&1&2&3&4&b&1"
  1638. {kfsb.spawnmoving.blue} is true
  1639. delete {kfsb.spawnmoving.blue}
  1640. set {kfsb.mapdata.bluespawn} to location of event-block
  1641. loop all players:
  1642. {kfsb.ingame::%loop-player%} is set
  1643. {kfsb.team::%loop-player%} is "blue"
  1644. send yaml value "chat-spawnplaced" from {kfsb.lang.%loop-player%} to loop-player
  1645. kfsbPlaceHologram(loop-player)
  1646. else if event-block is red wool:
  1647. player's tool's name contains "&1&2&3&4&r&1"
  1648. {kfsb.spawnmoving.red} is true
  1649. delete {kfsb.spawnmoving.red}
  1650. set {kfsb.mapdata.redspawn} to location of event-block
  1651. loop all players:
  1652. {kfsb.ingame::%loop-player%} is set
  1653. {kfsb.team::%loop-player%} is "red"
  1654. send yaml value "chat-spawnplaced" from {kfsb.lang.%loop-player%} to loop-player
  1655. kfsbPlaceHologram(loop-player)
  1656.  
  1657. on damage:
  1658. if {kfsb.respawnCountdown.%victim%} is set:
  1659. cancel event
  1660. stop
  1661. if attacker is a player:
  1662. set {kfsb.lasthit::%victim%} to attacker
  1663.  
  1664.  
  1665. every 5 ticks:
  1666. loop all players:
  1667. set {_temp.%loop-player%} to loop-player.isOnGround()
  1668. if {_temp.%loop-player%} is true:
  1669. delete {kfsb.lasthit::%loop-player%}
  1670.  
  1671. on quit:
  1672. delete {kfsb.lasthit::%player%}
  1673. delete {kfsb.respawnCountdown.%player%}
  1674.  
  1675. on PlayerChatEvent with priority lowest:
  1676. set {_player} to event.getPlayer()
  1677. if {kfsb.ingame::%{_player}%} is set:
  1678. if {kfsb.status} is "ingame":
  1679. if {kfsb.playerstatus::%{_player}%} is "ingame":
  1680. cancel event
  1681. if {kfsb.isSpectator::%{_player}%} is set:
  1682. loop all players:
  1683. {kfsb.ingame::%loop-player%} is set
  1684. {kfsb.isSpectator::%loop-player%} is set
  1685. set {_temp.%loop-player%} to yaml value "chat-playerchat-spectator" from {kfsb.lang.%loop-player%}
  1686. replace every "{player}" with "%{_player}%" in {_temp.%loop-player%}
  1687. replace every "{message}" with event.getMessage() in {_temp.%loop-player%}
  1688. if {kfsb.team::%{_player}%} is "red":
  1689. replace every "{team}" with "&c[RED]" in {_temp.%loop-player%}
  1690. else if {kfsb.team::%{_player}%} is "blue":
  1691. replace every "{team}" with "&9[BLUE]" in {_temp.%loop-player%}
  1692. send {_temp.%loop-player%} to loop-player
  1693. stop
  1694. if {kfsb.shoutchat.%{_player}%} is set:
  1695. delete {kfsb.shoutchat.%{_player}%}
  1696. loop all players:
  1697. {kfsb.ingame::%loop-player%} is set
  1698. set {_temp.%loop-player%} to yaml value "chat-playerchat-shout" from {kfsb.lang.%loop-player%}
  1699. replace every "{player}" with "%{_player}%" in {_temp.%loop-player%}
  1700. replace every "{message}" with event.getMessage() in {_temp.%loop-player%}
  1701. if {kfsb.team::%{_player}%} is "red":
  1702. replace every "{team}" with "&c[RED]" in {_temp.%loop-player%}
  1703. else if {kfsb.team::%{_player}%} is "blue":
  1704. replace every "{team}" with "&9[BLUE]" in {_temp.%loop-player%}
  1705. send "%{_temp.%loop-player%}%" to loop-player
  1706. else:
  1707. loop all players:
  1708. {kfsb.ingame::%loop-player%} is set
  1709. {kfsb.team::%loop-player%} is {kfsb.team::%{_player}%}
  1710. set {_temp.%loop-player%} to yaml value "chat-playerchat-team" from {kfsb.lang.%loop-player%}
  1711. replace every "{player}" with "%{_player}%" in {_temp.%loop-player%}
  1712. replace every "{message}" with event.getMessage() in {_temp.%loop-player%}
  1713. if {kfsb.team::%{_player}%} is "red":
  1714. replace every "{team}" with "&c[RED]" in {_temp.%loop-player%}
  1715. else if {kfsb.team::%{_player}%} is "blue":
  1716. replace every "{team}" with "&9[BLUE]" in {_temp.%loop-player%}
  1717. send "%{_temp.%loop-player%}%" to loop-player
  1718. else if {kfsb.status} is "ending":
  1719. cancel event
  1720. loop all players:
  1721. {kfsb.ingame::%loop-player%} is set
  1722. set {_temp.%loop-player%} to yaml value "chat-playerchat-shout" from {kfsb.lang.%loop-player%}
  1723. replace every "{player}" with "%{_player}%" in {_temp.%loop-player%}
  1724. replace every "{message}" with event.getMessage() in {_temp.%loop-player%}
  1725. if {kfsb.team::%{_player}%} is "red":
  1726. replace every "{team}" with "&c[RED]" in {_temp.%loop-player%}
  1727. else if {kfsb.team::%{_player}%} is "blue":
  1728. replace every "{team}" with "&9[BLUE]" in {_temp.%loop-player%}
  1729. send "%{_temp.%loop-player%}%" to loop-player
  1730. else if {kfsb.playerstatus::%{_player}%} is not "ingame":
  1731. delete {kfsb.shoutchat.%{_player}%}
  1732. else:
  1733. delete {kfsb.shoutchat.%{_player}%}
  1734.  
  1735. every 5 ticks:
  1736. loop all players:
  1737. {kfsb.ingame::%loop-player%} is set
  1738. {kfsb.isSpectator::%loop-player%} is set
  1739. if {kfsb.blockloc.%loop-player%} is set:
  1740. if block at {kfsb.blockloc.%loop-player%} is not chest or furnace or dropper or dispenser or hopper or trapped chest:
  1741. close loop-player's inventory
  1742. delete {kfsb.blockloc.%loop-player%}
  1743. stop
  1744. set {_slot} to 0
  1745. loop 27 times:
  1746. set {_invitem::%{_slot}%} to slot {_slot} of block at {kfsb.blockloc.%loop-player%}'s inventory
  1747. create a gui slot {_slot} of loop-player with {_invitem::%{_slot}%}
  1748. add 1 to {_slot}
  1749. if loop-player does not have a gui:
  1750. delete {kfsb.blockloc.%loop-player%}
  1751.  
  1752. on drop:
  1753. if {kfsb.respawnCountdown.%player%} is set:
  1754. cancel event
  1755. stop
  1756. if {kfsb.isSpectator::%player%} is set:
  1757. cancel event
  1758. stop
  1759. if {kfsb.respawnCountdown.%player%} is set:
  1760. cancel event
  1761. stop
  1762.  
  1763. on pickup:
  1764. if {kfsb.respawnCountdown.%player%} is set:
  1765. cancel event
  1766. stop
  1767. if {kfsb.isSpectator::%player%} is set:
  1768. cancel event
  1769. stop
  1770. if {kfsb.respawnCountdown.%player%} is set:
  1771. cancel event
  1772. stop
  1773.  
  1774. on target:
  1775. if {kfsb.respawnCountdown.%player%} is set:
  1776. cancel event
  1777. stop
  1778. if {kfsb.isSpectator::%player%} is set:
  1779. cancel event
  1780. stop
  1781. if {kfsb.respawnCountdown.%player%} is set:
  1782. cancel event
  1783. stop
Add Comment
Please, Sign In to add comment