Code:Event Reference

From Warlords Wiki
Jump to: navigation, search

This is a reference of all events.

Note: events marked as cancellable run synchronously. Because of this, to avoid server slowdowns, they are given an operation limit of 10000. Exceeding this limit will cause an error.

Player Events

Events fired when a player does something.

join

Parameters

(player: Player)

Fires

When a player joins

quit

Parameters

(player: Player)

Fires

When a player quits

left-click

Parameters

(player: Player, location: Location, item: Item)

Fires

When a player left clicks

  • Can be cancelled.

right-click

Parameters

(player: Player, location: Location, item: Item)

Fires

When a player right clicks

  • Can be cancelled.

drop-item

Parameters

(player: Player, item: Item)

Fires

When a player drops an item.

  • Can be cancelled.

pickup-item

Parameters

(player: Player, item: Item)

Fires

When a player picks up an item.

  • Can be cancelled.

edit-book

Parameters

(player: Player)

Fires

When a player edits a book.

  • Can be cancelled.

game-mode-change

Parameters

(player: Player, gamemode: GameMode)

Fires

When the player changes gamemode

  • Can be cancelled.

interact-entity

Parameters

(player: Player, entity: Entity)

Fires

When the player right clicks an entity.

  • Can be cancelled.

break-item

Parameters

(player: Player, item: Item)

Fires

When a player breaks an item

consume-item

Parameters

(player: Player, item: Item)

Fires

When a player consumes an item (food, potion, milk bucket etc)

  • Can be cancelled.

damage-item

Parameters

(player: Player, item: Item)

Fires

When a player damages an item by using it

  • Can be cancelled.

slot-change

Parameters

(player: Player, slot: Number)

Fires

When a player changes their selected slot

  • Can be cancelled.

move

Parameters

(player: Player)

Fires

When a player moves

  • Can be cancelled.

respawn

Parameters

(player: Player)

Fires

When a player respawns

swap-hands

Parameters

(player: Player)

Fires

When a player swaps their main and offhand via the hotkey

  • Can be cancelled.

place-block

Parameters

(player: Player, block: Item, location: Location)

Fires

When a player places a block.

  • Can be cancelled.

break-block

Parameters

(player: Player, block: Item, location: Location)

Fires

When a player breaks a block.

  • Can be cancelled.

command

Parameters

(player: Player, command: String, args: List<String>)

Fires

When a player runs a custom command (beginning with '%'). Arguments are separated by spaces, and are automatically split prior to this event being run.

Unit Events

loop

Parameters

()

Fires

Once every tick.

init

Parameters

()

Fires

After a module is built (either manually, or automatically when the server starts). This is a good time to load data from the Cache

cache

Parameters

()

Fires

Fires every time the server saves data. This is a good place to store things to the Cache.