Class CodeScript

java.lang.Object
ua.mcchickenstudio.opencreative.coding.CodeScript

public class CodeScript extends Object

CodeScript

This class represents configuration file that stores planet's code. It has methods to load code and save coding blocks.
See Also:
  • Constructor Details

    • CodeScript

      public CodeScript(@NotNull @NotNull Planet planet)
  • Method Details

    • loadCode

      @NotNull public @NotNull CompletableFuture<Boolean> 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

      @NotNull public @NotNull CodeStorage getConfig()
      Returns config, that stores code script.
      Returns:
      code script config.
    • getExecutors

      @NotNull public @NotNull PlanetExecutors getExecutors()
      Returns instance of executors.
      Returns:
      executors of script.
    • getPlanet

      @NotNull public @NotNull Planet getPlanet()