Advertisement
fleft17

Untitled

Sep 14th, 2014
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.44 KB | None | 0 0
  1. options:
  2.  
  3. P: &8[&7Pregen&8]
  4. CC: &a
  5. HC: &6
  6. Pregen.TP.Delay: 0.5 ticks
  7. Correct.Usage: /pregen <radius> <world>
  8. Broadcast.Messages: true
  9. WB.Fill.Speed: 100
  10.  
  11. command /pregen [<integer>] [<world>]:
  12. permission: skript.op
  13. trigger:
  14. if {Pregen::Running} is true:
  15. if arg-1 is not set:
  16. delete {Pregen::Running}
  17. stop trigger
  18. else:
  19. message "{@P}{@CC} {@Correct.Usage}"
  20. if arg-1 is less than 16:
  21. message "{@P}{@CC} You cannot pregen with a radius less than 16!"
  22. stop trigger
  23. if arg-2 is not set:
  24. message "{@P}{@CC} {@Correct.Usage}"
  25. stop trigger
  26. loop 3 times:
  27. command "/pregen-sound note.harp"
  28. wait 4 ticks
  29. set {Pregen::Location} to (location at (0, 255, 0) of the world (arg-2))
  30. while (block at {Pregen::Location}) is air:
  31. set {Pregen::Location} to location 1 below {Pregen::Location}
  32. if y-coordinate of {Pregen::Location} is less than 5:
  33. message "{@P}{@CC} Error: Could not teleport {@HC}%command sender%{@CC} to 0,0."
  34. wait 1 tick
  35. teleport command sender to (location 1 above {Pregen::Location})
  36. command sender command "/wb set %arg-1%"
  37. broadcast "{@P}{@CC}&r&k----------------------------------"
  38. broadcast "{@P}{@HC} %command sender%{@CC}: {@HC}%arg-1%{@CC} in {@HC}%arg-2%!"
  39. broadcast "{@P}{@CC} Beginning pregen! There may be lag! Do not log out!"
  40. broadcast "{@P}{@HC} Pregen Skript by Fleft"
  41. broadcast "{@P}{@CC}&r&k----------------------------------"
  42. set command sender's gamemode to creative
  43. set {Pregen::Running} to true
  44. set {Pregen::Radius} to arg-1
  45. set {Pregen::World} to arg-2
  46. set {Pregen::Loop.1} to 0
  47. set {Pregen::Loop.2} to 0
  48. set {Pregen::Count} to 0
  49. set {Pregen::Time} to 0
  50. set {Pregen::Notify} to now
  51. wait 1 second
  52. set {_count} to 3
  53. loop 3 times:
  54. broadcast "{@P}{@CC} Starting:{@HC} %{_count}%..."
  55. command "/pregen-sound note.harp"
  56. subtract 1 from {_count}
  57. wait 1 second
  58. loop ({Pregen::Radius}*2) times:
  59. add 1 to {Pregen::Loop.1}
  60. if {Pregen::Loop.1} is equal to 16:
  61. set {Pregen::Time} to rounded down ((loop-number-1)/{Pregen::Radius})*50
  62. if {@Broadcast.Messages} is true:
  63. if {Pregen::Notify} was more than 5 seconds ago:
  64. broadcast "{@P}{@CC} Progress: {@HC}%{Pregen::Time}%%%"
  65. set {Pregen::Notfy} to now
  66. command "/pregen-sound note.harp"
  67. set {Pregen::Loop.1} to 0
  68. loop ({Pregen::Radius}*2) times:
  69. {Pregen::Running} is not set:
  70. delete {Pregen::*}
  71. broadcast "{@P}{@HC} Cancelled!"
  72. command "/pregen-sound random.break"
  73. wait 5 ticks
  74. set {Pregen::Location} to (location at (0, 255, 0) of the world (world of command sender))
  75. while (block at {Pregen::Location}) is air:
  76. set {Pregen::Location} to location 1 below {Pregen::Location}
  77. if y-coordinate of {Pregen::Location} is less than 5:
  78. message "{@P}{@CC} Error: Could not teleport {@HC}%command sender%{@CC} to 0,0."
  79. wait 1 tick
  80. teleport command sender to (location 1 above {Pregen::Location})
  81. message "{@P}{@CC} You were TPed to {@HC}0,%y-coordinate of command sender%,0!"
  82. delete {Pregen::Location}
  83. stop trigger
  84. add 1 to {Pregen::Loop.2}
  85. if {Pregen::Loop.2} is equal to 16:
  86. set {Pregen::Loop.2} to 0
  87. set {Pregen::x.coord} to ((loop-number-1)-{Pregen::Radius})
  88. set {Pregen::z.coord} to ((loop-number-2)-{Pregen::Radius})
  89. set {Pregen::Location} to (location at ({Pregen::x.coord}, 200, {Pregen::z.coord}) of the world ({Pregen::World}))
  90. while (block at {Pregen::Location}) is air:
  91. set {Pregen::Location} to location 1 below {Pregen::Location}
  92. if y-coordinate of {Pregen::Location} is less than 5:
  93. if {@Broadcast.Messages} is true:
  94. broadcast "{@P}{@CC} Void: skipping location"
  95. delete {Pregen::Location}
  96. if command sender is not online:
  97. broadcast "{@P}{@CC} Pregenning interrupted. {@HC}%command sender%{@CC} logged out."
  98. delete {Pregen::Running}
  99. teleport command sender to (location 1 above {Pregen::Location})
  100. add 1 to {Pregen::Time}
  101. wait {@Pregen.TP.Delay}
  102. broadcast "{@P}{@CC} Pregenning finished: ~{@HC}%{Pregen::Time}/16% minutes."
  103. delete {Pregen::*}
  104. set {Pregen::Location} to (location at (0, 255, 0) of the world (world of command sender))
  105. while (block at {Pregen::Location}) is air:
  106. set {Pregen::Location} to location 1 below {Pregen::Location}
  107. if y-coordinate of {Pregen::Location} is less than 5:
  108. broadcast "{@P}{@CC} Error: Could not teleport {@HC}%command sender%{@CC} to 0,0."
  109. delete {Pregen::Location}
  110. wait 1 tick
  111. teleport command sender to (location 1 above {Pregen::Location})
  112. message "{@P}{@CC} You were TPed to {@HC}0,%y-coordinate of command sender%,0!"
  113. command sender command "/wb set %arg-1%"
  114. wait 1 tick
  115. command sender command "/wb fill {@WB.Fill.Speed}"
  116. wait 1 tick
  117. command sender command "/wb fill confirm"
  118. loop 3 times:
  119. command "/pregen-sound note.harp"
  120. wait 3 ticks
  121. broadcast "{@P}{@CC}&r&k----------------------------------"
  122. broadcast "{@P}{@CC} Automatically finishing pregen using"
  123. broadcast "{@P}{@HC} WorldBorder!{@CC} May be small lag!"
  124. broadcast "{@P}{@CC}&r&k----------------------------------"
  125. execute console command "/pregen-sound random.explode"
  126.  
  127.  
  128. command /pregen-sound <text>:
  129. permission: skript.pregen
  130. trigger:
  131. loop all players:
  132. execute console command "/playsound %arg% %loop-player% ~ ~ ~ 1 1 1"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement