Class CodeScript
java.lang.Object
ua.mcchickenstudio.opencreative.coding.CodeScript
CodeScript
This class represents configuration file that stores planet's code. It has methods to load code and save coding blocks.- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclear(boolean removeCurrentCode) Moves stored code in old-code section to prevent being overwritten by new code.voidcopyToHistoryFolder(long time) Copies codeScript.yml to /plugins/OpenCreative/history folder.@NotNull CodeStorageReturns config, that stores code script.@NotNull PlanetExecutorsReturns instance of executors.longReturns last code load timestamp, or 0 - if world is unloaded.@NotNull Planet@NotNull CompletableFuture<Boolean> loadCode()Loads code from codeScript.yml file.booleansaveCode()Saves code script config into file.voidunload()Clears temporary data: config and executors.
-
Constructor Details
-
CodeScript
-
-
Method Details
-
loadCode
Loads code from codeScript.yml file. -
getLastLaunch
public long getLastLaunch()Returns last code load timestamp, or 0 - if world is unloaded.- Returns:
- timestamp of last code launch.
-
saveCode
public boolean saveCode()Saves code script config into file.- Returns:
- true - if saved, false - if failed.
-
clear
public void clear(boolean removeCurrentCode) Moves stored code in old-code section to prevent being overwritten by new code. -
unload
public void unload()Clears temporary data: config and executors. -
copyToHistoryFolder
public void copyToHistoryFolder(long time) Copies codeScript.yml to /plugins/OpenCreative/history folder.- Parameters:
time- timestamp, when script was changed.
-
getConfig
Returns config, that stores code script.- Returns:
- code script config.
-
getExecutors
Returns instance of executors.- Returns:
- executors of script.
-
getPlanet
-