MCServer API - Index


The API reference is divided into the following sections:


Articles

The following articles provide various extra information on plugin development


Class index

The following classes are available in the MCServer Lua scripting language:


Hooks

A plugin can register to be called whenever an "interesting event" occurs. It does so by calling cPluginManager's AddHook() function and implementing a callback function to handle the event.

A plugin can decide whether it will let the event pass through to the rest of the plugins, or hide it from them. This is determined by the return value from the hook callback function. If the function returns false or no value, the event is propagated further. If the function returns true, the processing is stopped, no other plugin receives the notification (and possibly MCServer disables the default behavior for the event). See each hook's details to see the exact behavior.

Hook name Called when
HOOK_BLOCK_SPREAD Called when a block spreads based on world conditions
HOOK_BLOCK_TO_PICKUPS A block is about to be dug (player, entity or natural reason), plugins may override what pickups that will produce.
HOOK_CHAT Player sends a chat message
HOOK_CHUNK_AVAILABLE A chunk has just been added to world, either generated or loaded.
HOOK_CHUNK_GENERATED After a chunk was generated. Notification only.
HOOK_CHUNK_GENERATING A chunk is about to be generated. Plugin can override the built-in generator.
HOOK_CHUNK_UNLOADED A chunk has been unloaded from the memory.
HOOK_CHUNK_UNLOADING A chunk is about to be unloaded from the memory. Plugins may refuse the unload.
HOOK_COLLECTING_PICKUP Player is about to collect a pickup. Plugin can refuse / override behavior.
HOOK_CRAFTING_NO_RECIPE No built-in crafting recipe is found. Plugin may provide a recipe.
HOOK_DISCONNECT A client has disconnected, either by explicitly sending the disconnect packet (in older protocols) or their connection was terminated
HOOK_ENTITY_ADD_EFFECT An entity effect is about to get added to an entity.
HOOK_EXECUTE_COMMAND A player executes an in-game command, or the admin issues a console command. Note that built-in console commands are exempt to this hook - they are always performed and the hook is not called.
HOOK_EXPLODED An explosion has happened
HOOK_EXPLODING An explosion is about to be processed
HOOK_HANDSHAKE A client is connecting.
HOOK_HOPPER_PULLING_ITEM A hopper is pulling an item from another block entity.
HOOK_HOPPER_PUSHING_ITEM A hopper is pushing an item into another block entity.
HOOK_KILLING A player or a mob is dying.
HOOK_LOGIN Right before player authentication. If auth is disabled, right after the player sends their name.
HOOK_PLAYER_ANIMATION A client has sent an Animation packet (0x12)
HOOK_PLAYER_BREAKING_BLOCK Just before a player breaks a block. Plugin may override / refuse.
HOOK_PLAYER_BROKEN_BLOCK After a player has broken a block. Notification only.
HOOK_PLAYER_DESTROYED A player object is about to be destroyed.
HOOK_PLAYER_EATING When the player starts eating
HOOK_PLAYER_FISHED A player gets a reward from fishing.
HOOK_PLAYER_FISHING A player is about to get a reward from fishing.
HOOK_PLAYER_FOOD_LEVEL_CHANGE Called before the player food level changed. Plugin may override
HOOK_PLAYER_JOINED After Login and before Spawned, before being added to world.
HOOK_PLAYER_LEFT_CLICK A left-click packet is received from the client. Plugin may override / refuse.
HOOK_PLAYER_MOVING Player tried to move in the tick being currently processed. Plugin may refuse movement.
HOOK_PLAYER_PLACED_BLOCK After a player has placed a block. Notification only.
HOOK_PLAYER_PLACING_BLOCK Just before a player places a block. Plugin may override / refuse.
HOOK_PLAYER_RIGHT_CLICK A right-click packet is received from the client. Plugin may override / refuse.
HOOK_PLAYER_RIGHT_CLICKING_ENTITY A player has right-clicked an entity. Plugins may override / refuse.
HOOK_PLAYER_SHOOTING When the player releases the bow, shooting an arrow (other projectiles: unknown)
HOOK_PLAYER_SPAWNED After a player (re)spawns in the world to which they belong to.
HOOK_PLAYER_TOSSING_ITEM A player is tossing an item. Plugin may override / refuse.
HOOK_PLAYER_USED_BLOCK A player has just used a block (chest, furnace...). Notification only.
HOOK_PLAYER_USED_ITEM A player has used an item in hand (bucket...)
HOOK_PLAYER_USING_BLOCK Just before a player uses a block (chest, furnace...). Plugin may override / refuse.
HOOK_PLAYER_USING_ITEM Just before a player uses an item in hand (bucket...). Plugin may override / refuse.
HOOK_PLUGINS_LOADED All the enabled plugins have been loaded
HOOK_PLUGIN_MESSAGE The server receives a plugin message from a client
HOOK_POST_CRAFTING After the built-in recipes are checked and a recipe was found.
HOOK_PRE_CRAFTING Before the built-in recipes are checked.
HOOK_PROJECTILE_HIT_BLOCK A projectile hits a solid block.
HOOK_PROJECTILE_HIT_ENTITY A projectile hits another entity.
HOOK_SERVER_PING Client pings the server from the server list.
HOOK_SPAWNED_ENTITY After an entity is spawned in the world.
HOOK_SPAWNED_MONSTER After a monster is spawned in the world
HOOK_SPAWNING_ENTITY Before an entity is spawned in the world.
HOOK_SPAWNING_MONSTER Before a monster is spawned in the world.
HOOK_TAKE_DAMAGE An entity is taking any kind of damage
HOOK_TICK Every server tick (approximately 20 times per second)
HOOK_UPDATED_SIGN After the sign text is updated. Notification only.
HOOK_UPDATING_SIGN Before the sign text is updated. Plugin may modify the text / refuse.
HOOK_WEATHER_CHANGED The weather has changed
HOOK_WEATHER_CHANGING The weather is about to change
HOOK_WORLD_STARTED A world is initialized
HOOK_WORLD_TICK Every world tick (about 20 times per second), separately for each world


Documentation statistics

ObjectTotalDocumentedUndocumentedDocumented %
Classes82766
92.68 %
Functions12101053157
87.02 %
Member variables483711
77.08 %
Constants13252181107
16.45 %
Hooks61610
100.00 %

There are 113 internal links, 9 of them are invalid.