Better integration with other scripts, -inworldreset::worldname variable
This commit is contained in:
parent
780a739730
commit
044f54a264
@ -306,7 +306,6 @@ command /fastworldreset [<text>] [<text>] [<text>]:
|
||||
set {fastworldreset::chunkresetdisabled::%arg 2%} to true
|
||||
send "&a&lFastWorldReset&2&l> &cDisabled chunk-based reset for this world by default. Because you're running 1.13+ where only world-based reset is effective."
|
||||
else if arg 1 is "reset":
|
||||
|
||||
if arg 2 is not set:
|
||||
send "&a&lFastWorldReset&2&l> &cPlease specify world name!"
|
||||
stop
|
||||
@ -316,6 +315,13 @@ command /fastworldreset [<text>] [<text>] [<text>]:
|
||||
if {-fastworldresetworld::%arg 2%} is set:
|
||||
set {_world} to arg 2 parsed as a world
|
||||
|
||||
set {_ev::world} to {_world}
|
||||
call event (custom event "world_reset_start" with {_ev::*})
|
||||
|
||||
#this can be used to delay the reset by a specific amount of seconds
|
||||
if arg 3 is set:
|
||||
wait "%arg 3 parsed as a number% seconds" parsed as a timespan
|
||||
|
||||
if {_world} is not a world:
|
||||
set {_worldreset} to true
|
||||
else if {fastworldreset::chunkresetdisabled::%arg 2%} or {-fastworldreset::shouldreset::%arg 2%} is set:
|
||||
@ -325,13 +331,10 @@ command /fastworldreset [<text>] [<text>] [<text>]:
|
||||
|
||||
set {_template} to {fastworldresetclone::%arg 2%} ? arg 2
|
||||
|
||||
set {_ev::world} to {_world}
|
||||
set {_w} to arg 2
|
||||
call event (custom event "world_reset_start" with {_ev::*})
|
||||
{_worldreset} is not set:
|
||||
set {_w} to arg 2
|
||||
|
||||
#detect world save as world save event doesn't always call
|
||||
|
||||
create section stored in {_section}:
|
||||
if ((new File("%{_worlddir}%/%{_w}%/level.dat")).lastModified()) is higher than {fastworldreset::lastreset::%{_w}%}:
|
||||
return true
|
||||
@ -717,7 +720,7 @@ command /fastworldreset [<text>] [<text>] [<text>]:
|
||||
send "&f/fwr create <world> [generator] &a- Add a world to FastWorldReset system or create a completely new world into the system. (Or update existing world's template)"
|
||||
send "&f/fwr delete <world> &a- Removes the world from FastWorldReset system, does not unload or delete the world."
|
||||
send "&f/fwr clone <world> <new-world> &a- Clones a FWR world."
|
||||
send "&f/fwr reset <world> &a- to reset a world. (Must be in FastWorldReset system)"
|
||||
send "&f/fwr reset <world> [seconds] &a- to reset a FastWorldReset world, with optional delay."
|
||||
send "&f/fwr exit &a- sets exit point to where players get teleported when their world resets."
|
||||
send "&f/fwr load <world> [generator] &a- loads a world. Optionally with a generator."
|
||||
send "&f/fwr unload <world> [<true/false>] &a- loads a world. true/false if the world should be saved, defaults to true."
|
||||
@ -737,7 +740,7 @@ command /fastworldreset [<text>] [<text>] [<text>]:
|
||||
function initWorlds():
|
||||
|
||||
#just in case if the user hasn't configured variables starting with "-" character to not save to database.
|
||||
delete {-fastworldresetworld::*}, {-unloading::*}, {-resetting::*} and {-initload::*}
|
||||
delete {-fastworldresetworld::*}, {-unloading::*}, {-resetting::*}, {-inworldreset::*} and {-initload::*}
|
||||
|
||||
set {_worlddir} to {-fwrcache::worlddir}
|
||||
create section stored in {_section}:
|
||||
@ -830,3 +833,9 @@ on skript unload:
|
||||
{-fastworldresetworld::%loop-world%} is set
|
||||
{fastworldreset::chunkresetdisabled::%loop-world%} is not set
|
||||
unloadWorld(loop-world, false)
|
||||
|
||||
#for use of {-inworldreset::worldname} variable in your scripts, this can help to tell whether a world is currently in a reset process
|
||||
on start of world reset:
|
||||
set {-inworldreset::%event-world%} to now
|
||||
on complete of world reset:
|
||||
delete {-inworldreset::%event-world%}
|
||||
|
Loading…
Reference in New Issue
Block a user