Skip to content

Dev -> Master v1.2.1#22

Merged
astorks merged 31 commits intomasterfrom
dev
Feb 25, 2020
Merged

Dev -> Master v1.2.1#22
astorks merged 31 commits intomasterfrom
dev

Conversation

@astorks
Copy link
Owner

@astorks astorks commented Feb 20, 2020

What's New

Better exception handling on startup

The script engine will continue loading additional main script files if an exception is encountered and after loading all main scripts, will print warnings in the console and chat if you used the chat command to reload.
image

Config.yml placeholders

Added placeholders to read other config values inside a config value. ${config_val_name}
You can even create your own config values and reference them in any existing config value.
Don't create a circular reference the following example will cause your server to crash.

var_1: '${var_2}'
var_2: '${var_1}'

Multiple main script files

You can now change the default script entrypoint and set multiple main script files to be executed one after another via the config.yml.

# Main script files
# The main entry point javascript files
# Default: ${root_scripts_folder}/main.js
main_script_files:
 - '${root_scripts_folder}/main.js'
 - '${root_scripts_folder}/main-testing.js'

Execute command template

Execute command script template can now be customized via the config.yml

# Execute command template
# This is the code that will be executed with /pyex and /smc python execute
# If a class is returned it will be instantiated and continued on as an object
# If object is returned and has a method execute script engine will call
# returnedObject.execute(sender: CommandSender, server: BukkitServer, servicesManager)
# as well as set returnedObject.sender, returnedObject.server, and returnedObject.servicesManager
# you can also add additional methods, vars to the template source below
# Otherwise the script engine will return last execute code
# %SOURCE% will be replaced with with the command source.
execute_command_template: "import * as lib from './lib/global.js';
new (class EvalCommandSenderContext {
  execute(sender, server, servicesManager) {
    %SOURCE%
  }
})()"

JavaScript Engine

  • Added CommonJS config options to enable/disabled CommonJS support, change the default CommonJS modules folder, and change the default CommonJS globals file.

JavaScript Engine config.yml

config.yml

Python Engine config.yml

config.yml

Added CommonJS config options.
Better config documentation.
Added placeholders to read other config vars inside a config can be used like this: $\{config_val_name}.
@astorks astorks self-assigned this Feb 20, 2020
engine.enableAllPlugins() will only enable currently disabled plugins.
engine.enablePlugin() will warn if plugin context is already enabled.
engine.disablePlugin() will warn if plugin context is not enabled.
Added engine.disableAllPlugins() to disable all currently enabled plugins.
Fixed a few typos in js config.yml
Added ScriptablePluginEngine.getStartupErrors() to get startup errors inside the script engine.
@astorks astorks merged commit bf1b8a4 into master Feb 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant