Class BukkitScriptManager

java.lang.Object
dev.magicmq.pyspigot.manager.script.ScriptManager
dev.magicmq.pyspigot.bukkit.manager.script.BukkitScriptManager

public class BukkitScriptManager extends ScriptManager
The Bukkit-specific implementation of the script manager.
  • Method Details

    • scheduleStartScriptTask

      protected void scheduleStartScriptTask()
      Description copied from class: ScriptManager
      Schedules and starts the start script task for the script load delay via a platform-specific implementation.
      Specified by:
      scheduleStartScriptTask in class ScriptManager
    • cancelStartScriptTask

      protected void cancelStartScriptTask()
      Description copied from class: ScriptManager
      Cancels the start script task via a platform-specific implementation.
      Specified by:
      cancelStartScriptTask in class ScriptManager
    • isPluginDependencyMissing

      protected boolean isPluginDependencyMissing(String dependency)
      Description copied from class: ScriptManager
      Checks if a script plugin dependency is missing via a platform-specific implementation.
      Specified by:
      isPluginDependencyMissing in class ScriptManager
      Parameters:
      dependency - The name of the dependency to check
      Returns:
      True if the dependency is missing, false if it is present
    • callScriptExceptionEvent

      protected boolean callScriptExceptionEvent(Script script, PyException exception)
      Description copied from class: ScriptManager
      Calls a ScriptExceptionEvent via a platform-specific implementation.
      Specified by:
      callScriptExceptionEvent in class ScriptManager
      Parameters:
      script - The script that threw the exception
      exception - The exception that was thrown
      Returns:
      True if the exception should be reported, false if otherwise
    • callScriptLoadEvent

      protected void callScriptLoadEvent(Script script)
      Description copied from class: ScriptManager
      Calls a ScriptLoadEvent via a platform-specific implementation.
      Specified by:
      callScriptLoadEvent in class ScriptManager
      Parameters:
      script - The script that was loaded
    • callScriptUnloadEvent

      protected void callScriptUnloadEvent(Script script, boolean error)
      Description copied from class: ScriptManager
      Calls a ScriptUnloadEvent via a platform-specific implementation.
      Specified by:
      callScriptUnloadEvent in class ScriptManager
      Parameters:
      script - The script that was unloaded
      error - True if the unload was due to an error, false if it was not
    • newScriptOptions

      protected ScriptOptions newScriptOptions()
      Description copied from class: ScriptManager
      Initialize a new ScriptOptions with the default values via a platform-specific implementation.
      Specified by:
      newScriptOptions in class ScriptManager
      Returns:
      The new ScriptOptions
    • newScriptOptions

      protected ScriptOptions newScriptOptions(Path scriptPath)
      Description copied from class: ScriptManager
      Initialize a new ScriptOptions for a single-file script via a platform-specific implementation, using the appropriate values in the script_options.yml file.
      Specified by:
      newScriptOptions in class ScriptManager
      Parameters:
      scriptPath - The path of the script file whose script options should be initialized
      Returns:
      The new ScriptOptions
    • newProjectOptions

      protected ScriptOptions newProjectOptions(Path projectConfigPath)
      Description copied from class: ScriptManager
      Initialize a new ScriptOptions for a multi-file project via a platform-specific implementation, using the appropriate values in the project's project.yml file.
      Specified by:
      newProjectOptions in class ScriptManager
      Parameters:
      projectConfigPath - The path of the project.yml file to parse that belongs to the project
      Returns:
      The new ScriptOptions
    • newScript

      protected Script newScript(Path path, String name, ScriptOptions options, boolean project)
      Description copied from class: ScriptManager
      Initialize a new Script via a platform-specific implementation.
      Specified by:
      newScript in class ScriptManager
      Parameters:
      path - The path that corresponds to the file where the script lives
      name - The name of this script. Should contain its extension (.py)
      options - The ScriptOptions for this script
      project - True if the script is a multi-file project, false if it is a single-file script
      Returns:
      The new script
    • initScriptPermissions

      protected void initScriptPermissions(Script script)
      Description copied from class: ScriptManager
      Initialize script permissions via a platform-specific implementation.
      Specified by:
      initScriptPermissions in class ScriptManager
      Parameters:
      script - The script whose permissions should be initialized
    • removeScriptPermissions

      protected void removeScriptPermissions(Script script)
      Description copied from class: ScriptManager
      Remove script permissions from the server via a platform-specific implementation.
      Specified by:
      removeScriptPermissions in class ScriptManager
      Parameters:
      script - The script whose permissions should be removed
    • unregisterFromPlatformManagers

      protected void unregisterFromPlatformManagers(Script script)
      Description copied from class: ScriptManager
      Unregisters the script from any platform-specific managers.
      Specified by:
      unregisterFromPlatformManagers in class ScriptManager
      Parameters:
      script - The script to unregister
    • unloadScriptOnMainThread

      protected void unloadScriptOnMainThread(Script script, boolean error)
      Description copied from class: ScriptManager
      Unloads the script on the main thread by scheduling the unload operation with a platform-specific scheduler.

      Used in conjunction with ScriptManager.handleScriptException(Script, PyException, String) to ensure if sys.exit is called from an asynchronous context, the script is unloaded synchronously.

      Specified by:
      unloadScriptOnMainThread in class ScriptManager
      Parameters:
      script - The script to unload
      error - If the script unload was due to an error, pass true. Otherwise, pass false
    • get

      public static BukkitScriptManager get()
      Get the singleton instance of this BukkitScriptManager.
      Returns:
      The instance