Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- options:
- P: &8[&dPregen&8] #= Prefix =#
- CC: &r #= Main Chat Color =#
- HC: &b #= Highlight Color =#
- Correct.Usage: /pregen &b<radius> <world> #= How to not be dumb =#
- Pregen.TP.Delay: 1 tick #= Don't change this =#
- Broadcast.Messages: true #= Broadcat Progress =#
- Coords.Spam.Chat: false #= Spams chat with every coordinate =#
- command /skpregen [<integer>] [<world>]:
- permission: skript.op
- trigger:
- #= Arguments =#
- if {Pregen::Running} is true:
- if arg-1 is not set:
- delete {Pregen::Running}
- stop trigger
- else if arg-1 is set:
- message "{@P}{@HC} To cancel, use /pregen"
- stop trigger
- if arg-2 is not set:
- message "{@P}{@CC} {@Correct.Usage}"
- stop trigger
- loop 3 times:
- command "/pregen-sound note.harp"
- wait 3 ticks
- #= TP to 0,0 =#
- set {Pregen::Location} to (location at (0, 255, 0) of the world (arg-2))
- while (block at {Pregen::Location}) is air:
- set {Pregen::Location} to location 1 below {Pregen::Location}
- if y-coordinate of {Pregen::Location} is less than 3:
- message "{@P}{@CC} Error: Could not teleport {@HC}%command sender%{@CC} to 0,0."
- teleport command sender to (location 1 above {Pregen::Location})
- #= Variables + Gamemode Creative =#
- set command sender's gamemode to creative
- set {Pregen::Running} to true
- set {Pregen::Radius} to arg-1
- add 128 to {Pregen::Radius}
- set {Pregen::World} to arg-2
- set {Pregen::Loop.1} to 0
- set {Pregen::Loop.2} to 0
- set {Pregen::Count} to 0
- set {Pregen::Time} to 0
- set {Pregen::Notify} to now
- #= Broadcast =#
- loop 6 times:
- message "{@P}{@CC} Remove your world border!"
- wait 2 ticks
- broadcast "&a&k--------------{@P}&a&k--------------"
- broadcast "&a&k--{@CC} %command sender%: {@HC}%arg-1%{@CC} in {@HC}%arg-2%!"
- broadcast "&a&k--{@CC} Beginning pregen! Do not log out!"
- if command sender is "Fleft":
- broadcast "&a&k--{@CC} Pregen Skript by {@HC}You"
- else:
- broadcast "&a&k--{@CC} Pregen Skript by {@HC}Fleft"
- broadcast "&a&k--{@CC} Use /skpregen to cancel at any time!"
- broadcast "&a&k--------------{@P}&a&k--------------"
- wait 1 second
- set {_count} to 3
- loop 3 times:
- broadcast "{@P}{@CC} Starting:{@HC} %{_count}%..."
- command "/pregen-sound note.harp"
- subtract 1 from {_count}
- wait 1 second
- #= Literally the Pregen =#
- loop ({Pregen::Radius}*2) times:
- add 1 to {Pregen::Loop.1}
- if {Pregen::Loop.1} is equal to 16:
- set {Pregen::Time} to rounded down ((((loop-number-1)/{Pregen::Radius})*50)-1)
- if {Pregen::Notify} was more than 5 seconds ago:
- set {Pregen::Notfy} to now
- if {@Broadcast.Messages} is true:
- broadcast "{@P}{@CC} Progress: {@HC}%{Pregen::Time}%%%"
- else:
- message "{@P}{@CC} Progress: {@HC}%{Pregen::Time}%%%"
- set {Pregen::Loop.1} to 0
- loop ({Pregen::Radius}*2) times:
- {Pregen::Running} is not set:
- delete {Pregen::*}
- broadcast "{@P}{@HC} Cancelled!"
- command "/pregen-sound random.break"
- wait 5 ticks
- set {Pregen::Location} to (location at (0, 255, 0) of the world (world of command sender))
- while (block at {Pregen::Location}) is air:
- set {Pregen::Location} to location 1 below {Pregen::Location}
- if y-coordinate of {Pregen::Location} is less than 3:
- message "{@P}{@CC} Error: Could not teleport {@HC}%command sender%{@CC} to 0,0."
- wait 1 tick
- teleport command sender to (location 1 above {Pregen::Location})
- message "{@P}{@CC} You were TPed to {@HC}0,%y-coordinate of command sender%,0!"
- delete {Pregen::Location}
- stop trigger
- add 1 to {Pregen::Loop.2}
- if {Pregen::Loop.2} is equal to 16:
- set {Pregen::Loop.2} to 0
- set {Pregen::x.coord} to ((loop-number-1)-{Pregen::Radius})
- set {Pregen::z.coord} to ((loop-number-2)-{Pregen::Radius})
- set {Pregen::Location} to (location at ({Pregen::x.coord}, 255, {Pregen::z.coord}) of the world ({Pregen::World}))
- while (block at {Pregen::Location}) is air:
- set {Pregen::Location} to location 1 below {Pregen::Location}
- if y-coordinate of {Pregen::Location} is less than 3:
- message "{@P}{@CC} Error: Void: Skipping location"
- delete {Pregen::Location}
- if command sender is not online:
- broadcast "{@P}{@CC} Pregenning interrupted. {@HC}%command sender%{@CC} logged out."
- delete {Pregen::Running}
- teleport command sender to (location 1 above {Pregen::Location})
- if {@Coords.Spam.Chat} is true:
- message "{@P}{@CC} %{Pregen::Location}%"
- add 1 to {Pregen::Time}
- wait {@Pregen.TP.Delay}
- #= Deletion of Variable =#
- delete {Pregen::*}
- #= Final TP to 0,0 =#
- set {_FinalLoc} to (location at (0, 256, 0) of the world (world of command sender))
- while (block at {_FinalLoc}) is air:
- set {_FinalLoc} to location 1 below {_FinalLoc}
- if y-coordinate of {_FinalLoc} is less than 3:
- message "{@P}{@CC} Error: Could not teleport {@HC}%command sender%{@CC} to 0,0."
- wait 1 tick
- teleport command sender to (location 1 above {_FinalLoc})
- #= Final Broadcast =#
- message "{@P}{@CC} You were TPed to {@HC}0,%y-coordinate of command sender%,0!"
- broadcast "&a&k--------------{@P}&a&k--------------"
- broadcast "&a&k--{@HC} Pregenning has been completed!"
- broadcast "&a&k--{@CC} Reapply your {@HC}Worldborder!"
- broadcast "&a&k--------------{@P}&a&k--------------"
- loop 7 times:
- command "/pregen-sound fireworks.launch"
- command "/pregen-sound fireworks.twinkle"
- wait 4 ticks
- #= Sound Command =#
- command /pregen-sound <text>:
- permission: skript.pregen
- trigger:
- loop all players:
- execute console command "/playsound %arg% %loop-player% ~ ~ ~ 1 1 1"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement