Class BukkitScriptManager
java.lang.Object
dev.magicmq.pyspigot.manager.script.ScriptManager
dev.magicmq.pyspigot.bukkit.manager.script.BukkitScriptManager
The Bukkit-specific implementation of the script manager.
-
Method Summary
Modifier and TypeMethodDescriptionprotected booleancallScriptExceptionEvent(Script script, PyException exception) Calls a ScriptExceptionEvent via a platform-specific implementation.protected voidcallScriptLoadEvent(Script script) Calls a ScriptLoadEvent via a platform-specific implementation.protected voidcallScriptUnloadEvent(Script script, boolean error) Calls a ScriptUnloadEvent via a platform-specific implementation.protected voidCancels the start script task via a platform-specific implementation.static BukkitScriptManagerget()Get the singleton instance of this BukkitScriptManager.protected voidinitScriptPermissions(Script script) Initialize script permissions via a platform-specific implementation.protected booleanisPluginDependencyMissing(String dependency) Checks if a script plugin dependency is missing via a platform-specific implementation.protected ScriptOptionsnewProjectOptions(Path projectConfigPath) 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.protected ScriptnewScript(Path path, String name, ScriptOptions options, boolean project) Initialize a new Script via a platform-specific implementation.protected ScriptOptionsnewScriptOptions(Path scriptPath) Initialize a new ScriptOptions for a single-file script via a platform-specific implementation, using the appropriate values in the script_options.yml file.protected voidremoveScriptPermissions(Script script) Remove script permissions from the server via a platform-specific implementation.protected voidSchedules and starts the start script task for the script load delay via a platform-specific implementation.protected voidunloadScriptOnMainThread(Script script, boolean error) Unloads the script on the main thread by scheduling the unload operation with a platform-specific scheduler.protected voidunregisterFromPlatformManagers(Script script) Unregisters the script from any platform-specific managers.Methods inherited from class dev.magicmq.pyspigot.manager.script.ScriptManager
getAllProjectPaths, getAllScriptNames, getAllScriptPaths, getLoadedScriptNames, getLoadedScripts, getProjectOptions, getProjectPath, getScriptByName, getScriptByPath, getScriptInfo, getScriptOptions, getScriptPath, handleScriptException, initJython, isScriptRunning, loadProject, loadProject, loadProject, loadScript, loadScript, loadScript, loadScripts, shutdown, unloadScript, unloadScript, unloadScripts
-
Method Details
-
scheduleStartScriptTask
protected void scheduleStartScriptTask()Description copied from class:ScriptManagerSchedules and starts the start script task for the script load delay via a platform-specific implementation.- Specified by:
scheduleStartScriptTaskin classScriptManager
-
cancelStartScriptTask
protected void cancelStartScriptTask()Description copied from class:ScriptManagerCancels the start script task via a platform-specific implementation.- Specified by:
cancelStartScriptTaskin classScriptManager
-
isPluginDependencyMissing
Description copied from class:ScriptManagerChecks if a script plugin dependency is missing via a platform-specific implementation.- Specified by:
isPluginDependencyMissingin classScriptManager- Parameters:
dependency- The name of the dependency to check- Returns:
- True if the dependency is missing, false if it is present
-
callScriptExceptionEvent
Description copied from class:ScriptManagerCalls a ScriptExceptionEvent via a platform-specific implementation.- Specified by:
callScriptExceptionEventin classScriptManager- Parameters:
script- The script that threw the exceptionexception- The exception that was thrown- Returns:
- True if the exception should be reported, false if otherwise
-
callScriptLoadEvent
Description copied from class:ScriptManagerCalls a ScriptLoadEvent via a platform-specific implementation.- Specified by:
callScriptLoadEventin classScriptManager- Parameters:
script- The script that was loaded
-
callScriptUnloadEvent
Description copied from class:ScriptManagerCalls a ScriptUnloadEvent via a platform-specific implementation.- Specified by:
callScriptUnloadEventin classScriptManager- Parameters:
script- The script that was unloadederror- True if the unload was due to an error, false if it was not
-
newScriptOptions
Description copied from class:ScriptManagerInitialize 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:
newScriptOptionsin classScriptManager- Parameters:
scriptPath- The path of the script file whose script options should be initialized- Returns:
- The new ScriptOptions
-
newProjectOptions
Description copied from class:ScriptManagerInitialize 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:
newProjectOptionsin classScriptManager- Parameters:
projectConfigPath- The path of the project.yml file to parse that belongs to the project. If the project.yml. If the project does not have a project.yml file, pass null, and the default values will be used- Returns:
- The new ScriptOptions
-
newScript
Description copied from class:ScriptManagerInitialize a new Script via a platform-specific implementation.- Specified by:
newScriptin classScriptManager- Parameters:
path- The path that corresponds to the file where the script livesname- The name of this script. Should contain its extension (.py)options- TheScriptOptionsfor this scriptproject- True if the script is a multi-file project, false if it is a single-file script- Returns:
- The new script
-
initScriptPermissions
Description copied from class:ScriptManagerInitialize script permissions via a platform-specific implementation.- Specified by:
initScriptPermissionsin classScriptManager- Parameters:
script- The script whose permissions should be initialized
-
removeScriptPermissions
Description copied from class:ScriptManagerRemove script permissions from the server via a platform-specific implementation.- Specified by:
removeScriptPermissionsin classScriptManager- Parameters:
script- The script whose permissions should be removed
-
unregisterFromPlatformManagers
Description copied from class:ScriptManagerUnregisters the script from any platform-specific managers.- Specified by:
unregisterFromPlatformManagersin classScriptManager- Parameters:
script- The script to unregister
-
unloadScriptOnMainThread
Description copied from class:ScriptManagerUnloads 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:
unloadScriptOnMainThreadin classScriptManager- Parameters:
script- The script to unloaderror- If the script unload was due to an error, pass true. Otherwise, pass false
-
get
Get the singleton instance of this BukkitScriptManager.- Returns:
- The instance
-