Skip to main content

Event

A hook for a certain event in Minecraft

warning

This page is a WIP. It contains all the information in Figura's documentation but we're working on adding more helpful descriptions.

You may register functions to one, and those functions will be called when the event occurs


register()

Register a function on this event

Functions are run in registration order

An optional string argument can be given, grouping functions under that name, for an easier management later on

register(func)

Parameters:

NameTypeDescriptionDefault
funcFunction--

Returns:

TypeDescription
EventReturns self for chaining

Example:

events.TICK:register(function() end, "Name")

clear()

Clears the given event of all its functions

clear()

Returns:

TypeDescription
nil-

Example:

events.TICK:clear()

remove()

Removes either a function from this event or when given a string, remove all functions registered under that name

Returns the number of functions that were removed

remove(name)

Parameters:

NameTypeDescriptionDefault
nameString--

Returns:

TypeDescription
Integer-

Example:

events.TICK:remove("Name")

getRegisteredCount()

Returns the number of functions that are registered with the given name

getRegisteredCount(name)

Parameters:

NameTypeDescriptionDefault
nameString--

Returns:

TypeDescription
Integer-

Example:

events.TICK:getRegisteredCount("Name")