-
Notifications
You must be signed in to change notification settings - Fork 0
Events
Shane Bee edited this page May 3, 2026
·
4 revisions
In Skript there are generally 2 different wants to register events:
- You can have a class that extends
SimpleEventand register as many events as you'd like
(Skript handles a lot of it for you). - You can have a class that extends
SkriptEventfor a single event that may need more attention.
public class Events extends SimpleEvent {
public static void register(Registration reg) {
// Block Damage Abort Event
reg.newEvent(BlockEvents.class, BlockDamageAbortEvent.class,
"block damage abort")
.name("Block Damage Abort")
.description("Called when a player stops damaging a Block. Requires MC 1.18.x+")
.examples("on block damage abort:",
"\tsend \"get back to work\"")
.since("2.8.3")
.register();
reg.newEventValue(BlockDamageAbortEvent.class, Player.class)
.converter(BlockDamageAbortEvent::getPlayer)
.register();
reg.newEventValue(BlockDamageAbortEvent.class, ItemStack.class)
.description("Gets the ItemStack for the item currently in the player's hand.")
.converter(BlockDamageAbortEvent::getItemInHand)
.register();
reg.newEventValue(BlockDamageAbortEvent.class, ItemType.class)
.description("Gets the ItemType for the item currently in the player's hand.")
.converter(event -> new ItemType(event.getItemInHand()))
.register();
}
}Please see SkBee's Other Event Package for examples.