How to use?
1. In the plugin configuration map events and commands to functions from your script file like in the example below to have them registered.
Code (YAML):
# Function mapping
scripts:
example:
enabled
: true
file
:
"scripts/example.script"
# Mappings for event handlers
events:
on-player-death:
event-class
:
"org.bukkit.event.entity.PlayerDeathEvent"
function
:
"onPlayerDeath"
priority
:
"NORMAL"
on-block-break:
event-class
:
"org.bukkit.event.block.BlockBreakEvent"
function
:
"onBlockBreak"
priority
:
"NORMAL"
# Mappings for commands
commands:
test-command:
aliases
:
[
"test-command-alias"
]
description
:
"Eliminates the player"
permission
:
"handlerscriptloader.test"
usage
:
"/<command> [player]"
function-exe
:
"onCommandTest"
function-tab
:
"onTabCompleteTest"
# Toggles checks of updates released for LIX4J.
# Do not modify anything but 'enabled'.
updater:
enabled
: true
2. In your script file write some logic for the functions.
Code (Text):
counter = 0;
function onBlockBreak(event) {
event.getPlayer().sendMessage("You broke " + ++counter + " blocks.");
}
function onPlayerDeath(event) {
event.getPlayer().sendMessage("You died!");
}
function onCommandTest(sender, alias, args) {
sender.setHealth(0.0);
}
list = new_instance("java.util.ArrayList", new_array("java.lang.Object", 0));
list.add("suggestion");
function onTabCompleteTest(sender, alias, args) {
return list;
}