Enchatment Events
The events that will be executed when an item with this enchantment is used.
When a bukkit event is called, the plugin will search for enchantment events with this event name, all found enchantment events will be executed for this event. Execution occurs in two phases, constraints evaluation and functions evaluation.
Starting the execution
Predefined variables are assigned to the event that can later be used in the event's constraints and functions:
self
The player that executed the enchantment.event
The event that was dispatched.level
The data about the current level of the player's enchantment.
Constraints
First round to be evaluated in order to verify if the event functions should be executed, such contraints must be expressions that can be evaluated to Boolean
type.
constraints: |
event.getBlock().getType().name().contains("ORE")
Functions
Second round to be executed, the evaluator will only reach here if all the constraints have passed, here you can use all kinds of expressions, statements, functions, etc. Example:
functions: |
self.sendMessage(event.getBlock().getType().name())
Last updated