akon1248

uhc

Jul 22nd, 2019
452
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.13 KB | None | 0 0
  1. variables:
  2. {uhc.gamestate} = "waiting"
  3. on load:
  4. register new shaped recipe for player head named "&6Golden Head" using gold ingot, gold ingot, gold ingot, gold ingot, player head, gold ingot, gold ingot, gold ingot, gold ingot
  5. set {uhc.gamestate} to "waiting"
  6. makeCommandBlockCommand("mv modify set gamemode 2 world", 0, 0, 0)
  7. makeCommandBlockCommand("mv delete uhc", 0, 1, 0)
  8. wait 1 tick
  9. makeCommandBlockCommand("mvconfirm", 0, 1, 0)
  10. makeCommandBlockCommand("mvc uhc normal", 0, 2, 0)
  11. makeCommandBlockCommand("mv modify set difficulty hard uhc", 0, 3, 0)
  12. makeCommandBlockCommand("mvrule naturalRegeneration false uhc", 0, 4, 0)
  13. makeCommandBlockCommand("mvrule keepInventory false uhc", 0, 5, 0)
  14. makeCommandBlockCommand("mvrule commandBlockOutput false uhc", 0, 6, 0)
  15. makeCommandBlockCommand("mvrule sendCommandFeedback false uhc", 0, 7, 0)
  16. makeCommandBlockCommand("mvrule reducedDebugInfo false uhc", 0, 8, 0)
  17. makeCommandBlockCommand("wb uhc set 200 0 0", 0, 9, 0)
  18. #makeCommandBlockCommand("wb uhc fill confirm", 0, 10, 0)
  19. function makeCommandBlockCommand(cmd: string, x: integer, y: integer, z: integer):
  20. execute console command "setblock %{_x}% %{_y}% %{_z}% command_block 0 replace"
  21. execute console command "blockdata %{_x}% %{_y}% %{_z}% {auto:0b}"
  22. wait 1 tick
  23. execute console command "blockdata %{_x}% %{_y}% %{_z}% {auto:1b,Command:""%{_cmd}%""}"
  24. on inventory click:
  25. holder of clicked inventory is player
  26. clicked slot is 0
  27. clicked inventory is player's current inventory
  28. id of clicked item is 397
  29. data of clicked item is 3
  30. name of clicked item is "&6Golden Head"
  31. if name of slot 5 of player's current inventory is "&6Golden Head":
  32. cancel event
  33. else:
  34. if clicked type is left mouse button with shift or right mouse button with shift:
  35. give player player head with nbt "{display:{Name:""&6Golden Head""},SkullOwner:{Id:""e19442f7-4300-4004-b3cf-7d5ec3c72d0c"",Properties:{textures:[{Value:""eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvM2JiNjEyZWI0OTVlZGUyYzVjYTUxNzhkMmQxZWNmMWNhNWEyNTVkMjVkZmMzYzI1NGJjNDdmNjg0ODc5MWQ4In19fQ==""}]}}}"
  36. else:
  37. set cursor slot of player to player head with nbt "{display:{Name:""&6Golden Head""},SkullOwner:{Id:""e19442f7-4300-4004-b3cf-7d5ec3c72d0c"",Properties:{textures:[{Value:""eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvM2JiNjEyZWI0OTVlZGUyYzVjYTUxNzhkMmQxZWNmMWNhNWEyNTVkMjVkZmMzYzI1NGJjNDdmNjg0ODc5MWQ4In19fQ==""}]}}}"
  38. loop 9 times:
  39. set {_item} to slot loop-number of clicked inventory
  40. remove 1 from item amount of {_item}
  41. set slot loop-number of clicked inventory to {_item}
  42. delete {_item}
  43. command /startuhc:
  44. permission: uhc.admin
  45. trigger:
  46. startUHC()
  47. function getHighestBlock(loc: location) :: block:
  48. loop 256 times:
  49. set {_loopheight} to loop-number - 1
  50. block at location x-coordinate of {_loc}, {_loopheight}, z-coordinate of {_loc} in world "%{_loc}'s world%" is not air
  51. set {_block} to block at location x-coordinate of {_loc}, {_loopheight}, z-coordinate of {_loc} in world "%{_loc}'s world%"
  52. set {_blocks::%{_loopheight}%} to block at location x-coordinate of {_loc}, {_loopheight}, z-coordinate of {_loc} in world "%{_loc}'s world%"
  53. set {_highheight} to -1
  54. loop {_blocks::*}:
  55. loop-index parsed as integer > {_highheight}
  56. set {_highheight} to loop-index parsed as integer
  57. set {_returnvalue} to loop-value
  58. return {_returnvalue}
  59.  
  60. function startUHC():
  61. size of all players >= 2
  62. {uhc.gamestate} is "waiting"
  63. set {uhc.gamestate} to "gaming"
  64. broadcast "&8[&6&lUHC&8] &7試合を開始します"
  65. loop all players:
  66. set loop-player's gamemode to survival
  67. milk loop-player
  68. send "&a[&bTIP&a] &7コンパスを手に持つと最寄りのプレイヤーの場所がわかります" to loop-player
  69. execute console command "execute %loop-player% ~ ~ ~ effect @s 12 30 0 true"
  70. heal loop-player
  71. set loop-player' food to 10
  72. clear loop-player's inventory
  73. give stone sword of sharpness 1 and unbreaking 3 to loop-player
  74. give stone pickaxe of efficiency 3 and unbreaking 3 to loop-player
  75. give stone axe of efficiency 3 and unbreaking 3 to loop-player
  76. give stone shovel of efficiency 3 and unbreaking 3 to loop-player
  77. set {_loc} to location random integer between -175 and 175 meter east location random integer between -175 and 175 meter south location at 0, 0, 0 in world "uhc"
  78. set {_block} to getHighestBlock({_loc})
  79. teleport loop-player to location 1 meter above location of {_block}
  80.  
  81. on packet event play_server_world_particles:
  82. "Particle" penum 0 of event-packet is "DAMAGE_INDICATOR" or "SWEEP_ATTACK"
  83. cancel event
  84. on packet event play_server_named_sound_effect:
  85. "SoundEffects" pinfo 0 of event-packet is ENTITY_PLAYER_ATTACK_CRIT or ENTITY_PLAYER_ATTACK_KNOCKBACK or ENTITY_PLAYER_ATTACK_NODAMAGE or ENTITY_PLAYER_ATTACK_STRONG or ENTITY_PLAYER_ATTACK_SWEEP or ENTITY_PLAYER_ATTACK_WEAK
  86. cancel event
  87.  
  88. on death of player:
  89. set {_skull} to skull from victim's skin with owner "%victim%"
  90. set name of {_skull} to "&c&l%victim%'s Head"
  91. add {_skull} to drops
  92. strike lightning effect at victim
  93. set {_loc} to location of victim
  94. set metadata value "DeathLocation" of victim to {_loc}
  95. if attacker is set:
  96. set {_weap} to check [name of attacker's tool is set] ? " using %name of attacker's tool%" : ""
  97. set {_cause} to check [projectile is an arrow] ? "shot" : "killed"
  98. if name of attacker is set:
  99. set death message to "&c%victim% was %{_cause}% by %name of attacker%%{_weap}%"
  100. else:
  101. set death message to "&c%victim% was %{_cause}% by %attacker%%{_weap}%"
  102. else:
  103. set death message to "&c%victim% died"
  104. wait 5 tick
  105. force victim to respawn
  106. wait 1 tick
  107. set player's gamemode to spectator
  108. set {_loc} to metadata value "DeathLocation" of player
  109. teleport player to {_loc}
  110. delete metadata value "DeathLocation" of player
  111. on join:
  112. delete metadata value "DeathLocation" of player
  113. if {uhc.gamestate} is "gaming":
  114. wait 3 tick
  115. teleport player to highest block at location at 0, 0, 0 in world "uhc"
  116. wait 3 tick
  117. set player's gamemode to spectator
  118. else:
  119. teleport player to location at 0, 64, 0 in world "world"
  120. clear player's inventory
  121. heal player
  122. set player's food to 10
  123. wait 2 tick
  124. set player's gamemode to adventure
  125. on break:
  126. player's tool is shears
  127. player's gamemode is survival or adventure
  128. id of event-block is 18
  129. chance of 10%:
  130. set event-block to air
  131. drop apple at event-location
  132. on quit:
  133. delete metadata value "DeathLocation" of player
  134. {uhc.gamestate} is "gaming"
  135. player's gamemode is not spectator
  136. set quit message to "&c%player% died"
  137. strike lightning effect at player
  138. loop 41 times:
  139. set {_slot} to loop-number - 1
  140. drop slot {_slot} of player's inventory at player
  141. set {_skull} to player head
  142. set owner of skull {_skull} to name of player
  143. drop {_skull} at player
  144. on click:
  145. player's gamemode is survival or adventure
  146. id of player's tool is 397
  147. data of player's tool is 3
  148. cancel event
  149. if name of player's tool is "&6Golden Head":
  150. execute console command "execute %player% ~ ~ ~ effect @s 10 15 2"
  151. execute console command "execute %player% ~ ~ ~ effect @s 22 180 0"
  152. execute console command "execute %player% ~ ~ ~ effect @s 1 5 1"
  153. else:
  154. execute console command "execute %player% ~ ~ ~ effect @s 10 10 2"
  155. execute console command "execute %player% ~ ~ ~ effect @s 1 5 1"
  156. set {_item} to player's tool
  157. set item amount of {_item} to 1
  158. remove {_item} from player's tool
  159. play sound "ENTITY_GENERIC_EAT" to player with volume 1 and pitch 5
  160. every tick:
  161. {uhc.gamestate} is "gaming"
  162. loop all players:
  163. loop all players:
  164. loop-player-2's gamemode is not spectator
  165. loop-player-2 is not loop-player-1
  166. if {_short} is not set:
  167. set {_short} to distance between loop-player-1 and loop-player-2
  168. set {_target} to loop-player-2
  169. else:
  170. distance between loop-player-1 and loop-player-2 < {_short}
  171. set {_short} to distance between loop-player-1 and loop-player-2
  172. set {_target} to loop-player-2
  173. {_target} is set
  174. {_short} is set
  175. if loop-player's tool is compass:
  176. send action bar from "&6&lPlayer: &f%{_target}% &6&lDistance: &f%{_short}%" to loop-player
  177. set compass target of loop-player to {_target}
  178. delete {_target}
  179. delete {_short}
  180.  
  181. every tick:
  182. {uhc.gamestate} is "gaming"
  183. set {_players::*} to all players
  184. loop {_players::*}:
  185. check [loop-value's gamemode is spectator] or check [loop-value is dead]
  186. remove loop-value from {_players::*}
  187. size of {_players::*} <= 1
  188. set {uhc.gamestate} to "waiting"
  189. loop all players:
  190. clear loop-player's inventory
  191. milk loop-player
  192. heal loop-player
  193. set loop-player's food to 10
  194. delete metadata value "DeathLocation" of loop-player
  195. if {_players::*} do not contain loop-player:
  196. send loop-player title "&c&lGAME OVER" for 3 second
  197. else:
  198. send loop-player title "&6&lVICTORY" for 3 second
  199. teleport loop-player to location at 0, 64, 0 in world "world"
  200. set loop-player's gamemode to adventure
  201. broadcast "&8[&6&lUHC&8] &7ワールドをリセットしています"
  202. broadcast "&8[&6&lUHC&8] &7ラグに注意してください"
  203. async:
  204. set {_packet} to new play_server_keep_alive packet
  205. loop 12 times:
  206. loop all players:
  207. send loop-player packet {_packet}
  208. wait 10 second
  209. wait 1 tick
  210. makeCommandBlockCommand("mv modify set gamemode 2 world", 0, 0, 0)
  211. makeCommandBlockCommand("mv delete uhc", 0, 1, 0)
  212. wait 1 tick
  213. makeCommandBlockCommand("mvconfirm", 0, 1, 0)
  214. makeCommandBlockCommand("mvc uhc normal", 0, 2, 0)
  215. makeCommandBlockCommand("mv modify set difficulty hard uhc", 0, 3, 0)
  216. makeCommandBlockCommand("mvrule naturalRegeneration false uhc", 0, 4, 0)
  217. makeCommandBlockCommand("mvrule keepInventory false uhc", 0, 5, 0)
  218. makeCommandBlockCommand("mvrule commandBlockOutput false uhc", 0, 6, 0)
  219. makeCommandBlockCommand("mvrule sendCommandFeedback false uhc", 0, 7, 0)
  220. makeCommandBlockCommand("mvrule reducedDebugInfo false uhc", 0, 8, 0)
  221. makeCommandBlockCommand("wb uhc set 200 0 0", 0, 9, 0)
  222. #makeCommandBlockCommand("wb uhc fill confirm", 0, 10, 0)
  223. wait 3 tick
  224. broadcast "&8[&6&lUHC&8] &7ワールドのリセットが完了しました"
Advertisement
Add Comment
Please, Sign In to add comment