Cuberite API - Index
The API reference is divided into the following sections:
Articles
The following articles provide various extra information on plugin development
- Writing a Cuberite plugin
- Using the Info.lua file
- Setting up the Decoda Lua IDE
- Setting up the ZeroBrane Studio Lua IDE
- Setting up Lua-Language-Server (VSCode/Emacs)
- Using ChunkStays
- Webserver vs World threads
Class index
The following classes are available in the Cuberite Lua scripting language:
- BannerPattern
- BossBarColor
- BossBarDivisionType
- cArrowEntity
- cBeaconEntity
- cBedEntity
- cBlockArea
- cBlockEntity
- cBlockEntityWithItems
- cBlockInfo
- cBoat
- cBoundingBox
- cBrewingstandEntity
- cChatColor
- cChestEntity
- cChunkDesc
- cClientHandle
- cColor
- cCommandBlockEntity
- cCompositeChat
- cCraftingGrid
- cCraftingRecipe
- cCryptoHash
- cCuboid
- cDispenserEntity
- cDropperEntity
- cDropSpenserEntity
- cEnchantments
- cEnderCrystal
- cEntity
- cEntityEffect
- cExpBottleEntity
- cExpOrb
- cFallingBlock
- cFile
- cFireChargeEntity
- cFireworkEntity
- cFloater
- cFlowerPotEntity
- cFurnaceEntity
- cGhastFireballEntity
- cHangingEntity
- cHopperEntity
- cIniFile
- cInventory
- cItem
- cItemFrame
- cItemGrid
- cItems
- cJson
- cJukeboxEntity
- cLeashKnot
- cLineBlockTracer
- cLuaWindow
- cMap
- cMapManager
- cMobHeadEntity
- cMobSpawnerEntity
- cMojangAPI
- cMonster
- cNetwork
- cNoteEntity
- cObjective
- cPainting
- cPawn
- cPickup
- cPlayer
- cPlugin
- cPluginLua
- cPluginManager
- cProjectileEntity
- cRankManager
- cRoot
- cScoreboard
- cServer
- cServerHandle
- cSignEntity
- cSplashPotionEntity
- cStringCompression
- cTCPLink
- cTeam
- cThrownEggEntity
- cThrownEnderPearlEntity
- cThrownSnowballEntity
- cTNTEntity
- cUDPEndpoint
- cUrlClient
- cUrlParser
- CustomStatistic
- cUUID
- cWebAdmin
- cWindow
- cWitherSkullEntity
- cWorld
- EffectID
- HTTPFormData
- HTTPRequest
- HTTPTemplateRequest
- ItemCategory
- lxp
- SmokeDirection
- sqlite3
- StatisticsManager
- TakeDamageInfo
- tolua
- Vector3d
- Vector3f
- Vector3i
- Globals
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 Cuberite 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_BREWING_COMPLETED | A brewing process is completed. |
HOOK_BREWING_COMPLETING | A brewing process is completing. |
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_DROPSPENSE | A dispenser or dropper is about to dispense/drop an item. |
HOOK_ENTITY_ADD_EFFECT | An entity effect is about to get added to an entity. |
HOOK_ENTITY_CHANGED_WORLD | After a entity has changed the world. |
HOOK_ENTITY_CHANGING_WORLD | Before a entity is changing the world. |
HOOK_ENTITY_TELEPORT | Any entity teleports. Plugin may refuse teleport. |
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_KILLED | A player or a mob died. |
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_LOGIN_FORGE | (No documentation yet) |
HOOK_PLAYER_ANIMATION | A client has sent an Animation packet |
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_CROUCHED | Player crouched in the tick being currently processed. |
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_OPENING_WINDOW | Called when a player is about to open a window |
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
Object | Total | Documented | Undocumented | Documented % | |
---|---|---|---|---|---|
Classes | 116 | 115 | 1 |
| 99.14 % |
Functions | 1631 | 1603 | 28 |
| 98.28 % |
Member variables | 35 | 32 | 3 |
| 91.43 % |
Constants | 1850 | 1255 | 595 |
| 67.84 % |
Hooks | 71 | 70 | 1 |
| 98.59 % |
There are 131 internal links, 5 of them are invalid.