Better 1.13+ support
This commit is contained in:
parent
1fc1bd59e9
commit
a034ca69e6
@ -33,7 +33,10 @@ import:
|
||||
java.util.Arrays
|
||||
java.nio.file.Files
|
||||
java.nio.file.Paths
|
||||
ch.njol.skript.Skript
|
||||
on script load:
|
||||
if Skript.isRunningMinecraft(1, 13) is true:
|
||||
set {-fwrcache::modern} to true
|
||||
wait a tick #needed to wait for plugins to load
|
||||
|
||||
set {-fwrcache::bukkitgetserver} to Bukkit.getServer()
|
||||
@ -55,7 +58,8 @@ on script load:
|
||||
send "[FastWorldReset] GovindaSK found! Enabling faster chunk unloads in chunk-based reset." to console
|
||||
set {-govindask} to true
|
||||
else:
|
||||
send "[FastWorldReset] GovindaSK not found, falling back to a slower, reflection way of unloading chunks in chunk-based reset. (2 errors related to chunk unloading will appear, but you can safely ignore them)" to console
|
||||
if {-fwrcache::modern} is not set:
|
||||
send "[FastWorldReset] GovindaSK not found, falling back to a slower, reflection way of unloading chunks in chunk-based reset." to console
|
||||
|
||||
|
||||
event "world_reset_start":
|
||||
@ -298,7 +302,9 @@ command /fastworldreset [<text>] [<text>] [<text>]:
|
||||
|
||||
send "&a&lFastWorldReset&2&l> &aSuccessfully copied &e&l%arg 2% &aand made it resettable in &e&l%difference between {_n} and now%&e! If it doesn't work check console for errors."
|
||||
send "&a&lFastWorldReset&2&l> &eIf you ever wish to update the template of this world, just run &b/fwr create %arg 2% &eagain!"
|
||||
|
||||
if {-fwrcache::modern} is set:
|
||||
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:
|
||||
@ -566,7 +572,10 @@ command /fastworldreset [<text>] [<text>] [<text>]:
|
||||
if {fastworldreset::chunkresetdisabled::%arg 2%} is not set:
|
||||
set {fastworldreset::chunkresetdisabled::%arg 2%} to true
|
||||
(arg 2 parsed as a world).setAutoSave(true)
|
||||
send "&a&lFastWorldReset&2&l> &aYou have disabled chunk-based reset for the world &e%arg 2% &aplease note that this makes reset slower and more likely to cause lag spikes, but it makes chunks automatically unload in the world as usual, making the world lighter on RAM usage."
|
||||
if {-fwrcache::modern} is not set:
|
||||
send "&a&lFastWorldReset&2&l> &aYou have disabled chunk-based reset for the world &e%arg 2% &aplease note that this makes reset slower and more likely to cause lag spikes, but it makes chunks automatically unload in the world as usual, making the world lighter on RAM usage."
|
||||
else:
|
||||
send "&a&lFastWorldReset&2&l> &aYou have disabled chunk-based reset for the world &e%arg 2%&a. This is a good choice for 1.13+ version as chunk-based reset is only helpful below 1.13."
|
||||
else:
|
||||
send "&a&lFastWorldReset&2&l> &cChunk-based reset is already disabled in world &e%arg 2%&c!"
|
||||
else if arg 1 is "enable-chunk-reset":
|
||||
@ -578,7 +587,7 @@ command /fastworldreset [<text>] [<text>] [<text>]:
|
||||
stop
|
||||
if {fastworldreset::chunkresetdisabled::%arg 2%} is set:
|
||||
delete {fastworldreset::chunkresetdisabled::%arg 2%}
|
||||
send "&a&lFastWorldReset&2&l> &aYou have enabled chunk-based reset for the world &e%arg 2% &aagain! Yay, faster world reset! (Note chunk-based reset is only effective in 1.8-1.12.2)"
|
||||
send "&a&lFastWorldReset&2&l> &aYou have enabled chunk-based reset for the world &e%arg 2%&a! Yay, faster world reset! (Note chunk-based reset is only effective in 1.8-1.12.2)"
|
||||
(arg 2 parsed as a world).setAutoSave(false)
|
||||
else:
|
||||
send "&a&lFastWorldReset&2&l> &cChunk-based reset is already enabled for the world &e%arg 2%&c!"
|
||||
@ -715,7 +724,7 @@ command /fastworldreset [<text>] [<text>] [<text>]:
|
||||
send formatted "<ttp:&f/fwr unload <world>%newline%&7May be useful for unloading worlds which you no longer need.>&f/fwr unload <world> &a- unload a world."
|
||||
send "&f/fwr unload-chunks <world> <true/false> &a- unloads chunks in the specified world, with saving or without."
|
||||
send "&f/fwr tp <world> [player] &a- teleport to a world or teleport another player to the world."
|
||||
send formatted "<ttp:&f/fwr disable-chunk-reset <world>%{_newline}%&7May be useful in situations where the world uses very much RAM and you prefer slower reset than higher RAM usage>&f/fwr disable-chunk-reset <world> &a- disables chunk-based resetting of the specified world, which makes the chunks unload normally."
|
||||
send formatted "<ttp:&f/fwr disable-chunk-reset <world>%newline%&7May be useful in situations where the world uses very much RAM and you prefer slower reset than higher RAM usage>&f/fwr disable-chunk-reset <world> &a- disables chunk-based resetting of the specified world, which makes the chunks unload normally."
|
||||
send "&f/fwr enable-chunk-reset <world> &a- enables chunk-based reset, this is enabled by default for fastest speed, see above to disable. (This is only meant for things like minigame maps, not where you need changes to persist across server restarts!)"
|
||||
send "&f/fwr worlds &a- shows the list of all worlds and their data."
|
||||
send "&f/fwr generator <world> <generator> &a- set a generator for a world."
|
||||
@ -774,11 +783,12 @@ on skript load:
|
||||
#chunk-based reset, which resets by not saving chunks and re-loading them instead of reloading the whole world. it reloads the world only if the world got saved by some system.
|
||||
|
||||
on chunk unload:
|
||||
{-fastworldresetworld::%event-world%} is set
|
||||
{fastworldreset::chunkresetdisabled::%event-world%} is not set
|
||||
{-resetting::%event-world%} is not set
|
||||
{-unloading::%event-world%} is not set
|
||||
cancel event
|
||||
parse if Skript.isRunningMinecraft(1, 13) is false:
|
||||
{-fastworldresetworld::%event-world%} is set
|
||||
{fastworldreset::chunkresetdisabled::%event-world%} is not set
|
||||
{-resetting::%event-world%} is not set
|
||||
{-unloading::%event-world%} is not set
|
||||
cancel event
|
||||
|
||||
on world init:
|
||||
if {-initload::%event-world%} is set:
|
||||
|
Loading…
Reference in New Issue
Block a user