summaryrefslogtreecommitdiffstats
path: root/MCServer/Plugins/APIDump
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2015-09-06 10:05:18 +0200
committerMattes D <github@xoft.cz>2015-09-06 10:05:18 +0200
commit7da79fdc19a9825b29cda58a698da1fa3cfb8e57 (patch)
treeec17a9703fe734956e4f151cb5306befc4fd7571 /MCServer/Plugins/APIDump
parentMerge pull request #2459 from cuberite/fixes (diff)
parentRenamed output directory to Server (diff)
downloadcuberite-7da79fdc19a9825b29cda58a698da1fa3cfb8e57.tar
cuberite-7da79fdc19a9825b29cda58a698da1fa3cfb8e57.tar.gz
cuberite-7da79fdc19a9825b29cda58a698da1fa3cfb8e57.tar.bz2
cuberite-7da79fdc19a9825b29cda58a698da1fa3cfb8e57.tar.lz
cuberite-7da79fdc19a9825b29cda58a698da1fa3cfb8e57.tar.xz
cuberite-7da79fdc19a9825b29cda58a698da1fa3cfb8e57.tar.zst
cuberite-7da79fdc19a9825b29cda58a698da1fa3cfb8e57.zip
Diffstat (limited to 'MCServer/Plugins/APIDump')
-rw-r--r--MCServer/Plugins/APIDump/APIDesc.lua3045
-rw-r--r--MCServer/Plugins/APIDump/APIDump.deproj168
-rw-r--r--MCServer/Plugins/APIDump/Classes/BlockEntities.lua322
-rw-r--r--MCServer/Plugins/APIDump/Classes/Geometry.lua332
-rw-r--r--MCServer/Plugins/APIDump/Classes/Network.lua372
-rw-r--r--MCServer/Plugins/APIDump/Classes/Plugins.lua207
-rw-r--r--MCServer/Plugins/APIDump/Classes/Projectiles.lua174
-rw-r--r--MCServer/Plugins/APIDump/Classes/WebAdmin.lua51
-rw-r--r--MCServer/Plugins/APIDump/Hooks/OnBlockSpread.lua40
-rw-r--r--MCServer/Plugins/APIDump/Hooks/OnBlockToPickups.lua62
-rw-r--r--MCServer/Plugins/APIDump/Hooks/OnChat.lua30
-rw-r--r--MCServer/Plugins/APIDump/Hooks/OnChunkAvailable.lua27
-rw-r--r--MCServer/Plugins/APIDump/Hooks/OnChunkGenerated.lua67
-rw-r--r--MCServer/Plugins/APIDump/Hooks/OnChunkGenerating.lua35
-rw-r--r--MCServer/Plugins/APIDump/Hooks/OnChunkUnloaded.lua28
-rw-r--r--MCServer/Plugins/APIDump/Hooks/OnChunkUnloading.lua30
-rw-r--r--MCServer/Plugins/APIDump/Hooks/OnCollectingPickup.lua32
-rw-r--r--MCServer/Plugins/APIDump/Hooks/OnCraftingNoRecipe.lua32
-rw-r--r--MCServer/Plugins/APIDump/Hooks/OnDisconnect.lua38
-rw-r--r--MCServer/Plugins/APIDump/Hooks/OnEntityAddEffect.lua33
-rw-r--r--MCServer/Plugins/APIDump/Hooks/OnEntityChangedWorld.lua28
-rw-r--r--MCServer/Plugins/APIDump/Hooks/OnEntityChangingWorld.lua29
-rw-r--r--MCServer/Plugins/APIDump/Hooks/OnEntityTeleport.lua29
-rw-r--r--MCServer/Plugins/APIDump/Hooks/OnExecuteCommand.lua41
-rw-r--r--MCServer/Plugins/APIDump/Hooks/OnExploded.lua49
-rw-r--r--MCServer/Plugins/APIDump/Hooks/OnExploding.lua50
-rw-r--r--MCServer/Plugins/APIDump/Hooks/OnHandshake.lua29
-rw-r--r--MCServer/Plugins/APIDump/Hooks/OnHopperPullingItem.lua30
-rw-r--r--MCServer/Plugins/APIDump/Hooks/OnHopperPushingItem.lua30
-rw-r--r--MCServer/Plugins/APIDump/Hooks/OnKilled.lua22
-rw-r--r--MCServer/Plugins/APIDump/Hooks/OnKilling.lua30
-rw-r--r--MCServer/Plugins/APIDump/Hooks/OnLogin.lua31
-rw-r--r--MCServer/Plugins/APIDump/Hooks/OnPlayerAnimation.lua28
-rw-r--r--MCServer/Plugins/APIDump/Hooks/OnPlayerBreakingBlock.lua36
-rw-r--r--MCServer/Plugins/APIDump/Hooks/OnPlayerBrokenBlock.lua36
-rw-r--r--MCServer/Plugins/APIDump/Hooks/OnPlayerDestroyed.lua27
-rw-r--r--MCServer/Plugins/APIDump/Hooks/OnPlayerEating.lua27
-rw-r--r--MCServer/Plugins/APIDump/Hooks/OnPlayerFished.lua20
-rw-r--r--MCServer/Plugins/APIDump/Hooks/OnPlayerFishing.lua21
-rw-r--r--MCServer/Plugins/APIDump/Hooks/OnPlayerFoodLevelChange.lua27
-rw-r--r--MCServer/Plugins/APIDump/Hooks/OnPlayerJoined.lua29
-rw-r--r--MCServer/Plugins/APIDump/Hooks/OnPlayerLeftClick.lua47
-rw-r--r--MCServer/Plugins/APIDump/Hooks/OnPlayerMoving.lua29
-rw-r--r--MCServer/Plugins/APIDump/Hooks/OnPlayerPlacedBlock.lua40
-rw-r--r--MCServer/Plugins/APIDump/Hooks/OnPlayerPlacingBlock.lua45
-rw-r--r--MCServer/Plugins/APIDump/Hooks/OnPlayerRightClick.lua40
-rw-r--r--MCServer/Plugins/APIDump/Hooks/OnPlayerRightClickingEntity.lua27
-rw-r--r--MCServer/Plugins/APIDump/Hooks/OnPlayerShooting.lua32
-rw-r--r--MCServer/Plugins/APIDump/Hooks/OnPlayerSpawned.lua32
-rw-r--r--MCServer/Plugins/APIDump/Hooks/OnPlayerTossingItem.lua31
-rw-r--r--MCServer/Plugins/APIDump/Hooks/OnPlayerUsedBlock.lua46
-rw-r--r--MCServer/Plugins/APIDump/Hooks/OnPlayerUsedItem.lua46
-rw-r--r--MCServer/Plugins/APIDump/Hooks/OnPlayerUsingBlock.lua46
-rw-r--r--MCServer/Plugins/APIDump/Hooks/OnPlayerUsingItem.lua47
-rw-r--r--MCServer/Plugins/APIDump/Hooks/OnPluginMessage.lua25
-rw-r--r--MCServer/Plugins/APIDump/Hooks/OnPluginsLoaded.lua84
-rw-r--r--MCServer/Plugins/APIDump/Hooks/OnPostCrafting.lua36
-rw-r--r--MCServer/Plugins/APIDump/Hooks/OnPreCrafting.lua37
-rw-r--r--MCServer/Plugins/APIDump/Hooks/OnProjectileHitBlock.lua29
-rw-r--r--MCServer/Plugins/APIDump/Hooks/OnProjectileHitEntity.lua25
-rw-r--r--MCServer/Plugins/APIDump/Hooks/OnServerPing.lua53
-rw-r--r--MCServer/Plugins/APIDump/Hooks/OnSpawnedEntity.lua31
-rw-r--r--MCServer/Plugins/APIDump/Hooks/OnSpawnedMonster.lua30
-rw-r--r--MCServer/Plugins/APIDump/Hooks/OnSpawningEntity.lua33
-rw-r--r--MCServer/Plugins/APIDump/Hooks/OnSpawningMonster.lua33
-rw-r--r--MCServer/Plugins/APIDump/Hooks/OnTakeDamage.lua31
-rw-r--r--MCServer/Plugins/APIDump/Hooks/OnTick.lua29
-rw-r--r--MCServer/Plugins/APIDump/Hooks/OnUpdatedSign.lua38
-rw-r--r--MCServer/Plugins/APIDump/Hooks/OnUpdatingSign.lua58
-rw-r--r--MCServer/Plugins/APIDump/Hooks/OnWeatherChanged.lua28
-rw-r--r--MCServer/Plugins/APIDump/Hooks/OnWeatherChanging.lua35
-rw-r--r--MCServer/Plugins/APIDump/Hooks/OnWorldStarted.lua24
-rw-r--r--MCServer/Plugins/APIDump/Hooks/OnWorldTick.lua29
-rw-r--r--MCServer/Plugins/APIDump/InfoFile.html246
-rw-r--r--MCServer/Plugins/APIDump/LICENSE-prettify.txt191
-rw-r--r--MCServer/Plugins/APIDump/SettingUpDecoda.html49
-rw-r--r--MCServer/Plugins/APIDump/SettingUpZeroBrane.html46
-rw-r--r--MCServer/Plugins/APIDump/Static/.gitignore1
-rw-r--r--MCServer/Plugins/APIDump/Static/decoda_debug_settings.pngbin6178 -> 0 bytes
-rw-r--r--MCServer/Plugins/APIDump/Static/decoda_logo.pngbin2413 -> 0 bytes
-rw-r--r--MCServer/Plugins/APIDump/Static/decoda_workspace.pngbin70644 -> 0 bytes
-rw-r--r--MCServer/Plugins/APIDump/Static/zbs_logo.pngbin1306 -> 0 bytes
-rw-r--r--MCServer/Plugins/APIDump/Static/zbs_workspace.pngbin72631 -> 0 bytes
-rw-r--r--MCServer/Plugins/APIDump/UsingChunkStays.html167
-rw-r--r--MCServer/Plugins/APIDump/WebWorldThreads.html72
-rw-r--r--MCServer/Plugins/APIDump/Writing-a-Cuberite-plugin.html255
-rw-r--r--MCServer/Plugins/APIDump/lang-lua.js2
-rw-r--r--MCServer/Plugins/APIDump/main.css68
-rw-r--r--MCServer/Plugins/APIDump/main_APIDump.lua1685
-rw-r--r--MCServer/Plugins/APIDump/prettify.css1
-rw-r--r--MCServer/Plugins/APIDump/prettify.js30
91 files changed, 0 insertions, 9783 deletions
diff --git a/MCServer/Plugins/APIDump/APIDesc.lua b/MCServer/Plugins/APIDump/APIDesc.lua
deleted file mode 100644
index 187c72b9e..000000000
--- a/MCServer/Plugins/APIDump/APIDesc.lua
+++ /dev/null
@@ -1,3045 +0,0 @@
--- APIDesc.lua
-
--- Contains the API objects' descriptions
-
-
-
-
-g_APIDesc =
-{
- Classes =
- {
- --[[
- -- What the APIDump plugin understands / how to document stuff:
- ExampleClassName =
- {
- Desc = "Description, exported as the first paragraph of the class page. Usually enclosed within double brackets."
-
- Functions =
- {
- FunctionName = { Params = "Parameter list", Return = "Return values list", Notes = "Notes" ),
- OverloadedFunctionName = -- When a function supports multiple parameter variants
- {
- { Params = "Parameter list 1", Return = "Return values list 1", Notes = "Notes 1" },
- { Params = "Parameter list 2", Return = "Return values list 2", Notes = "Notes 2" },
- }
- } ,
-
- Constants =
- {
- ConstantName = { Notes = "Notes about the constant" },
- } ,
-
- ConstantGroups =
- {
- GroupName1 = -- GroupName1 is used as the HTML anchor name
- {
- Include = {"constant1", "constant2", "const_.*"}, -- Constants to include in this group, array of identifiers, accepts wildcards
- TextBefore = "This text will be written in front of the constant list",
- TextAfter = "This text will be written after the constant list",
- ShowInDescendants = false, -- If false, descendant classes won't list these constants
- }
- },
-
- Variables =
- {
- VariableName = { Type = "string", Notes = "Notes about the variable" },
- } ,
-
- AdditionalInfo = -- Paragraphs to be exported after the function definitions table
- {
- {
- Header = "Header 1",
- Contents = "Contents of the additional section 1",
- },
- {
- Header = "Header 2",
- Contents = "Contents of the additional section 2",
- }
- },
-
- Inherits = "ParentClassName", -- Only present if the class inherits from another API class
- },
- ]]--
-
- cBlockArea =
- {
- Desc = [[
- This class is used when multiple adjacent blocks are to be manipulated. Because of chunking
- and multithreading, manipulating single blocks using {{cWorld|cWorld:SetBlock}}() is a rather
- time-consuming operation (locks for exclusive access need to be obtained, chunk lookup is done
- for each block), so whenever you need to manipulate multiple adjacent blocks, it's better to wrap
- the operation into a cBlockArea access. cBlockArea is capable of reading / writing across chunk
- boundaries, has no chunk lookups for get and set operations and is not subject to multithreading
- locking (because it is not shared among threads).</p>
- <p>
- cBlockArea remembers its origin (MinX, MinY, MinZ coords in the Read() call) and therefore supports
- absolute as well as relative get / set operations. Despite that, the contents of a cBlockArea can
- be written back into the world at any coords.</p>
- <p>
- cBlockArea can hold any combination of the following datatypes:<ul>
- <li>block types</li>
- <li>block metas</li>
- <li>blocklight</li>
- <li>skylight</li>
- </ul>
- Read() and Write() functions have parameters that tell the class which datatypes to read / write.
- Note that a datatype that has not been read cannot be written (FIXME).</p>
- <p>
- Typical usage:<ul>
- <li>Create cBlockArea object</li>
- <li>Read an area from the world / load from file / create anew</li>
- <li>Modify blocks inside cBlockArea</li>
- <li>Write the area back to a world / save to file</li>
- </ul></p>
- ]],
- Functions =
- {
- constructor = { Params = "", Return = "cBlockArea", Notes = "Creates a new empty cBlockArea object" },
- Clear = { Params = "", Return = "", Notes = "Clears the object, resets it to zero size" },
- CopyFrom = { Params = "BlockAreaSrc", Return = "", Notes = "Copies contents from BlockAreaSrc into self" },
- CopyTo = { Params = "BlockAreaDst", Return = "", Notes = "Copies contents from self into BlockAreaDst." },
- CountNonAirBlocks = { Params = "", Return = "number", Notes = "Returns the count of blocks that are not air. Returns 0 if blocktypes not available. Block metas are ignored (if present, air with any meta is still considered air)." },
- CountSpecificBlocks =
- {
- { Params = "BlockType", Return = "number", Notes = "Counts the number of occurences of the specified blocktype contained in the area." },
- { Params = "BlockType, BlockMeta", Return = "number", Notes = "Counts the number of occurrences of the specified blocktype + blockmeta combination contained in the area." },
- },
- Create = { Params = "SizeX, SizeY, SizeZ, [DataTypes]", Return = "", Notes = "Initializes this BlockArea to an empty area of the specified size and origin of {0, 0, 0}. Any previous contents are lost." },
- Crop = { Params = "AddMinX, SubMaxX, AddMinY, SubMaxY, AddMinZ, SubMaxZ", Return = "", Notes = "Crops the specified number of blocks from each border. Modifies the size of this blockarea object." },
- DumpToRawFile = { Params = "FileName", Return = "", Notes = "Dumps the raw data into a file. For debugging purposes only." },
- Expand = { Params = "SubMinX, AddMaxX, SubMinY, AddMaxY, SubMinZ, AddMaxZ", Return = "", Notes = "Expands the specified number of blocks from each border. Modifies the size of this blockarea object. New blocks created with this operation are filled with zeroes." },
- Fill = { Params = "DataTypes, BlockType, [BlockMeta], [BlockLight], [BlockSkyLight]", Return = "", Notes = "Fills the entire block area with the same values, specified. Uses the DataTypes param to determine which content types are modified." },
- FillRelCuboid =
- {
- { Params = "{{cCuboid|RelCuboid}}, DataTypes, BlockType, [BlockMeta], [BlockLight], [BlockSkyLight]", Return = "", Notes = "Fills the specified cuboid (in relative coords) with the same values (like Fill() )." },
- { Params = "MinRelX, MaxRelX, MinRelY, MaxRelY, MinRelZ, MaxRelZ, DataTypes, BlockType, [BlockMeta], [BlockLight], [BlockSkyLight]", Return = "", Notes = "Fills the specified cuboid with the same values (like Fill() )." },
- },
- GetBlockLight = { Params = "BlockX, BlockY, BlockZ", Return = "NIBBLETYPE", Notes = "Returns the blocklight at the specified absolute coords" },
- GetBlockMeta = { Params = "BlockX, BlockY, BlockZ", Return = "NIBBLETYPE", Notes = "Returns the block meta at the specified absolute coords" },
- GetBlockSkyLight = { Params = "BlockX, BlockY, BlockZ", Return = "NIBBLETYPE", Notes = "Returns the skylight at the specified absolute coords" },
- GetBlockType = { Params = "BlockX, BlockY, BlockZ", Return = "BLOCKTYPE", Notes = "Returns the block type at the specified absolute coords" },
- GetBlockTypeMeta = { Params = "BlockX, BlockY, BlockZ", Return = "BLOCKTYPE, NIBBLETYPE", Notes = "Returns the block type and meta at the specified absolute coords" },
- GetCoordRange = {Params = "", Return = "MaxX, MaxY, MaxZ", Notes = "Returns the maximum relative coords in all 3 axes. See also GetSize()." },
- GetDataTypes = { Params = "", Return = "number", Notes = "Returns the mask of datatypes that the object is currently holding" },
- GetOrigin = { Params = "", Return = "OriginX, OriginY, OriginZ", Notes = "Returns the origin coords of where the area was read from." },
- GetOriginX = { Params = "", Return = "number", Notes = "Returns the origin x-coord" },
- GetOriginY = { Params = "", Return = "number", Notes = "Returns the origin y-coord" },
- GetOriginZ = { Params = "", Return = "number", Notes = "Returns the origin z-coord" },
- GetNonAirCropRelCoords = { Params = "[IgnoreBlockType]", Return = "MinRelX, MinRelY, MinRelZ, MaxRelX, MaxRelY, MaxRelZ", Notes = "Returns the minimum and maximum coords in each direction for the first non-ignored block in each direction. If there are no non-ignored blocks within the area, or blocktypes are not present, the returned values are reverse-ranges (MinX <- m_RangeX, MaxX <- 0 etc.). IgnoreBlockType defaults to air." },
- GetRelBlockLight = { Params = "RelBlockX, RelBlockY, RelBlockZ", Return = "NIBBLETYPE", Notes = "Returns the blocklight at the specified relative coords" },
- GetRelBlockMeta = { Params = "RelBlockX, RelBlockY, RelBlockZ", Return = "NIBBLETYPE", Notes = "Returns the block meta at the specified relative coords" },
- GetRelBlockSkyLight = { Params = "RelBlockX, RelBlockY, RelBlockZ", Return = "NIBBLETYPE", Notes = "Returns the skylight at the specified relative coords" },
- GetRelBlockType = { Params = "RelBlockX, RelBlockY, RelBlockZ", Return = "BLOCKTYPE", Notes = "Returns the block type at the specified relative coords" },
- GetRelBlockTypeMeta = { Params = "RelBlockX, RelBlockY, RelBlockZ", Return = "BLOCKTYPE, NIBBLETYPE", Notes = "Returns the block type and meta at the specified relative coords" },
- GetSize = { Params = "", Return = "SizeX, SizeY, SizeZ", Notes = "Returns the size of the area in all 3 axes. See also GetCoordRange()." },
- GetSizeX = { Params = "", Return = "number", Notes = "Returns the size of the held data in the x-axis" },
- GetSizeY = { Params = "", Return = "number", Notes = "Returns the size of the held data in the y-axis" },
- GetSizeZ = { Params = "", Return = "number", Notes = "Returns the size of the held data in the z-axis" },
- GetVolume = { Params = "", Return = "number", Notes = "Returns the volume of the area - the total number of blocks stored within." },
- GetWEOffset = { Params = "", Return = "{{Vector3i}}", Notes = "Returns the WE offset, a data value sometimes stored in the schematic files. Cuberite doesn't use this value, but provides access to it using this method. The default is {0, 0, 0}."},
- HasBlockLights = { Params = "", Return = "bool", Notes = "Returns true if current datatypes include blocklight" },
- HasBlockMetas = { Params = "", Return = "bool", Notes = "Returns true if current datatypes include block metas" },
- HasBlockSkyLights = { Params = "", Return = "bool", Notes = "Returns true if current datatypes include skylight" },
- HasBlockTypes = { Params = "", Return = "bool", Notes = "Returns true if current datatypes include block types" },
- LoadFromSchematicFile = { Params = "FileName", Return = "", Notes = "Clears current content and loads new content from the specified schematic file. Returns true if successful. Returns false and logs error if unsuccessful, old content is preserved in such a case." },
- LoadFromSchematicString = { Params = "SchematicData", Return = "", Notes = "Clears current content and loads new content from the specified string (assumed to contain .schematic data). Returns true if successful. Returns false and logs error if unsuccessful, old content is preserved in such a case." },
- Merge =
- {
- { Params = "BlockAreaSrc, {{Vector3i|RelMinCoords}}, Strategy", Return = "", Notes = "Merges BlockAreaSrc into this object at the specified relative coords, using the specified strategy" },
- { Params = "BlockAreaSrc, RelX, RelY, RelZ, Strategy", Return = "", Notes = "Merges BlockAreaSrc into this object at the specified relative coords, using the specified strategy" },
- },
- MirrorXY = { Params = "", Return = "", Notes = "Mirrors this block area around the XY plane. Modifies blocks' metas (if present) to match (i. e. furnaces facing the opposite direction)." },
- MirrorXYNoMeta = { Params = "", Return = "", Notes = "Mirrors this block area around the XY plane. Doesn't modify blocks' metas." },
- MirrorXZ = { Params = "", Return = "", Notes = "Mirrors this block area around the XZ plane. Modifies blocks' metas (if present)" },
- MirrorXZNoMeta = { Params = "", Return = "", Notes = "Mirrors this block area around the XZ plane. Doesn't modify blocks' metas." },
- MirrorYZ = { Params = "", Return = "", Notes = "Mirrors this block area around the YZ plane. Modifies blocks' metas (if present)" },
- MirrorYZNoMeta = { Params = "", Return = "", Notes = "Mirrors this block area around the YZ plane. Doesn't modify blocks' metas." },
- Read =
- {
- { Params = "World, {{cCuboid|Cuboid}}, DataTypes", Return = "bool", Notes = "Reads the area from World, returns true if successful" },
- { Params = "World, {{Vector3i|Point1}}, {{Vector3i|Point2}}, DataTypes", Return = "bool", Notes = "Reads the area from World, returns true if successful" },
- { Params = "World, X1, X2, Y1, Y2, Z1, Z2, DataTypes", Return = "bool", Notes = "Reads the area from World, returns true if successful" },
- },
- RelLine =
- {
- { Params = "{{Vector3i|RelPoint1}}, {{Vector3i|RelPoint2}}, DataTypes, BlockType, [BlockMeta], [BlockLight], [BlockSkyLight]", Return = "", Notes = "Draws a line between the two specified points. Sets only datatypes specified by DataTypes (baXXX constants)." },
- { Params = "RelX1, RelY1, RelZ1, RelX2, RelY2, RelZ2, DataTypes, BlockType, [BlockMeta], [BlockLight], [BlockSkyLight]", Return = "", Notes = "Draws a line between the two specified points. Sets only datatypes specified by DataTypes (baXXX constants)." },
- },
- RotateCCW = { Params = "", Return = "", Notes = "Rotates the block area around the Y axis, counter-clockwise (east -> north). Modifies blocks' metas (if present) to match." },
- RotateCCWNoMeta = { Params = "", Return = "", Notes = "Rotates the block area around the Y axis, counter-clockwise (east -> north). Doesn't modify blocks' metas." },
- RotateCW = { Params = "", Return = "", Notes = "Rotates the block area around the Y axis, clockwise (north -> east). Modifies blocks' metas (if present) to match." },
- RotateCWNoMeta = { Params = "", Return = "", Notes = "Rotates the block area around the Y axis, clockwise (north -> east). Doesn't modify blocks' metas." },
- SaveToSchematicFile = { Params = "FileName", Return = "", Notes = "Saves the current contents to a schematic file. Returns true if successful." },
- SaveToSchematicString = { Params = "", Return = "string", Notes = "Saves the current contents to a string (in a .schematic file format). Returns the data if successful, nil if failed." },
- SetBlockLight = { Params = "BlockX, BlockY, BlockZ, BlockLight", Return = "", Notes = "Sets the blocklight at the specified absolute coords" },
- SetBlockMeta = { Params = "BlockX, BlockY, BlockZ, BlockMeta", Return = "", Notes = "Sets the block meta at the specified absolute coords" },
- SetBlockSkyLight = { Params = "BlockX, BlockY, BlockZ, SkyLight", Return = "", Notes = "Sets the skylight at the specified absolute coords" },
- SetBlockType = { Params = "BlockX, BlockY, BlockZ, BlockType", Return = "", Notes = "Sets the block type at the specified absolute coords" },
- SetBlockTypeMeta = { Params = "BlockX, BlockY, BlockZ, BlockType, BlockMeta", Return = "", Notes = "Sets the block type and meta at the specified absolute coords" },
- SetOrigin =
- {
- { Params = "{{Vector3i|Origin}}", Return = "", Notes = "Resets the origin for the absolute coords. Only affects how absolute coords are translated into relative coords." },
- { Params = "OriginX, OriginY, OriginZ", Return = "", Notes = "Resets the origin for the absolute coords. Only affects how absolute coords are translated into relative coords." },
- },
- SetRelBlockLight = { Params = "RelBlockX, RelBlockY, RelBlockZ, BlockLight", Return = "", Notes = "Sets the blocklight at the specified relative coords" },
- SetRelBlockMeta = { Params = "RelBlockX, RelBlockY, RelBlockZ, BlockMeta", Return = "", Notes = "Sets the block meta at the specified relative coords" },
- SetRelBlockSkyLight = { Params = "RelBlockX, RelBlockY, RelBlockZ, SkyLight", Return = "", Notes = "Sets the skylight at the specified relative coords" },
- SetRelBlockType = { Params = "RelBlockX, RelBlockY, RelBlockZ, BlockType", Return = "", Notes = "Sets the block type at the specified relative coords" },
- SetRelBlockTypeMeta = { Params = "RelBlockX, RelBlockY, RelBlockZ, BlockType, BlockMeta", Return = "", Notes = "Sets the block type and meta at the specified relative coords" },
- SetWEOffset =
- {
- { Params = "{{Vector3i|Offset}}", Return = "", Notes = "Sets the WE offset, a data value sometimes stored in the schematic files. Mostly used for WorldEdit. Cuberite doesn't use this value, but provides access to it using this method." },
- { Params = "OffsetX, OffsetY, OffsetZ", Return = "", Notes = "Sets the WE offset, a data value sometimes stored in the schematic files. Mostly used for WorldEdit. Cuberite doesn't use this value, but provides access to it using this method." },
- },
- Write =
- {
- { Params = "World, {{Vector3i|MinPoint}}, DataTypes", Return = "bool", Notes = "Writes the area into World at the specified coords, returns true if successful" },
- { Params = "World, MinX, MinY, MinZ, DataTypes", Return = "bool", Notes = "Writes the area into World at the specified coords, returns true if successful" },
- },
- },
- Constants =
- {
- baTypes = { Notes = "Operation should work on block types" },
- baMetas = { Notes = "Operations should work on block metas" },
- baLight = { Notes = "Operations should work on block (emissive) light" },
- baSkyLight = { Notes = "Operations should work on skylight" },
- msDifference = { Notes = "Block becomes air if 'self' and src are the same. Otherwise it becomes the src block." },
- msFillAir = { Notes = "'self' is overwritten by Src only where 'self' has air blocks" },
- msImprint = { Notes = "Src overwrites 'self' anywhere where 'self' has non-air blocks" },
- msLake = { Notes = "Special mode for merging lake images" },
- msMask = { Notes = "The blocks that are exactly the same are kept in 'self', all differing blocks are replaced by air"},
- msOverwrite = { Notes = "Src overwrites anything in 'self'" },
- msSimpleCompare = { Notes = "The blocks that are exactly the same are replaced with air, all differing blocks are replaced by stone"},
- msSpongePrint = { Notes = "Similar to msImprint, sponge block doesn't overwrite anything, all other blocks overwrite everything"},
- },
- ConstantGroups =
- {
- BATypes =
- {
- Include = "ba.*",
- TextBefore = [[
- The following constants are used to signalize the datatype to read or write:
- ]],
- },
- MergeStrategies =
- {
- Include = "ms.*",
- TextBefore = [[
- The Merge() function can use different strategies to combine the source and destination blocks.
- The following constants are used:
- ]],
- TextAfter = "See below for a detailed explanation of the individual merge strategies.",
- },
- },
- AdditionalInfo =
- {
- {
- Header = "Merge strategies",
- Contents =
- [[
- <p>The strategy parameter specifies how individual blocks are combined together, using the table below.
- </p>
- <table class="inline">
- <tbody><tr>
- <th colspan="2">area block</th><th colspan="3">result</th>
- </tr>
- <tr>
- <th> this </th><th> Src </th><th> msOverwrite </th><th> msFillAir </th><th> msImprint </th>
- </tr>
- <tr>
- <td> air </td><td> air </td><td> air </td><td> air </td><td> air </td>
- </tr>
- <tr>
- <td> A </td><td> air </td><td> air </td><td> A </td><td> A </td>
- </tr>
- <tr>
- <td> air </td><td> B </td><td> B </td><td> B </td><td> B </td>
- </tr>
- <tr>
- <td> A </td><td> B </td><td> B </td><td> A </td><td> B </td>
- </tr>
- <tr>
- <td> A </td><td> A </td><td> A </td><td> A </td><td> A </td>
- </td>
- </tbody></table>
-
- <p>
- So to sum up:
- <ol>
- <li class="level1">msOverwrite completely overwrites all blocks with the Src's blocks</li>
- <li class="level1">msFillAir overwrites only those blocks that were air</li>
- <li class="level1">msImprint overwrites with only those blocks that are non-air</li>
- </ol>
- </p>
-
- <h3>Special strategies</h3>
- <p>For each strategy, evaluate the table rows from top downwards, the first match wins.</p>
-
- <p>
- <strong>msDifference</strong> - changes all the blocks which are the same to air. Otherwise the source block gets placed.
- </p>
- <table><tbody<tr>
- <th colspan="2"> area block </th><th> </th><th> Notes </th>
- </tr><tr>
- <td> * </td><td> B </td><td> B </td><td> The blocks are different so we use block B </td>
- </tr><tr>
- <td> B </td><td> B </td><td> Air </td><td> The blocks are the same so we get air. </td>
- </tr>
- </tbody></table>
-
-
- <p>
- <strong>msLake</strong> - used for merging areas with lava and water lakes, in the appropriate generator.
- </p>
- <table><tbody><tr>
- <th colspan="2"> area block </th><th> </th><th> Notes </th>
- </tr><tr>
- <th> self </th><th> Src </th><th> result </th><th> </th>
- </tr><tr>
- <td> A </td><td> sponge </td><td> A </td><td> Sponge is the NOP block </td>
- </tr><tr>
- <td> * </td><td> air </td><td> air </td><td> Air always gets hollowed out, even under the oceans </td>
- </tr><tr>
- <td> water </td><td> * </td><td> water </td><td> Water is never overwritten </td>
- </tr><tr>
- <td> lava </td><td> * </td><td> lava </td><td> Lava is never overwritten </td>
- </tr><tr>
- <td> * </td><td> water </td><td> water </td><td> Water always overwrites anything </td>
- </tr><tr>
- <td> * </td><td> lava </td><td> lava </td><td> Lava always overwrites anything </td>
- </tr><tr>
- <td> dirt </td><td> stone </td><td> stone </td><td> Stone overwrites dirt </td>
- </tr><tr>
- <td> grass </td><td> stone </td><td> stone </td><td> ... and grass </td>
- </tr><tr>
- <td> mycelium </td><td> stone </td><td> stone </td><td> ... and mycelium </td>
- </tr><tr>
- <td> A </td><td> stone </td><td> A </td><td> ... but nothing else </td>
- </tr><tr>
- <td> A </td><td> * </td><td> A </td><td> Everything else is left as it is </td>
- </tr>
- </tbody></table>
-
- <p>
- <strong>msSpongePrint</strong> - used for most prefab-generators to merge the prefabs. Similar to
- msImprint, but uses the sponge block as the NOP block instead, so that the prefabs may carve out air
- pockets, too.
- </p>
- <table><tbody><tr>
- <th colspan="2"> area block </th><th> </th><th> Notes </th>
- </tr><tr>
- <th> self </th><th> Src </th><th> result </th><th> </th>
- </tr><tr>
- <td> A </td><td> sponge </td><td> A </td><td> Sponge is the NOP block </td>
- </tr><tr>
- <td> * </td><td> B </td><td> B </td><td> Everything else overwrites anything </td>
- </tr>
- </tbody></table>
-
- <p>
- <strong>msMask</strong> - the blocks that are the same in the other area are kept, all the
- differing blocks are replaced with air. Meta is used in the comparison, too, two blocks of the
- same type but different meta are considered different and thus replaced with air.
- </p>
- <table><tbody><tr>
- <th colspan="2"> area block </th><th> </th><th> Notes </th>
- </tr><tr>
- <th> self </th><th> Src </th><th> result </th><th> </th>
- </tr><tr>
- <td> A </td><td> A </td><td> A </td><td> Same blocks are kept </td>
- </tr><tr>
- <td> A </td><td> non-A </td><td> air </td><td> Differing blocks are replaced with air </td>
- </tr>
- </tbody></table>
-
- <p>
- <strong>msDifference</strong> - the blocks that are the same in both areas are replaced with air, all the
- differing blocks are kept from the first area. Meta is used in the comparison, too, two blocks of the
- same type but different meta are considered different.
- </p>
- <table><tbody><tr>
- <th colspan="2"> area block </th><th> </th><th> Notes </th>
- </tr><tr>
- <th> self </th><th> Src </th><th> result </th><th> </th>
- </tr><tr>
- <td> A </td><td> A </td><td> air </td><td> Same blocks are replaced with air </td>
- </tr><tr>
- <td> A </td><td> non-A </td><td> A </td><td> Differing blocks are kept from 'self' </td>
- </tr>
- </tbody></table>
-
- <p>
- <strong>msSimpleCompare</strong> - the blocks that are the same in both areas are replaced with air, all the
- differing blocks are replaced with stone. Meta is used in the comparison, too, two blocks of the
- same type but different meta are considered different.
- </p>
- <table><tbody><tr>
- <th colspan="2"> area block </th><th> </th><th> Notes </th>
- </tr><tr>
- <th> self </th><th> Src </th><th> result </th><th> </th>
- </tr><tr>
- <td> A </td><td> A </td><td> air </td><td> Same blocks are replaced with air </td>
- </tr><tr>
- <td> A </td><td> non-A </td><td> stone </td><td> Differing blocks are replaced with stone </td>
- </tr>
- </tbody></table>
-]],
- }, -- Merge strategies
- }, -- AdditionalInfo
- }, -- cBlockArea
-
- cBlockInfo =
- {
- Desc = [[
- This class is used to query and register block properties.
- ]],
- Functions =
- {
- CanBeTerraformed = { Params = "Type", Return = "bool", Notes = "(STATIC) Returns true if the block is suitable to be changed by a generator" },
- FullyOccupiesVoxel = { Params = "Type", Return = "bool", Notes = "(STATIC) Returns whether the specified block fully occupies its voxel." },
- Get = { Params = "Type", Return = "{{cBlockInfo}}", Notes = "(STATIC) Returns the {{cBlockInfo}} structure for the specified type." },
- GetLightValue = { Params = "Type", Return = "number", Notes = "(STATIC) Returns how much light the specified block emits on its own." },
- GetPlaceSound = { Params = "Type", Return = "", Notes = "(STATIC) Returns the name of the sound that is played when placing the block." },
- GetSpreadLightFalloff = { Params = "Type", Return = "number", Notes = "(STATIC) Returns how much light the specified block consumes." },
- IsOneHitDig = { Params = "Type", Return = "bool", Notes = "(STATIC) Returns whether the specified block will be destroyed after a single hit." },
- IsPistonBreakable = { Params = "Type", Return = "bool", Notes = "(STATIC) Returns whether a piston can break the specified block." },
- IsSnowable = { Params = "Type", Return = "bool", Notes = "(STATIC) Returns whether the specified block can hold snow atop." },
- IsSolid = { Params = "Type", Return = "bool", Notes = "(STATIC) Returns whether the specified block is solid." },
- IsTransparent = { Params = "Type", Return = "bool", Notes = "(STATIC) Returns whether the specified block is transparent." },
- RequiresSpecialTool = { Params = "Type", Return = "bool", Notes = "(STATIC) Returns whether the specified block requires a special tool to drop." },
- },
- Variables =
- {
- m_CanBeTerraformed = { Type = "bool", Notes = "Is this block suited to be terraformed?" },
- m_FullyOccupiesVoxel = { Type = "bool", Notes = "Does this block fully occupy its voxel - is it a 'full' block?" },
- m_IsSnowable = { Type = "bool", Notes = "Can this block hold snow atop?" },
- m_IsSolid = { Type = "bool", Notes = "Is this block solid (player cannot walk through)?" },
- m_LightValue = { Type = "number", Notes = "How much light do the blocks emit on their own?" },
- m_OneHitDig = { Type = "bool", Notes = "Is a block destroyed after a single hit?" },
- m_PistonBreakable = { Type = "bool", Notes = "Can a piston break this block?" },
- m_PlaceSound = { Type = "string", Notes = "The name of the sound that is placed when a block is placed." },
- m_RequiresSpecialTool = { Type = "bool", Notes = "Does this block require a tool to drop?" },
- m_SpreadLightFalloff = { Type = "number", Notes = "How much light do the blocks consume?" },
- m_Transparent = { Type = "bool", Notes = "Is a block completely transparent? (light doesn't get decreased(?))" },
- },
- }, -- cBlockInfo
-
- cChatColor =
- {
- Desc = [[
- A wrapper class for constants representing colors or effects.
- ]],
-
- Functions = {},
- Constants =
- {
- Black = { Notes = "" },
- Blue = { Notes = "" },
- Bold = { Notes = "" },
- Color = { Notes = "The first character of the color-code-sequence, �" },
- DarkPurple = { Notes = "" },
- Delimiter = { Notes = "The first character of the color-code-sequence, �" },
- Gold = { Notes = "" },
- Gray = { Notes = "" },
- Green = { Notes = "" },
- Italic = { Notes = "" },
- LightBlue = { Notes = "" },
- LightGray = { Notes = "" },
- LightGreen = { Notes = "" },
- LightPurple = { Notes = "" },
- Navy = { Notes = "" },
- Plain = { Notes = "Resets all formatting to normal" },
- Purple = { Notes = "" },
- Random = { Notes = "Random letters and symbols animate instead of the text" },
- Red = { Notes = "" },
- Rose = { Notes = "" },
- Strikethrough = { Notes = "" },
- Underlined = { Notes = "" },
- White = { Notes = "" },
- Yellow = { Notes = "" },
- },
- },
-
- cChunkDesc =
- {
- Desc = [[
- The cChunkDesc class is a container for chunk data while the chunk is being generated. As such, it is
- only used as a parameter for the {{OnChunkGenerating|OnChunkGenerating}} and
- {{OnChunkGenerated|OnChunkGenerated}} hooks and cannot be constructed on its own. Plugins can use this
- class in both those hooks to manipulate generated chunks.
- ]],
-
- Functions =
- {
- FillBlocks = { Params = "BlockType, BlockMeta", Return = "", Notes = "Fills the entire chunk with the specified blocks" },
- FillRelCuboid =
- {
- { Params = "{{cCuboid|RelCuboid}}, BlockType, BlockMeta", Return = "", Notes = "Fills the cuboid, specified in relative coords, by the specified block type and block meta. The cuboid may reach outside of the chunk, only the part intersecting with this chunk is filled." },
- { Params = "MinRelX, MaxRelX, MinRelY, MaxRelY, MinRelZ, MaxRelZ, BlockType, BlockMeta", Return = "", Notes = "Fills the cuboid, specified in relative coords, by the specified block type and block meta. The cuboid may reach outside of the chunk, only the part intersecting with this chunk is filled." },
- },
- FloorRelCuboid =
- {
- { Params = "{{cCuboid|RelCuboid}}, BlockType, BlockMeta", Return = "", Notes = "Fills those blocks of the cuboid (specified in relative coords) that are considered non-floor (air, water) with the specified block type and meta. Cuboid may reach outside the chunk, only the part intersecting with this chunk is filled." },
- { Params = "MinRelX, MaxRelX, MinRelY, MaxRelY, MinRelZ, MaxRelZ, BlockType, BlockMeta", Return = "", Notes = "Fills those blocks of the cuboid (specified in relative coords) that are considered non-floor (air, water) with the specified block type and meta. Cuboid may reach outside the chunk, only the part intersecting with this chunk is filled." },
- },
- GetBiome = { Params = "RelX, RelZ", Return = "EMCSBiome", Notes = "Returns the biome at the specified relative coords" },
- GetBlockEntity = { Params = "RelX, RelY, RelZ", Return = "{{cBlockEntity}} descendant", Notes = "Returns the block entity for the block at the specified coords. Creates it if it doesn't exist. Returns nil if the block has no block entity capability." },
- GetBlockMeta = { Params = "RelX, RelY, RelZ", Return = "NIBBLETYPE", Notes = "Returns the block meta at the specified relative coords" },
- GetBlockType = { Params = "RelX, RelY, RelZ", Return = "BLOCKTYPE", Notes = "Returns the block type at the specified relative coords" },
- GetBlockTypeMeta = { Params = "RelX, RelY, RelZ", Return = "BLOCKTYPE, NIBBLETYPE", Notes = "Returns the block type and meta at the specified relative coords" },
- GetChunkX = { Params = "", Return = "number", Notes = "Returns the X coord of the chunk contained." },
- GetChunkZ = { Params = "", Return = "number", Notes = "Returns the Z coord of the chunk contained." },
- GetHeight = { Params = "RelX, RelZ", Return = "number", Notes = "Returns the height at the specified relative coords" },
- GetMaxHeight = { Params = "", Return = "number", Notes = "Returns the maximum height contained in the heightmap." },
- GetMinHeight = { Params = "", Return = "number", Notes = "Returns the minimum height value in the heightmap." },
- IsUsingDefaultBiomes = { Params = "", Return = "bool", Notes = "Returns true if the chunk is set to use default biome generator" },
- IsUsingDefaultComposition = { Params = "", Return = "bool", Notes = "Returns true if the chunk is set to use default composition generator" },
- IsUsingDefaultFinish = { Params = "", Return = "bool", Notes = "Returns true if the chunk is set to use default finishers" },
- IsUsingDefaultHeight = { Params = "", Return = "bool", Notes = "Returns true if the chunk is set to use default height generator" },
- IsUsingDefaultStructures = { Params = "", Return = "bool", Notes = "Returns true if the chunk is set to use default structures" },
- RandomFillRelCuboid =
- {
- { Params = "{{cCuboid|RelCuboid}}, BlockType, BlockMeta, RandomSeed, ChanceOutOf10k", Return = "", Notes = "Fills the specified relative cuboid with block type and meta in random locations. RandomSeed is used for the random number genertion (same seed produces same results); ChanceOutOf10k specifies the density (how many out of every 10000 blocks should be filled). Cuboid may reach outside the chunk, only the part intersecting with this chunk is filled." },
- { Params = "MinRelX, MaxRelX, MinRelY, MaxRelY, MinRelZ, MaxRelZ, BlockType, BlockMeta, RandomSeed, ChanceOutOf10k", Return = "", Notes = "Fills the specified relative cuboid with block type and meta in random locations. RandomSeed is used for the random number genertion (same seed produces same results); ChanceOutOf10k specifies the density (how many out of every 10000 blocks should be filled). Cuboid may reach outside the chunk, only the part intersecting with this chunk is filled." },
- },
- ReadBlockArea = { Params = "{{cBlockArea|BlockArea}}, MinRelX, MaxRelX, MinRelY, MaxRelY, MinRelZ, MaxRelZ", Return = "", Notes = "Reads data from the chunk into the block area object. Block types and metas are processed." },
- ReplaceRelCuboid =
- {
- { Params = "{{cCuboid|RelCuboid}}, SrcType, SrcMeta, DstType, DstMeta", Return = "", Notes = "Replaces all SrcType+SrcMeta blocks in the cuboid (specified in relative coords) with DstType+DstMeta blocks. Cuboid may reach outside the chunk, only the part intersecting with this chunk is filled." },
- { Params = "MinRelX, MaxRelX, MinRelY, MaxRelY, MinRelZ, MaxRelZ, SrcType, SrcMeta, DstType, DstMeta", Return = "", Notes = "Replaces all SrcType+SrcMeta blocks in the cuboid (specified in relative coords) with DstType+DstMeta blocks. Cuboid may reach outside the chunk, only the part intersecting with this chunk is filled." },
- },
- SetBiome = { Params = "RelX, RelZ, EMCSBiome", Return = "", Notes = "Sets the biome at the specified relative coords" },
- SetBlockMeta = { Params = "RelX, RelY, RelZ, BlockMeta", Return = "", Notes = "Sets the block meta at the specified relative coords" },
- SetBlockType = { Params = "RelX, RelY, RelZ, BlockType", Return = "", Notes = "Sets the block type at the specified relative coords" },
- SetBlockTypeMeta = { Params = "RelX, RelY, RelZ, BlockType, BlockMeta", Return = "", Notes = "Sets the block type and meta at the specified relative coords" },
- SetHeight = { Params = "RelX, RelZ, Height", Return = "", Notes = "Sets the height at the specified relative coords" },
- SetUseDefaultBiomes = { Params = "bool", Return = "", Notes = "Sets the chunk to use default biome generator or not" },
- SetUseDefaultComposition = { Params = "bool", Return = "", Notes = "Sets the chunk to use default composition generator or not" },
- SetUseDefaultFinish = { Params = "bool", Return = "", Notes = "Sets the chunk to use default finishers or not" },
- SetUseDefaultHeight = { Params = "bool", Return = "", Notes = "Sets the chunk to use default height generator or not" },
- SetUseDefaultStructures = { Params = "bool", Return = "", Notes = "Sets the chunk to use default structures or not" },
- UpdateHeightmap = { Params = "", Return = "", Notes = "Updates the heightmap to match current contents. The plugins should do that if they modify the contents and don't modify the heightmap accordingly; Cuberite expects (and checks in Debug mode) that the heightmap matches the contents when the cChunkDesc is returned from a plugin." },
- WriteBlockArea = { Params = "{{cBlockArea|BlockArea}}, MinRelX, MinRelY, MinRelZ", Return = "", Notes = "Writes data from the block area into the chunk" },
- },
- AdditionalInfo =
- {
- {
- Header = "Manipulating block entities",
- Contents = [[
- To manipulate block entities while the chunk is generated, first use SetBlockTypeMeta() to set
- the correct block type and meta at the position. Then use the GetBlockEntity() to create and
- return the correct block entity instance. Finally, use {{tolua}}.cast() to cast to the proper
- type.</p>
- Note that you don't need to check if a block entity has previously existed at the place, because
- GetBlockEntity() will automatically re-create the correct type for you.</p>
- <p>
- The following code is taken from the Debuggers plugin, it creates a sign at each chunk's [0, 0]
- coords, with the text being the chunk coords:
-<pre class="prettyprint lang-lua">
-function OnChunkGenerated(a_World, a_ChunkX, a_ChunkZ, a_ChunkDesc)
- -- Get the topmost block coord:
- local Height = a_ChunkDesc:GetHeight(0, 0);
-
- -- Create a sign there:
- a_ChunkDesc:SetBlockTypeMeta(0, Height + 1, 0, E_BLOCK_SIGN_POST, 0);
- local BlockEntity = a_ChunkDesc:GetBlockEntity(0, Height + 1, 0);
- if (BlockEntity ~= nil) then
- LOG("Setting sign lines...");
- local SignEntity = tolua.cast(BlockEntity, "cSignEntity");
- SignEntity:SetLines("Chunk:", tonumber(a_ChunkX) .. ", " .. tonumber(a_ChunkZ), "", "(Debuggers)");
- end
-
- -- Update the heightmap:
- a_ChunkDesc:SetHeight(0, 0, Height + 1);
-end
-</pre>
- ]],
- },
- }, -- AdditionalInfo
- }, -- cChunkDesc
-
- cClientHandle =
- {
- Desc = [[
- A cClientHandle represents the technical aspect of a connected player - their game client
- connection. Internally, it handles all the incoming and outgoing packets, the chunks that are to be
- sent to the client, ping times etc.
- ]],
-
- Functions =
- {
- GenerateOfflineUUID = { Params = "Username", Return = "string", Notes = "(STATIC) Generates an UUID based on the player name provided. This is used for the offline (non-auth) mode, when there's no UUID source. Each username generates a unique and constant UUID, so that when the player reconnects with the same name, their UUID is the same. Returns a 32-char UUID (no dashes)." },
- GetClientBrand = { Params = "", Return = "string", Notes = "Returns the brand that the client has sent in their MC|Brand plugin message." },
- GetIPString = { Params = "", Return = "string", Notes = "Returns the IP address of the connection, as a string. Only the address part is returned, without the port number." },
- GetLocale = { Params = "", Return = "Locale", Notes = "Returns the locale string that the client sends as part of the protocol handshake. Can be used to provide localized strings." },
- GetPing = { Params = "", Return = "number", Notes = "Returns the ping time, in ms" },
- GetPlayer = { Params = "", Return = "{{cPlayer|cPlayer}}", Notes = "Returns the player object connected to this client. Note that this may be nil, for example if the player object is not yet spawned." },
- GetProtocolVersion = { Params = "", Return = "number", Notes = "Returns the protocol version number of the protocol that the client is talking. Returns zero if the protocol version is not (yet) known." },
- GetUniqueID = { Params = "", Return = "number", Notes = "Returns the UniqueID of the client used to identify the client in the server" },
- GetUUID = { Params = "", Return = "string", Notes = "Returns the authentication-based UUID of the client. This UUID should be used to identify the player when persisting any player-related data. Returns a 32-char UUID (no dashes)" },
- GetUsername = { Params = "", Return = "string", Notes = "Returns the username that the client has provided" },
- GetViewDistance = { Params = "", Return = "number", Notes = "Returns the viewdistance (number of chunks loaded for the player in each direction)" },
- GetRequestedViewDistance = { Params = "", Return = "number", Notes = "Returns the view distance that the player request, not the used view distance." },
- HasPluginChannel = { Params = "ChannelName", Return = "bool", Notes = "Returns true if the client has registered to receive messages on the specified plugin channel." },
- IsUUIDOnline = { Params = "UUID", Return = "bool", Notes = "(STATIC) Returns true if the UUID is generated by online auth, false if it is an offline-generated UUID. We use Version-3 UUIDs for offline UUIDs, online UUIDs are Version-4, thus we can tell them apart. Accepts both 32-char and 36-char UUIDs (with and without dashes). If the string given is not a valid UUID, returns false."},
- Kick = { Params = "Reason", Return = "", Notes = "Kicks the user with the specified reason" },
- SendPluginMessage = { Params = "Channel, Message", Return = "", Notes = "Sends the plugin message on the specified channel." },
- SetClientBrand = { Params = "ClientBrand", Return = "", Notes = "Sets the value of the client's brand. Normally this value is received from the client by a MC|Brand plugin message, this function lets plugins overwrite the value." },
- SetLocale = { Params = "Locale", Return = "", Notes = "Sets the locale that Cuberite keeps on record. Initially the locale is initialized in protocol handshake, this function allows plugins to override the stored value (but only server-side and only until the user disconnects)." },
- SetUsername = { Params = "Name", Return = "", Notes = "Sets the username" },
- SetViewDistance = { Params = "ViewDistance", Return = "", Notes = "Sets the viewdistance (number of chunks loaded for the player in each direction)" },
- SendBlockChange = { Params = "BlockX, BlockY, BlockZ, BlockType, BlockMeta", Return = "", Notes = "Sends a BlockChange packet to the client. This can be used to create fake blocks only for that player." },
- SendEntityAnimation = { Params = "{{cEntity|Entity}}, AnimationNumber", Return = "", Notes = "Sends the specified animation of the specified entity to the client. The AnimationNumber is protocol-specific." },
- SendSoundEffect = { Params = "SoundName, X, Y, Z, Volume, Pitch", Return = "", Notes = "Sends a sound effect request to the client. The sound is played at the specified coords, with the specified volume (a float, 1.0 is full volume, can be more) and pitch (0-255, 63 is 100%)" },
- SendTimeUpdate = { Params = "WorldAge, TimeOfDay, DoDaylightCycle", Return = "", Notes = "Sends the specified time update to the client. WorldAge is the total age of the world, in ticks. TimeOfDay is the current day's time, in ticks (0 - 24000). DoDaylightCycle is a bool that specifies whether the client should automatically move the sun (true) or keep it in the same place (false)." },
- },
- Constants =
- {
- MAX_VIEW_DISTANCE = { Notes = "The maximum value of the view distance" },
- MIN_VIEW_DISTANCE = { Notes = "The minimum value of the view distance" },
- },
- }, -- cClientHandle
-
- cCompositeChat =
- {
- Desc = [[
- Encapsulates a chat message that can contain various formatting, URLs, commands executed on click
- and commands suggested on click. The chat message can be sent by the regular chat-sending functions,
- {{cPlayer}}:SendMessage(), {{cWorld}}:BroadcastChat() and {{cRoot}}:BroadcastChat().</p>
- <p>
- Note that most of the functions in this class are so-called chaining modifiers - they modify the
- object and then return the object itself, so that they can be chained one after another. See the
- Chaining example below for details.</p>
- <p>
- Each part of the composite chat message takes a "Style" parameter, this is a string that describes
- the formatting. It uses the following strings, concatenated together:
- <table>
- <tr><th>String</th><th>Style</th></tr>
- <tr><td>b</td><td>Bold text</td></tr>
- <tr><td>i</td><td>Italic text</td></tr>
- <tr><td>u</td><td>Underlined text</td></tr>
- <tr><td>s</td><td>Strikethrough text</td></tr>
- <tr><td>o</td><td>Obfuscated text</td></tr>
- <tr><td>@X</td><td>color X (X is 0 - 9 or a - f, same as dye meta</td></tr>
- </table>
- The following picture, taken from MineCraft Wiki, illustrates the color codes:</p>
- <img src="http://hydra-media.cursecdn.com/minecraft.gamepedia.com/4/4c/Colors.png?version=34a0f56789a95326e1f7d82047b12232" />
- ]],
- Functions =
- {
- constructor =
- {
- { Params = "", Return = "", Notes = "Creates an empty chat message" },
- { Params = "Text", Return = "", Notes = "Creates a chat message containing the specified text, parsed by the ParseText() function. This allows easy migration from old chat messages." },
- },
- AddRunCommandPart = { Params = "Text, Command, [Style]", Return = "self", Notes = "Adds a text which, when clicked, runs the specified command. Chaining." },
- AddShowAchievementPart = { Params = "PlayerName, AchievementName, [Style]", Return = "", Notes = "Adds a text that represents the 'Achievement get' message." },
- AddSuggestCommandPart = { Params = "Text, Command, [Style]", Return = "self", Notes = "Adds a text which, when clicked, puts the specified command into the player's chat input area. Chaining." },
- AddTextPart = { Params = "Text, [Style]", Return = "self", Notes = "Adds a regular text. Chaining." },
- AddUrlPart = { Params = "Text, Url, [Style]", Return = "self", Notes = "Adds a text which, when clicked, opens up a browser at the specified URL. Chaining." },
- Clear = { Params = "", Return = "", Notes = "Removes all parts from this object" },
- CreateJsonString = { Params = "[AddPrefixes]", Return = "string", Notes = "Returns the entire object serialized into JSON, as it would be sent to a client. AddPrefixes specifies whether the chat prefixes should be prepended to the message, true by default." },
- ExtractText = { Params = "", Return = "string", Notes = "Returns the text from the parts that comprises the human-readable data. Used for older protocols that don't support composite chat and for console-logging." },
- GetAdditionalMessageTypeData = { Params = "", Return = "string", Notes = "Returns the AdditionalData associated with the message, such as the sender's name for mtPrivateMessage" },
- GetMessageType = { Params = "", Return = "MessageType", Notes = "Returns the MessageType (mtXXX constant) that is associated with this message. When sent to a player, the message will be formatted according to this message type and the player's settings (adding \"[INFO]\" prefix etc.)" },
- ParseText = { Params = "Text", Return = "self", Notes = "Adds text, while recognizing http and https URLs and old-style formatting codes (\"@2\"). Chaining." },
- SetMessageType = { Params = "MessageType, AdditionalData", Return = "self", Notes = "Sets the MessageType (mtXXX constant) that is associated with this message. Also sets the additional data (string) associated with the message, which is specific for the message type - such as the sender's name for mtPrivateMessage. When sent to a player, the message will be formatted according to this message type and the player's settings (adding \"[INFO]\" prefix etc.). Chaining." },
- UnderlineUrls = { Params = "", Return = "self", Notes = "Makes all URL parts contained in the message underlined. Doesn't affect parts added in the future. Chaining." },
- },
-
- AdditionalInfo =
- {
- {
- Header = "Chaining example",
- Contents = [[
- Sending a chat message that is composed of multiple different parts has been made easy thanks to
- chaining. Consider the following example that shows how a message containing all kinds of parts
- is sent (adapted from the Debuggers plugin):
-<pre class="prettyprint lang-lua">
-function OnPlayerJoined(a_Player)
- -- Send an example composite chat message to the player:
- a_Player:SendMessage(cCompositeChat()
- :AddTextPart("Hello, ")
- :AddUrlPart(a_Player:GetName(), "http://www.mc-server.org", "u@2") -- Colored underlined link
- :AddSuggestCommandPart(", and welcome.", "/help", "u") -- Underlined suggest-command
- :AddRunCommandPart(" SetDay", "/time set 0") -- Regular text that will execute command when clicked
- :SetMessageType(mtJoin) -- It is a join-message
- )
-end</pre>
- ]],
- },
- }, -- AdditionalInfo
- }, -- cCompositeChat
-
- cCraftingGrid =
- {
- Desc = [[
- cCraftingGrid represents the player's crafting grid. It is used in
- {{OnCraftingNoRecipe|OnCraftingNoRecipe}}, {{OnPostCrafting|OnPostCrafting}} and
- {{OnPreCrafting|OnPreCrafting}} hooks. Plugins may use it to inspect the items the player placed
- on their crafting grid.</p>
- <p>
- Also, an object of this type is used in {{cCraftingRecipe}}'s ConsumeIngredients() function for
- specifying the exact number of ingredients to consume in that recipe; plugins may use this to
- apply the crafting recipe.</p>
- ]],
-
- Functions =
- {
- constructor = { Params = "Width, Height", Return = "cCraftingGrid", Notes = "Creates a new CraftingGrid object. This new crafting grid is not related to any player, but may be needed for {{cCraftingRecipe}}'s ConsumeIngredients function." },
- Clear = { Params = "", Return = "", Notes = "Clears the entire grid" },
- ConsumeGrid = { Params = "{{cCraftingGrid|CraftingGrid}}", Return = "", Notes = "Consumes items specified in CraftingGrid from the current contents. Used internally by {{cCraftingRecipe}}'s ConsumeIngredients() function, but available to plugins, too." },
- Dump = { Params = "", Return = "", Notes = "DEBUG build: Dumps the contents of the grid to the log. RELEASE build: no action" },
- GetHeight = { Params = "", Return = "number", Notes = "Returns the height of the grid" },
- GetItem = { Params = "x, y", Return = "{{cItem|cItem}}", Notes = "Returns the item at the specified coords" },
- GetWidth = { Params = "", Return = "number", Notes = "Returns the width of the grid" },
- SetItem =
- {
- { Params = "x, y, {{cItem|cItem}}", Return = "", Notes = "Sets the item at the specified coords" },
- { Params = "x, y, ItemType, ItemCount, ItemDamage", Return = "", Notes = "Sets the item at the specified coords" },
- },
- },
- }, -- cCraftingGrid
-
- cCraftingRecipe =
- {
- Desc = [[
- This class is used to represent a crafting recipe, either a built-in one, or one created dynamically in a plugin. It is used only as a parameter for {{OnCraftingNoRecipe|OnCraftingNoRecipe}}, {{OnPostCrafting|OnPostCrafting}} and {{OnPreCrafting|OnPreCrafting}} hooks. Plugins may use it to inspect or modify a crafting recipe that a player views in their crafting window, either at a crafting table or the survival inventory screen.
-</p>
- <p>Internally, the class contains a {{cCraftingGrid}} for the ingredients and a {{cItem}} for the result.
-]],
- Functions =
- {
- Clear = { Params = "", Return = "", Notes = "Clears the entire recipe, both ingredients and results" },
- ConsumeIngredients = { Params = "CraftingGrid", Return = "", Notes = "Consumes ingredients specified in the given {{cCraftingGrid|cCraftingGrid}} class" },
- Dump = { Params = "", Return = "", Notes = "DEBUG build: dumps ingredients and result into server log. RELEASE build: no action" },
- GetIngredient = { Params = "x, y", Return = "{{cItem|cItem}}", Notes = "Returns the ingredient stored in the recipe at the specified coords" },
- GetIngredientsHeight = { Params = "", Return = "number", Notes = "Returns the height of the ingredients' grid" },
- GetIngredientsWidth = { Params = "", Return = "number", Notes = "Returns the width of the ingredients' grid" },
- GetResult = { Params = "", Return = "{{cItem|cItem}}", Notes = "Returns the result of the recipe" },
- SetIngredient =
- {
- { Params = "x, y, {{cItem|cItem}}", Return = "", Notes = "Sets the ingredient at the specified coords" },
- { Params = "x, y, ItemType, ItemCount, ItemDamage", Return = "", Notes = "Sets the ingredient at the specified coords" },
- },
- SetResult =
- {
- { Params = "{{cItem|cItem}}", Return = "", Notes = "Sets the result item" },
- { Params = "ItemType, ItemCount, ItemDamage", Return = "", Notes = "Sets the result item" },
- },
- },
- }, -- cCraftingRecipe
-
- cCryptoHash =
- {
- Desc =
- [[
- Provides functions for generating cryptographic hashes.</p>
- <p>
- Note that all functions in this class are static, so they should be called in the dot convention:
-<pre class="prettyprint lang-lua">
-local Hash = cCryptoHash.sha1HexString("DataToHash")
-</pre></p>
- <p>Each cryptographic hash has two variants, one returns the hash as a raw binary string, the other returns the hash as a hex-encoded string twice as long as the binary string.
- ]],
-
- Functions =
- {
- md5 = { Params = "Data", Return = "string", Notes = "(STATIC) Calculates the md5 hash of the data, returns it as a raw (binary) string of 16 characters." },
- md5HexString = { Params = "Data", Return = "string", Notes = "(STATIC) Calculates the md5 hash of the data, returns it as a hex-encoded string of 32 characters." },
- sha1 = { Params = "Data", Return = "string", Notes = "(STATIC) Calculates the sha1 hash of the data, returns it as a raw (binary) string of 20 characters." },
- sha1HexString = { Params = "Data", Return = "string", Notes = "(STATIC) Calculates the sha1 hash of the data, returns it as a hex-encoded string of 40 characters." },
- },
- }, -- cCryptoHash
-
- cEnchantments =
- {
- Desc = [[
- This class is the storage for enchantments for a single {{cItem|cItem}} object, through its
- m_Enchantments member variable. Although it is possible to create a standalone object of this class,
- it is not yet used in any API directly.</p>
- <p>
- Enchantments can be initialized either programmatically by calling the individual functions
- (SetLevel()), or by using a string description of the enchantment combination. This string
- description is in the form "id=lvl;id=lvl;...;id=lvl;", where id is either a numerical ID of the
- enchantment, or its textual representation from the table below, and lvl is the desired enchantment
- level. The class can also create its string description from its current contents; however that
- string description will only have the numerical IDs.</p>
- <p>
- See the {{cItem}} class for usage examples.
- ]],
- Functions =
- {
- constructor =
- {
- { Params = "", Return = "cEnchantments", Notes = "Creates a new empty cEnchantments object" },
- { Params = "StringSpec", Return = "cEnchantments", Notes = "Creates a new cEnchantments object filled with enchantments based on the string description" },
- },
- operator_eq = { Params = "OtherEnchantments", Return = "bool", Notes = "Returns true if this enchantments object has the same enchantments as OtherEnchantments." },
- AddFromString = { Params = "StringSpec", Return = "", Notes = "Adds the enchantments in the string description into the object. If a specified enchantment already existed, it is overwritten." },
- Clear = { Params = "", Return = "", Notes = "Removes all enchantments" },
- GetLevel = { Params = "EnchantmentNumID", Return = "number", Notes = "Returns the level of the specified enchantment stored in this object; 0 if not stored" },
- IsEmpty = { Params = "", Return = "bool", Notes = "Returns true if the object stores no enchantments" },
- SetLevel = { Params = "EnchantmentNumID, Level", Return = "", Notes = "Sets the level for the specified enchantment, adding it if not stored before or removing it if level < = 0" },
- StringToEnchantmentID = { Params = "EnchantmentTextID", Return = "number", Notes = "(static) Returns the enchantment numerical ID, -1 if not understood. Case insensitive. Also understands plain numbers." },
- ToString = { Params = "", Return = "string", Notes = "Returns the string description of all the enchantments stored in this object, in numerical-ID form" },
- },
- Constants =
- {
- -- Only list these enchantment IDs, as they don't really need any kind of documentation:
- enchAquaAffinity = { Notes = "" },
- enchBaneOfArthropods = { Notes = "" },
- enchBlastProtection = { Notes = "" },
- enchEfficiency = { Notes = "" },
- enchFeatherFalling = { Notes = "" },
- enchFireAspect = { Notes = "" },
- enchFireProtection = { Notes = "" },
- enchFlame = { Notes = "" },
- enchFortune = { Notes = "" },
- enchInfinity = { Notes = "" },
- enchKnockback = { Notes = "" },
- enchLooting = { Notes = "" },
- enchLuckOfTheSea = { Notes = "" },
- enchLure = { Notes = "" },
- enchPower = { Notes = "" },
- enchProjectileProtection = { Notes = "" },
- enchProtection = { Notes = "" },
- enchPunch = { Notes = "" },
- enchRespiration = { Notes = "" },
- enchSharpness = { Notes = "" },
- enchSilkTouch = { Notes = "" },
- enchSmite = { Notes = "" },
- enchThorns = { Notes = "" },
- enchUnbreaking = { Notes = "" },
- },
- },
-
- cEntity =
- {
- Desc = [[
- A cEntity object represents an object in the world, it has a position and orientation. cEntity is an
- abstract class, and can not be instantiated directly, instead, all entities are implemented as
- subclasses. The cEntity class works as the common interface for the operations that all (most)
- entities support.</p>
- <p>
- All cEntity objects have an Entity Type so it can be determined what kind of entity it is
- efficiently. Entities also have a class inheritance awareness, they know their class name,
- their parent class' name and can decide if there is a class within their inheritance chain.
- Since these functions operate on strings, they are slightly slower than checking the entity type
- directly, on the other hand, they are more specific directly. To check if the entity is a spider,
- you need to call IsMob(), then cast the object to {{cMonster}} and finally compare
- {{cMonster}}:GetMonsterType() to mtSpider. GetClass(), on the other hand, returns "cSpider"
- directly.</p>
- <p>
- Note that you should not store a cEntity object between two hooks' calls, because Cuberite may
- despawn / remove that entity in between the calls. If you need to refer to an entity later, use its
- UniqueID and {{cWorld|cWorld}}'s entity manipulation functions DoWithEntityByID(), ForEachEntity()
- or ForEachEntityInChunk() to access the entity again.</p>
- ]],
- Functions =
- {
- AddPosition =
- {
- { Params = "OffsetX, OffsetY, OffsetZ", Return = "", Notes = "Moves the entity by the specified amount in each axis direction" },
- { Params = "{{Vector3d|Offset}}", Return = "", Notes = "Moves the entity by the specified amount in each direction" },
- },
- AddPosX = { Params = "OffsetX", Return = "", Notes = "Moves the entity by the specified amount in the X axis direction" },
- AddPosY = { Params = "OffsetY", Return = "", Notes = "Moves the entity by the specified amount in the Y axis direction" },
- AddPosZ = { Params = "OffsetZ", Return = "", Notes = "Moves the entity by the specified amount in the Z axis direction" },
- AddSpeed =
- {
- { Params = "AddX, AddY, AddZ", Return = "", Notes = "Adds the specified amount of speed in each axis direction." },
- { Params = "{{Vector3d|Add}}", Return = "", Notes = "Adds the specified amount of speed in each axis direction." },
- },
- AddSpeedX = { Params = "AddX", Return = "", Notes = "Adds the specified amount of speed in the X axis direction." },
- AddSpeedY = { Params = "AddY", Return = "", Notes = "Adds the specified amount of speed in the Y axis direction." },
- AddSpeedZ = { Params = "AddZ", Return = "", Notes = "Adds the specified amount of speed in the Z axis direction." },
- ArmorCoversAgainst = { Params = "{{cEntity|AttackerEntity}}, DamageType, RawDamage", Return = "number", Notes = "Returns the points out of a_RawDamage that the currently equipped armor would cover." },
- Destroy = { Params = "", Return = "", Notes = "Schedules the entity to be destroyed" },
- GetAirLevel = { Params = "", Return = "number", Notes = "Returns the air level (number of ticks of air left). Note, this function is only updated with mobs or players." },
- GetArmorCoverAgainst = { Params = "AttackerEntity, DamageType, RawDamage", Return = "number", Notes = "Returns the number of hitpoints out of RawDamage that the currently equipped armor would cover. See {{TakeDamageInfo}} for more information on attack damage." },
- GetChunkX = { Params = "", Return = "number", Notes = "Returns the X-coord of the chunk in which the entity is placed" },
- GetChunkZ = { Params = "", Return = "number", Notes = "Returns the Z-coord of the chunk in which the entity is placed" },
- GetClass = { Params = "", Return = "string", Notes = "Returns the classname of the entity, such as \"cSpider\" or \"cPickup\"" },
- GetClassStatic = { Params = "", Return = "string", Notes = "Returns the entity classname that this class implements. Each descendant overrides this function. Is static" },
- GetEntityType = { Params = "", Return = "{{cEntity#EntityType|EntityType}}", Notes = "Returns the type of the entity, one of the {{cEntity#EntityType|etXXX}} constants. Note that to check specific entity type, you should use one of the IsXXX functions instead of comparing the value returned by this call." },
- GetEquippedBoots = { Params = "", Return = "{{cItem}}", Notes = "Returns the boots that the entity has equipped. Returns an empty cItem if no boots equipped or not applicable." },
- GetEquippedChestplate = { Params = "", Return = "{{cItem}}", Notes = "Returns the chestplate that the entity has equipped. Returns an empty cItem if no chestplate equipped or not applicable." },
- GetEquippedHelmet = { Params = "", Return = "{{cItem}}", Notes = "Returns the helmet that the entity has equipped. Returns an empty cItem if no helmet equipped or not applicable." },
- GetEquippedLeggings = { Params = "", Return = "{{cItem}}", Notes = "Returns the leggings that the entity has equipped. Returns an empty cItem if no leggings equipped or not applicable." },
- GetEquippedWeapon = { Params = "", Return = "{{cItem}}", Notes = "Returns the weapon that the entity has equipped. Returns an empty cItem if no weapon equipped or not applicable." },
- GetGravity = { Params = "", Return = "number", Notes = "Returns the number that is used as the gravity for physics simulation. 1G (9.78) by default." },
- GetHeadYaw = { Params = "", Return = "number", Notes = "Returns the pitch of the entity's head (FIXME: Rename to GetHeadPitch() )." },
- GetHealth = { Params = "", Return = "number", Notes = "Returns the current health of the entity." },
- GetHeight = { Params = "", Return = "number", Notes = "Returns the height (Y size) of the entity" },
- GetInvulnerableTicks = { Params = "", Return = "number", Notes = "Returns the number of ticks that this entity will be invulnerable for. This is used for after-hit recovery - the entities are invulnerable for half a second after being hit." },
- GetKnockbackAmountAgainst = { Params = "ReceiverEntity", Return = "number", Notes = "Returns the amount of knockback that the currently equipped items would cause when attacking the ReceiverEntity." },
- GetLookVector = { Params = "", Return = "{{Vector3f}}", Notes = "Returns the vector that defines the direction in which the entity is looking" },
- GetMass = { Params = "", Return = "number", Notes = "Returns the mass of the entity. Currently unused." },
- GetMaxHealth = { Params = "", Return = "number", Notes = "Returns the maximum number of hitpoints this entity is allowed to have." },
- GetParentClass = { Params = "", Return = "string", Notes = "Returns the name of the direct parent class for this entity" },
- GetPitch = { Params = "", Return = "number", Notes = "Returns the pitch (nose-down rotation) of the entity. Measured in degrees, normal values range from -90 to +90. +90 means looking down, 0 means looking straight ahead, -90 means looking up." },
- GetPosition = { Params = "", Return = "{{Vector3d}}", Notes = "Returns the entity's pivot position as a 3D vector" },
- GetPosX = { Params = "", Return = "number", Notes = "Returns the X-coord of the entity's pivot" },
- GetPosY = { Params = "", Return = "number", Notes = "Returns the Y-coord of the entity's pivot" },
- GetPosZ = { Params = "", Return = "number", Notes = "Returns the Z-coord of the entity's pivot" },
- GetRawDamageAgainst = { Params = "ReceiverEntity", Return = "number", Notes = "Returns the raw damage that this entity's equipment would cause when attacking the ReceiverEntity. This includes this entity's weapon {{cEnchantments|enchantments}}, but excludes the receiver's armor or potion effects. See {{TakeDamageInfo}} for more information on attack damage." },
- GetRoll = { Params = "", Return = "number", Notes = "Returns the roll (sideways rotation) of the entity. Currently unused." },
- GetRot = { Params = "", Return = "{{Vector3f}}", Notes = "(OBSOLETE) Returns the entire rotation vector (Yaw, Pitch, Roll)" },
- GetSpeed = { Params = "", Return = "{{Vector3d}}", Notes = "Returns the complete speed vector of the entity" },
- GetSpeedX = { Params = "", Return = "number", Notes = "Returns the X-part of the speed vector" },
- GetSpeedY = { Params = "", Return = "number", Notes = "Returns the Y-part of the speed vector" },
- GetSpeedZ = { Params = "", Return = "number", Notes = "Returns the Z-part of the speed vector" },
- GetTicksAlive = { Params = "", Return = "number", Notes = "Returns the number of ticks that this entity has been alive for." },
- GetUniqueID = { Params = "", Return = "number", Notes = "Returns the ID that uniquely identifies the entity within the running server. Note that this ID is not persisted to the data files." },
- GetWidth = { Params = "", Return = "number", Notes = "Returns the width (X and Z size) of the entity." },
- GetWorld = { Params = "", Return = "{{cWorld}}", Notes = "Returns the world where the entity resides" },
- GetYaw = { Params = "", Return = "number", Notes = "Returns the yaw (direction) of the entity. Measured in degrees, values range from -180 to +180. 0 means ZP, 90 means XM, -180 means ZM, -90 means XP." },
- HandleSpeedFromAttachee = { Params = "ForwardAmount, SidewaysAmount", Return = "", Notes = "Updates the entity's speed based on the attachee exerting the specified force forward and sideways. Used for entities being driven by other entities attached to them - usually players driving minecarts and boats." },
- Heal = { Params = "Hitpoints", Return = "", Notes = "Heals the specified number of hitpoints. Hitpoints is expected to be a positive number." },
- IsA = { Params = "ClassName", Return = "bool", Notes = "Returns true if the entity class is a descendant of the specified class name, or the specified class itself" },
- IsBoat = { Params = "", Return = "bool", Notes = "Returns true if the entity is a {{cBoat|boat}}." },
- IsCrouched = { Params = "", Return = "bool", Notes = "Returns true if the entity is crouched. Always false for entities that don't support crouching." },
- IsDestroyed = { Params = "", Return = "bool", Notes = "Returns true if the entity has been destroyed and is awaiting removal from the internal structures." },
- IsEnderCrystal = { Params = "", Return = "bool", Notes = "Returns true if the entity is an ender crystal." },
- IsExpOrb = { Params = "", Return = "bool", Notes = "Returns true if the entity represents an experience orb" },
- IsFallingBlock = { Params = "", Return = "bool", Notes = "Returns true if the entity represents a {{cFallingBlock}} entity." },
- IsFireproof = { Params = "", Return = "bool", Notes = "Returns true if the entity takes no damage from being on fire." },
- IsFloater = { Params = "", Return = "bool", Notes = "Returns true if the entity represents a fishing rod floater" },
- IsInvisible = { Params = "", Return = "bool", Notes = "Returns true if the entity is invisible" },
- IsItemFrame = { Params = "", Return = "bool", Notes = "Returns true if the entity is an item frame." },
- IsMinecart = { Params = "", Return = "bool", Notes = "Returns true if the entity represents a {{cMinecart|minecart}}" },
- IsMob = { Params = "", Return = "bool", Notes = "Returns true if the entity represents any {{cMonster|mob}}." },
- IsOnFire = { Params = "", Return = "bool", Notes = "Returns true if the entity is on fire" },
- IsOnGround = { Params = "", Return = "bool", Notes = "Returns true if the entity is on ground (not falling, not jumping, not flying)" },
- IsPainting = { Params = "", Return = "bool", Notes = "Returns if this entity is a painting." },
- IsPawn = { Params = "", Return = "bool", Notes = "Returns true if the entity is a {{cPawn}} descendant." },
- IsPickup = { Params = "", Return = "bool", Notes = "Returns true if the entity represents a {{cPickup|pickup}}." },
- IsPlayer = { Params = "", Return = "bool", Notes = "Returns true if the entity represents a {{cPlayer|player}}" },
- IsProjectile = { Params = "", Return = "bool", Notes = "Returns true if the entity is a {{cProjectileEntity}} descendant." },
- IsRclking = { Params = "", Return = "bool", Notes = "Currently unimplemented" },
- IsRiding = { Params = "", Return = "bool", Notes = "Returns true if the entity is attached to (riding) another entity." },
- IsSprinting = { Params = "", Return = "bool", Notes = "Returns true if the entity is sprinting. Entities that cannot sprint return always false" },
- IsSubmerged = { Params = "", Return = "bool", Notes = "Returns true if the mob or player is submerged in water (head is in a water block). Note, this function is only updated with mobs or players." },
- IsSwimming = { Params = "", Return = "bool", Notes = "Returns true if the mob or player is swimming in water (feet are in a water block). Note, this function is only updated with mobs or players." },
- IsTNT = { Params = "", Return = "bool", Notes = "Returns true if the entity represents a {{cTNTEntity|TNT entity}}" },
- Killed = { Params = "{{cEntity|Victim}}", Return = "", Notes = "This entity has killed another entity (the Victim). For players, adds the scoreboard statistics about the kill." },
- KilledBy = { Notes = "FIXME: Remove this from API" },
- MoveToWorld =
- {
- { Params = "{{cWorld|World}}, [ShouldSendRespawn]", Return = "bool", Notes = "Removes the entity from this world and starts moving it to the specified world. Note that to avoid deadlocks, the move is asynchronous - the entity is moved into a queue and will be moved from that queue into the destination world at some (unpredictable) time in the future. ShouldSendRespawn is used only for players, it specifies whether the player should be sent a Repawn packet upon leaving the world (The client handles respawns only between different dimensions)." },
- { Params = "WorldName, [ShouldSendRespawn]", Return = "bool", Notes = "Removes the entity from this world and starts moving it to the specified world. Note that to avoid deadlocks, the move is asynchronous - the entity is moved into a queue and will be moved from that queue into the destination world at some (unpredictable) time in the future. ShouldSendRespawn is used only for players, it specifies whether the player should be sent a Repawn packet upon leaving the world (The client handles respawns only between different dimensions)." },
- },
- SetGravity = { Params = "Gravity", Return = "", Notes = "Sets the number that is used as the gravity for physics simulation. 1G (9.78) by default." },
- SetHeadYaw = { Params = "HeadPitch", Return = "", Notes = "Sets the head pitch (FIXME: Rename to SetHeadPitch() )." },
- SetHealth = { Params = "Hitpoints", Return = "", Notes = "Sets the entity's health to the specified amount of hitpoints. Doesn't broadcast any hurt animation. Doesn't kill the entity if health drops below zero. Use the TakeDamage() function instead for taking damage." },
- SetHeight = { Params = "", Return = "", Notes = "FIXME: Remove this from API" },
- SetInvulnerableTicks = { Params = "NumTicks", Return = "", Notes = "Sets the amount of ticks for which the entity will not receive any damage from other entities." },
- SetIsFireproof = { Params = "IsFireproof", Return = "", Notes = "Sets whether the entity receives damage from being on fire." },
- SetMass = { Params = "Mass", Return = "", Notes = "Sets the mass of the entity. Currently unused." },
- SetMaxHealth = { Params = "MaxHitpoints", Return = "", Notes = "Sets the maximum hitpoints of the entity. If current health is above MaxHitpoints, it is capped to MaxHitpoints." },
- SetPitch = { Params = "number", Return = "", Notes = "Sets the pitch (nose-down rotation) of the entity" },
- SetPitchFromSpeed = { Params = "", Return = "", Notes = "Sets the entity pitch to match its speed (entity looking forwards as it moves)" },
- SetPosition =
- {
- { Params = "PosX, PosY, PosZ", Return = "", Notes = "Sets all three coords of the entity's pivot" },
- { Params = "{{Vector3d|Vector3d}}", Return = "", Notes = "Sets all three coords of the entity's pivot" },
- },
- SetPosX = { Params = "number", Return = "", Notes = "Sets the X-coord of the entity's pivot" },
- SetPosY = { Params = "number", Return = "", Notes = "Sets the Y-coord of the entity's pivot" },
- SetPosZ = { Params = "number", Return = "", Notes = "Sets the Z-coord of the entity's pivot" },
- SetRoll = { Params = "number", Return = "", Notes = "Sets the roll (sideways rotation) of the entity. Currently unused." },
- SetRot = { Params = "{{Vector3f|Rotation}}", Return = "", Notes = "Sets the entire rotation vector (Yaw, Pitch, Roll)" },
- SetYawFromSpeed = { Params = "", Return = "", Notes = "Sets the entity's yaw to match its current speed (entity looking forwards as it moves)." },
- SetSpeed =
- {
- { Params = "SpeedX, SpeedY, SpeedZ", Return = "", Notes = "Sets the current speed of the entity" },
- { Params = "{{Vector3d|Speed}}", Return = "", Notes = "Sets the current speed of the entity" },
- },
- SetSpeedX = { Params = "SpeedX", Return = "", Notes = "Sets the X component of the entity speed" },
- SetSpeedY = { Params = "SpeedY", Return = "", Notes = "Sets the Y component of the entity speed" },
- SetSpeedZ = { Params = "SpeedZ", Return = "", Notes = "Sets the Z component of the entity speed" },
- SetWidth = { Params = "", Return = "", Notes = "FIXME: Remove this from API" },
- SetYaw = { Params = "number", Return = "", Notes = "Sets the yaw (direction) of the entity." },
- StartBurning = { Params = "NumTicks", Return = "", Notes = "Sets the entity on fire for the specified number of ticks. If entity is on fire already, makes it burn for either NumTicks or the number of ticks left from the previous fire, whichever is larger." },
- SteerVehicle = { Params = "ForwardAmount, SidewaysAmount", Return = "", Notes = "Applies the specified steering to the vehicle this entity is attached to. Ignored if not attached to any entity." },
- StopBurning = { Params = "", Return = "", Notes = "Extinguishes the entity fire, cancels all fire timers." },
- TakeDamage =
- {
- { Params = "AttackerEntity", Return = "", Notes = "Causes this entity to take damage that AttackerEntity would inflict. Includes their weapon and this entity's armor." },
- { Params = "DamageType, AttackerEntity, RawDamage, KnockbackAmount", Return = "", Notes = "Causes this entity to take damage of the specified type, from the specified attacker (may be nil). The final damage is calculated from RawDamage using the currently equipped armor." },
- { Params = "DamageType, ArrackerEntity, RawDamage, FinalDamage, KnockbackAmount", Return = "", Notes = "Causes this entity to take damage of the specified type, from the specified attacker (may be nil). The values are wrapped into a {{TakeDamageInfo}} structure and applied directly." },
- },
- TeleportToCoords = { Params = "PosX, PosY, PosZ", Return = "", Notes = "Teleports the entity to the specified coords. Asks plugins if the teleport is allowed." },
- TeleportToEntity = { Params = "DestEntity", Return = "", Notes = "Teleports this entity to the specified destination entity. Asks plugins if the teleport is allowed." },
- },
- Constants =
- {
- etBoat = { Notes = "The entity is a {{cBoat}}" },
- etEnderCrystal = { Notes = "" },
- etEntity = { Notes = "No further specialization available" },
- etExpOrb = { Notes = "The entity is a {{cExpOrb}}" },
- etFallingBlock = { Notes = "The entity is a {{cFallingBlock}}" },
- etFloater = { Notes = "The entity is a fishing rod floater" },
- etItemFrame = { Notes = "" },
- etMinecart = { Notes = "The entity is a {{cMinecart}} descendant" },
- etMob = { Notes = "The entity is a {{cMonster}} descendant" },
- etMonster = { Notes = "The entity is a {{cMonster}} descendant" },
- etPainting = { Notes = "The entity is a {{cPainting}}" },
- etPickup = { Notes = "The entity is a {{cPickup}}" },
- etPlayer = { Notes = "The entity is a {{cPlayer}}" },
- etProjectile = { Notes = "The entity is a {{cProjectileEntity}} descendant" },
- etTNT = { Notes = "The entity is a {{cTNTEntity}}" },
- },
- ConstantGroups =
- {
- EntityType =
- {
- Include = "et.*",
- TextBefore = "The following constants are used to distinguish between different entity types:",
- },
- },
- },
-
- cFile =
- {
- Desc = [[
- Provides helper functions for manipulating and querying the filesystem. Most functions are static,
- so they should be called directly on the cFile class itself:
-<pre class="prettyprint lang-lua">
-cFile:Delete("/usr/bin/virus.exe");
-</pre></p>
- ]],
- Functions =
- {
- ChangeFileExt = { Params = "FileName, NewExt", Return = "string", Notes = "(STATIC) Returns FileName with its extension changed to NewExt. NewExt may begin with a dot, but needn't, the result is the same in both cases (the first dot, if present, is ignored). FileName may contain path elements, extension is recognized as the last dot after the last path separator in the string." },
- Copy = { Params = "SrcFileName, DstFileName", Return = "bool", Notes = "(STATIC) Copies a single file to a new destination. Returns true if successful. Fails if the destination already exists." },
- CreateFolder = { Params = "FolderName", Return = "bool", Notes = "(STATIC) Creates a new folder. Returns true if successful." },
- Delete = { Params = "FileName", Return = "bool", Notes = "(STATIC) Deletes the specified file. Returns true if successful." },
- Exists = { Params = "FileName", Return = "bool", Notes = "(STATIC) Returns true if the specified file exists." },
- GetExecutableExt = { Params = "", Return = "string", Notes = "(STATIC) Returns the customary executable extension (including the dot) used by the current platform (\".exe\" on Windows, empty string on Linux). " },
- GetFolderContents = { Params = "FolderName", Return = "array table of strings", Notes = "(STATIC) Returns the contents of the specified folder, as an array table of strings. Each filesystem object is listed. Use the IsFile() and IsFolder() functions to determine the object type." },
- GetLastModificationTime = { Params = "Path", Return = "number", Notes = "(STATIC) Returns the last modification time (in current timezone) of the specified file or folder. Returns zero if file not found / not accessible. The returned value is in the same units as values returned by os.time()." },
- GetPathSeparator = { Params = "", Return = "string", Notes = "(STATIC) Returns the primary path separator used by the current platform. Returns \"\\\" on Windows and \"/\" on Linux. Note that the platform or CRT may support additional path separators, those are not reported." },
- GetSize = { Params = "FileName", Return = "number", Notes = "(STATIC) Returns the size of the file, or -1 on failure." },
- IsFile = { Params = "Path", Return = "bool", Notes = "(STATIC) Returns true if the specified path points to an existing file." },
- IsFolder = { Params = "Path", Return = "bool", Notes = "(STATIC) Returns true if the specified path points to an existing folder." },
- ReadWholeFile = { Params = "FileName", Return = "string", Notes = "(STATIC) Returns the entire contents of the specified file. Returns an empty string if the file cannot be opened." },
- Rename = { Params = "OrigPath, NewPath", Return = "bool", Notes = "(STATIC) Renames a file or a folder. Returns true if successful. Undefined result if NewPath already exists." },
- },
- }, -- cFile
-
- cFloater =
- {
- Desc = [[
- When a player uses his/her fishing rod it creates a floater entity. This class manages it.
- ]],
- Functions =
- {
- CanPickup = { Params = "", Return = "bool", Notes = "Returns true if the floater gives an item when the player right clicks." },
- GetAttachedMobID = { Params = "", Return = "EntityID", Notes = "A floater can get attached to an mob. When it is and this functions gets called it returns the mob ID. If it isn't attached to a mob it returns -1" },
- GetOwnerID = { Params = "", Return = "EntityID", Notes = "Returns the EntityID of the player who owns the floater." },
- },
- Inherits = "cEntity",
- },
-
- cIniFile =
- {
- Desc = [[
- This class implements a simple name-value storage represented on disk by an INI file. These files
- are suitable for low-volume high-latency human-readable information storage, such as for
- configuration. Cuberite itself uses INI files for settings and options.</p>
- <p>
- The INI files follow this basic structure:
-<pre class="prettyprint lang-ini">
-; Header comment line
-[KeyName0]
-; Key comment line 0
-ValueName0=Value0
-ValueName1=Value1
-
-[KeyName1]
-; Key comment line 0
-; Key comment line 1
-ValueName0=SomeOtherValue
-</pre>
- The cIniFile object stores all the objects in numbered arrays and provides access to the information
- either based on names (KeyName, ValueName) or zero-based indices.</p>
- <p>
- The objects of this class are created empty. You need to either load a file using ReadFile(), or
- insert values by hand. Then you can store the object's contents to a disk file using WriteFile(), or
- just forget everything by destroying the object. Note that the file operations are quite slow.</p>
- <p>
- For storing high-volume low-latency data, use the {{sqlite3}} class. For storing
- hierarchically-structured data, use the XML format, using the LuaExpat parser in the {{lxp}} class.
- ]],
- Functions =
- {
- constructor = { Params = "", Return = "cIniFile", Notes = "Creates a new empty cIniFile object." },
- AddHeaderComment = { Params = "Comment", Return = "", Notes = "Adds a comment to be stored in the file header." },
- AddKeyComment =
- {
- { Params = "KeyID, Comment", Return = "", Notes = "Adds a comment to be stored in the file under the specified key" },
- { Params = "KeyName, Comment", Return = "", Notes = "Adds a comment to be stored in the file under the specified key" },
- },
- AddKeyName = { Params = "KeyName", Returns = "number", Notes = "Adds a new key of the specified name. Returns the KeyID of the new key." },
- AddValue = { Params = "KeyName, ValueName, Value", Return = "", Notes = "Adds a new value of the specified name to the specified key. If another value of the same name exists in the key, both are kept (nonstandard INI file)" },
- AddValueB = { Params = "KeyName, ValueName, Value", Return = "", Notes = "Adds a new bool value of the specified name to the specified key. If another value of the same name exists in the key, both are kept (nonstandard INI file)" },
- AddValueF = { Params = "KeyName, ValueName, Value", Return = "", Notes = "Adds a new float value of the specified name to the specified key. If another value of the same name exists in the key, both are kept (nonstandard INI file)" },
- AddValueI = { Params = "KeyName, ValueName, Value", Return = "", Notes = "Adds a new integer value of the specified name to the specified key. If another value of the same name exists in the key, both are kept (nonstandard INI file)" },
- CaseInsensitive = { Params = "", Return = "", Notes = "Sets key names' and value names' comparisons to case insensitive (default)." },
- CaseSensitive = { Params = "", Return = "", Notes = "Sets key names and value names comparisons to case sensitive." },
- Clear = { Params = "", Return = "", Notes = "Removes all the in-memory data. Note that , like all the other operations, this doesn't affect any file data." },
- DeleteHeaderComment = { Params = "CommentID", Return = "bool" , Notes = "Deletes the specified header comment. Returns true if successful."},
- DeleteHeaderComments = { Params = "", Return = "", Notes = "Deletes all headers comments." },
- DeleteKey = { Params = "KeyName", Return = "bool", Notes = "Deletes the specified key, and all values in that key. Returns true if successful." },
- DeleteKeyComment =
- {
- { Params = "KeyID, CommentID", Return = "bool", Notes = "Deletes the specified key comment. Returns true if successful." },
- { Params = "KeyName, CommentID", Return = "bool", Notes = "Deletes the specified key comment. Returns true if successful." },
- },
- DeleteKeyComments =
- {
- { Params = "KeyID", Return = "bool", Notes = "Deletes all comments for the specified key. Returns true if successful." },
- { Params = "KeyName", Return = "bool", Notes = "Deletes all comments for the specified key. Returns true if successful." },
- },
- DeleteValue = { Params = "KeyName, ValueName", Return = "bool", Notes = "Deletes the specified value. Returns true if successful." },
- DeleteValueByID = { Params = "KeyID, ValueID", Return = "bool", Notes = "Deletes the specified value. Returns true if successful." },
- FindKey = { Params = "KeyName", Return = "number", Notes = "Returns the KeyID for the specified key name, or the noID constant if the key doesn't exist." },
- FindValue = { Params = "KeyID, ValueName", Return = "numebr", Notes = "Returns the ValueID for the specified value name, or the noID constant if the specified key doesn't contain a value of that name." },
- GetHeaderComment = { Params = "CommentID", Return = "string", Notes = "Returns the specified header comment, or an empty string if such comment doesn't exist" },
- GetKeyComment =
- {
- { Params = "KeyID, CommentID", Return = "string", Notes = "Returns the specified key comment, or an empty string if such a comment doesn't exist" },
- { Params = "KeyName, CommentID", Return = "string", Notes = "Returns the specified key comment, or an empty string if such a comment doesn't exist" },
- },
- GetKeyName = { Params = "KeyID", Return = "string", Notes = "Returns the key name for the specified key ID. Inverse for FindKey()." },
- GetNumHeaderComments = { Params = "", Return = "number", Notes = "Retuns the number of header comments." },
- GetNumKeyComments =
- {
- { Params = "KeyID", Return = "number", Notes = "Returns the number of comments under the specified key" },
- { Params = "KeyName", Return = "number", Notes = "Returns the number of comments under the specified key" },
- },
- GetNumKeys = { Params = "", Return = "number", Notes = "Returns the total number of keys. This is the range for the KeyID (0 .. GetNumKeys() - 1)" },
- GetNumValues =
- {
- { Params = "KeyID", Return = "number", Notes = "Returns the number of values stored under the specified key." },
- { Params = "KeyName", Return = "number", Notes = "Returns the number of values stored under the specified key." },
- },
- GetValue =
- {
- { Params = "KeyName, ValueName", Return = "string", Notes = "Returns the value of the specified name under the specified key. Returns an empty string if the value doesn't exist." },
- { Params = "KeyID, ValueID", Return = "string", Notes = "Returns the value of the specified name under the specified key. Returns an empty string if the value doesn't exist." },
- },
- GetValueB = { Params = "KeyName, ValueName", Return = "bool", Notes = "Returns the value of the specified name under the specified key, as a bool. Returns false if the value doesn't exist." },
- GetValueF = { Params = "KeyName, ValueName", Return = "number", Notes = "Returns the value of the specified name under the specified key, as a floating-point number. Returns zero if the value doesn't exist." },
- GetValueI = { Params = "KeyName, ValueName", Return = "number", Notes = "Returns the value of the specified name under the specified key, as an integer. Returns zero if the value doesn't exist." },
- GetValueName =
- {
- { Params = "KeyID, ValueID", Return = "string", Notes = "Returns the name of the specified value Inverse for FindValue()." },
- { Params = "KeyName, ValueID", Return = "string", Notes = "Returns the name of the specified value Inverse for FindValue()." },
- },
- GetValueSet = { Params = "KeyName, ValueName, Default", Return = "string", Notes = "Returns the value of the specified name under the specified key. If the value doesn't exist, creates it with the specified default." },
- GetValueSetB = { Params = "KeyName, ValueName, Default", Return = "bool", Notes = "Returns the value of the specified name under the specified key, as a bool. If the value doesn't exist, creates it with the specified default." },
- GetValueSetF = { Params = "KeyName, ValueName, Default", Return = "number", Notes = "Returns the value of the specified name under the specified key, as a floating-point number. If the value doesn't exist, creates it with the specified default." },
- GetValueSetI = { Params = "KeyName, ValueName, Default", Return = "number", Notes = "Returns the value of the specified name under the specified key, as an integer. If the value doesn't exist, creates it with the specified default." },
- HasValue = { Params = "KeyName, ValueName", Return = "bool", Notes = "Returns true if the specified value is present." },
- ReadFile = { Params = "FileName, [AllowExampleFallback]", Return = "bool", Notes = "Reads the values from the specified file. Previous in-memory contents are lost. If the file cannot be opened, and AllowExample is true, another file, \"filename.example.ini\", is loaded and then saved as \"filename.ini\". Returns true if successful, false if not." },
- SetValue =
- {
- { Params = "KeyID, ValueID, NewValue", Return = "bool", Notes = "Overwrites the specified value with a new value. If the specified value doesn't exist, returns false (doesn't add)." },
- { Params = "KeyName, ValueName, NewValue, [CreateIfNotExists]", Return = "bool", Notes = "Overwrites the specified value with a new value. If CreateIfNotExists is true (default) and the value doesn't exist, it is first created. Returns true if the value was successfully set, false if not (didn't exists, CreateIfNotExists false)." },
- },
- SetValueB = { Params = "KeyName, ValueName, NewValueBool, [CreateIfNotExists]", Return = "bool", Notes = "Overwrites the specified value with a new bool value. If CreateIfNotExists is true (default) and the value doesn't exist, it is first created. Returns true if the value was successfully set, false if not (didn't exists, CreateIfNotExists false)." },
- SetValueF = { Params = "KeyName, ValueName, NewValueFloat, [CreateIfNotExists]", Return = "bool", Notes = "Overwrites the specified value with a new floating-point number value. If CreateIfNotExists is true (default) and the value doesn't exist, it is first created. Returns true if the value was successfully set, false if not (didn't exists, CreateIfNotExists false)." },
- SetValueI = { Params = "KeyName, ValueName, NewValueInt, [CreateIfNotExists]", Return = "bool", Notes = "Overwrites the specified value with a new integer value. If CreateIfNotExists is true (default) and the value doesn't exist, it is first created. Returns true if the value was successfully set, false if not (didn't exists, CreateIfNotExists false)." },
- WriteFile = { Params = "FileName", Return = "bool", Notes = "Writes the current in-memory data into the specified file. Returns true if successful, false if not." },
- },
- Constants =
- {
- noID = { Notes = "" },
- },
- AdditionalInfo =
- {
- {
- Header = "Code example: Reading a simple value",
- Contents = [[
- cIniFile is very easy to use. For example, you can find out what port the server is supposed to
- use according to settings.ini by using this little snippet:
-<pre class="prettyprint lang-lua">
-local IniFile = cIniFile();
-if (IniFile:ReadFile("settings.ini")) then
- ServerPort = IniFile:GetValueI("Server", "Port");
-end
-</pre>
- ]],
- },
- {
- Header = "Code example: Enumerating all objects in a file",
- Contents = [[
- To enumerate all keys in a file, you need to query the total number of keys, using GetNumKeys(),
- and then query each key's name using GetKeyName(). Similarly, to enumerate all values under a
- key, you need to query the total number of values using GetNumValues() and then query each
- value's name using GetValueName().</p>
- <p>
- The following code logs all keynames and their valuenames into the server log:
-<pre class="prettyprint lang-lua">
-local IniFile = cIniFile();
-IniFile:ReadFile("somefile.ini")
-local NumKeys = IniFile:GetNumKeys();
-for k = 0, NumKeys do
- local NumValues = IniFile:GetNumValues(k);
- LOG("key \"" .. IniFile:GetKeyName(k) .. "\" has " .. NumValues .. " values:");
- for v = 0, NumValues do
- LOG(" value \"" .. IniFile:GetValueName(k, v) .. "\".");
- end
-end
-</pre>
- ]],
- },
- }, -- AdditionalInfo
- }, -- cIniFile
-
- cInventory =
- {
- Desc = [[This object is used to store the items that a {{cPlayer|cPlayer}} has. It also keeps track of what item the player has currently selected in their hotbar.
-Internally, the class uses three {{cItemGrid|cItemGrid}} objects to store the contents:
-<li>Armor</li>
-<li>Inventory</li>
-<li>Hotbar</li>
-These ItemGrids are available in the API and can be manipulated by the plugins, too.</p>
- <p>
- When using the raw slot access functions, such as GetSlot() and SetSlot(), the slots are numbered
- consecutively, each ItemGrid has its offset and count. To future-proff your plugins, use the named
- constants instead of hard-coded numbers.
- ]],
- Functions =
- {
- AddItem = { Params = "{{cItem|cItem}}, [AllowNewStacks]", Return = "number", Notes = "Adds an item to the storage; if AllowNewStacks is true (default), will also create new stacks in empty slots. Returns the number of items added" },
- AddItems = { Params = "{{cItems|cItems}}, [AllowNewStacks]", Return = "number", Notes = "Same as AddItem, but for several items at once" },
- ChangeSlotCount = { Params = "SlotNum, AddToCount", Return = "number", Notes = "Adds AddToCount to the count of items in the specified slot. If the slot was empty, ignores the call. Returns the new count in the slot, or -1 if invalid SlotNum" },
- Clear = { Params = "", Return = "", Notes = "Empties all slots" },
- CopyToItems = { Params = "{{cItems|cItems}}", Return = "", Notes = "Copies all non-empty slots into the cItems object provided; original cItems contents are preserved" },
- DamageEquippedItem = { Params = "[DamageAmount]", Return = "bool", Notes = "Adds the specified damage (1 by default) to the currently equipped it" },
- DamageItem = { Params = "SlotNum, [DamageAmount]", Return = "bool", Notes = "Adds the specified damage (1 by default) to the specified item, returns true if the item reached its max damage and should be destroyed" },
- GetArmorGrid = { Params = "", Return = "{{cItemGrid|cItemGrid}}", Notes = "Returns the ItemGrid representing the armor grid (1 x 4 slots)" },
- GetArmorSlot = { Params = "ArmorSlotNum", Return = "{{cItem|cItem}}", Notes = "Returns the specified armor slot contents. Note that the returned item is read-only" },
- GetEquippedBoots = { Params = "", Return = "{{cItem|cItem}}", Notes = "Returns the item in the \"boots\" slot of the armor grid. Note that the returned item is read-only" },
- GetEquippedChestplate = { Params = "", Return = "{{cItem|cItem}}", Notes = "Returns the item in the \"chestplate\" slot of the armor grid. Note that the returned item is read-only" },
- GetEquippedHelmet = { Params = "", Return = "{{cItem|cItem}}", Notes = "Returns the item in the \"helmet\" slot of the armor grid. Note that the returned item is read-only" },
- GetEquippedItem = { Params = "", Return = "{{cItem|cItem}}", Notes = "Returns the currently selected item from the hotbar. Note that the returned item is read-only" },
- GetEquippedLeggings = { Params = "", Return = "{{cItem|cItem}}", Notes = "Returns the item in the \"leggings\" slot of the armor grid. Note that the returned item is read-only" },
- GetEquippedSlotNum = { Params = "", Return = "number", Notes = "Returns the hotbar slot number for the currently selected item" },
- GetHotbarGrid = { Params = "", Return = "{{cItemGrid|cItemGrid}}", Notes = "Returns the ItemGrid representing the hotbar grid (9 x 1 slots)" },
- GetHotbarSlot = { Params = "HotBarSlotNum", Return = "{{cItem|cItem}}", Notes = "Returns the specified hotbar slot contents. Note that the returned item is read-only" },
- GetInventoryGrid = { Params = "", Return = "{{cItemGrid|cItemGrid}}", Notes = "Returns the ItemGrid representing the main inventory (9 x 3 slots)" },
- GetInventorySlot = { Params = "InventorySlotNum", Return = "{{cItem|cItem}}", Notes = "Returns the specified main inventory slot contents. Note that the returned item is read-only" },
- GetOwner = { Params = "", Return = "{{cPlayer|cPlayer}}", Notes = "Returns the player whose inventory this object represents" },
- GetSlot = { Params = "SlotNum", Return = "{{cItem|cItem}}", Notes = "Returns the contents of the specified slot. Note that the returned item is read-only" },
- HasItems = { Params = "{{cItem|cItem}}", Return = "bool", Notes = "Returns true if there are at least as many items of the specified type as in the parameter" },
- HowManyCanFit = { Params = "{{cItem|cItem}}", Return = "number", Notes = "Returns the number of the specified items that can fit in the storage, including empty slots" },
- HowManyItems = { Params = "{{cItem|cItem}}", Return = "number", Notes = "Returns the number of the specified items that are currently stored" },
- RemoveItem = { Params = "{{cItem}}", Return = "number", Notes = "Removes the specified item from the inventory, as many as possible, up to the item's m_ItemCount. Returns the number of items that were removed." },
- RemoveOneEquippedItem = { Params = "", Return = "", Notes = "Removes one item from the hotbar's currently selected slot" },
- SetArmorSlot = { Params = "ArmorSlotNum, {{cItem|cItem}}", Return = "", Notes = "Sets the specified armor slot contents" },
- SetEquippedSlotNum = { Params = "EquippedSlotNum", Return = "", Notes = "Sets the currently selected hotbar slot number" },
- SetHotbarSlot = { Params = "HotbarSlotNum, {{cItem|cItem}}", Return = "", Notes = "Sets the specified hotbar slot contents" },
- SetInventorySlot = { Params = "InventorySlotNum, {{cItem|cItem}}", Return = "", Notes = "Sets the specified main inventory slot contents" },
- SetSlot = { Params = "SlotNum, {{cItem|cItem}}", Return = "", Notes = "Sets the specified slot contents" },
- },
- Constants =
- {
- invArmorCount = { Notes = "Number of slots in the Armor part" },
- invArmorOffset = { Notes = "Starting slot number of the Armor part" },
- invInventoryCount = { Notes = "Number of slots in the main inventory part" },
- invInventoryOffset = { Notes = "Starting slot number of the main inventory part" },
- invHotbarCount = { Notes = "Number of slots in the Hotbar part" },
- invHotbarOffset = { Notes = "Starting slot number of the Hotbar part" },
- invNumSlots = { Notes = "Total number of slots in a cInventory" },
- },
- ConstantGroups =
- {
- SlotIndices =
- {
- Include = "inv.*",
- TextBefore = [[
- Rather than hardcoding numbers, use the following constants for slot indices and counts:
- ]],
- },
- },
- }, -- cInventory
-
- cItem =
- {
- Desc = [[
- cItem is what defines an item or stack of items in the game, it contains the item ID, damage,
- quantity and enchantments. Each slot in a {{cInventory}} class or a {{cItemGrid}} class is a cItem
- and each {{cPickup}} contains a cItem. The enchantments are contained in a separate
- {{cEnchantments}} class and are accessible through the m_Enchantments variable.</p>
- <p>
- To test if a cItem object represents an empty item, do not compare the item type nor the item count,
- but rather use the IsEmpty() function.</p>
- <p>
- To translate from a cItem to its string representation, use the {{Globals#functions|global function}}
- ItemToString(), ItemTypeToString() or ItemToFullString(). To translate from a string to a cItem,
- use the StringToItem() global function.
- ]],
-
- Functions =
- {
- constructor =
- {
- { Params = "", Return = "cItem", Notes = "Creates a new empty cItem object" },
- { Params = "ItemType, Count, Damage, EnchantmentString, CustomName, Lore", Return = "cItem", Notes = "Creates a new cItem object of the specified type, count (1 by default), damage (0 by default), enchantments (non-enchanted by default), CustomName (empty by default) and Lore (string, empty by default)" },
- { Params = "cItem", Return = "cItem", Notes = "Creates an exact copy of the cItem object in the parameter" },
- } ,
- AddCount = { Params = "AmountToAdd", Return = "cItem", Notes = "Adds the specified amount to the item count. Returns self (useful for chaining)." },
- Clear = { Params = "", Return = "", Notes = "Resets the instance to an empty item" },
- CopyOne = { Params = "", Return = "cItem", Notes = "Creates a copy of this object, with its count set to 1" },
- DamageItem = { Params = "[Amount]", Return = "bool", Notes = "Adds the specified damage. Returns true when damage reaches max value and the item should be destroyed (but doesn't destroy the item)" },
- Empty = { Params = "", Return = "", Notes = "Resets the instance to an empty item" },
- GetMaxDamage = { Params = "", Return = "number", Notes = "Returns the maximum value for damage that this item can get before breaking; zero if damage is not accounted for for this item type" },
- GetMaxStackSize = { Params = "", Return = "number", Notes = "Returns the maximum stack size for this item." },
- IsDamageable = { Params = "", Return = "bool", Notes = "Returns true if this item does account for its damage" },
- IsEmpty = { Params = "", Return = "bool", Notes = "Returns true if this object represents an empty item (zero count or invalid ID)" },
- IsEqual = { Params = "cItem", Return = "bool", Notes = "Returns true if the item in the parameter is the same as the one stored in the object (type, damage, lore, name and enchantments)" },
- IsFullStack = { Params = "", Return = "bool", Notes = "Returns true if the item is stacked up to its maximum stacking" },
- IsSameType = { Params = "cItem", Return = "bool", Notes = "Returns true if the item in the parameter is of the same ItemType as the one stored in the object. This is true even if the two items have different enchantments" },
- IsBothNameAndLoreEmpty = { Params = "", Return = "bool", Notes = "Returns if both the custom name and lore are not set." },
- IsCustomNameEmpty = { Params = "", Return = "bool", Notes = "Returns if the custom name of the cItem is empty." },
- IsLoreEmpty = { Params = "", Return = "", Notes = "Returns if the lore of the cItem is empty." },
- GetEnchantability = { Params = "", Return = "number", Notes = "Returns the enchantability of the item. When the item hasn't a enchantability, it will returns 0" },
- EnchantByXPLevels = { Params = "NumXPLevels", Return = "bool", Notes = "Enchants the item using the specified number of XP levels. Returns true if item enchanted, false if not." },
- IsEnchantable = { Params = "ItemType, WithBook", Return = "bool", Notes = "(STATIC) Returns true if the specified item type is enchantable. If WithBook is true, the function is used in the anvil inventory with book enchantments. So it checks the \"only book enchantments\" too. Example: You can only enchant a hoe with a book." },
- },
- Variables =
- {
- m_Enchantments = { Type = "{{cEnchantments}}", Notes = "The enchantments that this item has" },
- m_ItemCount = { Type = "number", Notes = "Number of items in this stack" },
- m_ItemDamage = { Type = "number", Notes = "The damage of the item. Zero means no damage. Maximum damage can be queried with GetMaxDamage()" },
- m_ItemType = { Type = "number", Notes = "The item type. One of E_ITEM_ or E_BLOCK_ constants" },
- m_CustomName = { Type = "string", Notes = "The custom name for an item." },
- m_Lore = { Type = "string", Notes = "The lore for an item. Line breaks are represented by the ` character." },
- m_RepairCost = { Type = "number", Notes = "The repair cost of the item. The anvil need this value" },
- m_Enchantments = { Type = "{{cEnchantments|cEnchantments}}}", Notes = "The enchantments of the item." },
- },
- AdditionalInfo =
- {
- {
- Header = "Usage notes",
- Contents = [[
- Note that the object contained in a cItem class is quite complex and quite often new Minecraft
- versions add more stuff. Therefore it is recommended to copy cItem objects using the
- copy-constructor ("local copy = cItem(original);"), this is the only way that guarantees that
- the object will be copied at full, even with future versions of Cuberite.
- ]],
- },
- {
- Header = "Example code",
- Contents = [[
- The following code shows how to create items in several different ways (adapted from the Debuggers plugin):
-<pre class="prettyprint lang-lua">
--- empty item:
-local Item1 = cItem();
-
--- enchanted sword, enchantment given as numeric string (bad style; see Item5):
-local Item2 = cItem(E_ITEM_DIAMOND_SWORD, 1, 0, "1=1");
-
--- 1 undamaged shovel, no enchantment:
-local Item3 = cItem(E_ITEM_DIAMOND_SHOVEL);
-
--- Add the Unbreaking enchantment. Note that Vanilla's levelcap isn't enforced:
-Item3.m_Enchantments:SetLevel(cEnchantments.enchUnbreaking, 4);
-
--- 1 undamaged pickaxe, no enchantment:
-local Item4 = cItem(E_ITEM_DIAMOND_PICKAXE);
-
--- Add multiple enchantments:
-Item4.m_Enchantments:SetLevel(cEnchantments.enchUnbreaking, 5);
-Item4.m_Enchantments:SetLevel(cEnchantments.enchEfficiency, 3);
-
--- enchanted chestplate, enchantment given as textual stringdesc (good style)
-local Item5 = cItem(E_ITEM_DIAMOND_CHESTPLATE, 1, 0, "thorns=1;unbreaking=3");
-</pre>
-]],
- },
- },
- }, -- cItem
-
- cObjective =
- {
- Desc = [[
- This class represents a single scoreboard objective.
- ]],
- Functions =
- {
- AddScore = { Params = "string, number", Return = "Score", Notes = "Adds a value to the score of the specified player and returns the new value." },
- GetDisplayName = { Params = "", Return = "string", Notes = "Returns the display name of the objective. This name will be shown to the connected players." },
- GetName = { Params = "", Return = "string", Notes = "Returns the internal name of the objective." },
- GetScore = { Params = "string", Return = "Score", Notes = "Returns the score of the specified player." },
- GetType = { Params = "", Return = "eType", Notes = "Returns the type of the objective. (i.e what is being tracked)" },
- Reset = { Params = "", Return = "", Notes = "Resets the scores of the tracked players." },
- ResetScore = { Params = "string", Return = "", Notes = "Reset the score of the specified player." },
- SetDisplayName = { Params = "string", Return = "", Notes = "Sets the display name of the objective." },
- SetScore = { Params = "string, Score", Return = "", Notes = "Sets the score of the specified player." },
- SubScore = { Params = "string, number", Return = "Score", Notes = "Subtracts a value from the score of the specified player and returns the new value." },
- },
- Constants =
- {
- otAchievement = { Notes = "" },
- otDeathCount = { Notes = "" },
- otDummy = { Notes = "" },
- otHealth = { Notes = "" },
- otPlayerKillCount = { Notes = "" },
- otStat = { Notes = "" },
- otStatBlockMine = { Notes = "" },
- otStatEntityKill = { Notes = "" },
- otStatEntityKilledBy = { Notes = "" },
- otStatItemBreak = { Notes = "" },
- otStatItemCraft = { Notes = "" },
- otStatItemUse = { Notes = "" },
- otTotalKillCount = { Notes = "" },
- },
- }, -- cObjective
-
- cPainting =
- {
- Desc = "This class represents a painting in the world. These paintings are special and different from Vanilla in that they can be critical-hit.",
- Functions =
- {
- GetDirection = { Params = "", Return = "number", Notes = "Returns the direction the painting faces. Directions: ZP - 0, ZM - 2, XM - 1, XP - 3. Note that these are not the BLOCK_FACE constants." },
- GetName = { Params = "", Return = "string", Notes = "Returns the name of the painting" },
- },
-
- }, -- cPainting
-
- cItemGrid =
- {
- Desc = [[This class represents a 2D array of items. It is used as the underlying storage and API for all cases that use a grid of items:
-<li>{{cChestEntity|Chest}} contents</li>
-<li>(TODO) Chest minecart contents</li>
-<li>{{cDispenserEntity|Dispenser}} contents</li>
-<li>{{cDropperEntity|Dropper}} contents</li>
-<li>{{cFurnaceEntity|Furnace}} contents (?)</li>
-<li>{{cHopperEntity|Hopper}} contents</li>
-<li>(TODO) Hopper minecart contents</li>
-<li>{{cPlayer|Player}} Inventory areas</li>
-<li>(TODO) Trapped chest contents</li>
-</p>
- <p>The items contained in this object are accessed either by a pair of XY coords, or a slot number (x + Width * y). There are functions available for converting between the two formats.
-]],
- Functions =
- {
- AddItem = { Params = "{{cItem|cItem}}, [AllowNewStacks]", Return = "number", Notes = "Adds an item to the storage; if AllowNewStacks is true (default), will also create new stacks in empty slots. Returns the number of items added" },
- AddItems = { Params = "{{cItems|cItems}}, [AllowNewStacks]", Return = "number", Notes = "Same as AddItem, but for several items at once" },
- ChangeSlotCount =
- {
- { Params = "SlotNum, AddToCount", Return = "number", Notes = "Adds AddToCount to the count of items in the specified slot. If the slot was empty, ignores the call. Returns the new count in the slot, or -1 if invalid SlotNum" },
- { Params = "X, Y, AddToCount", Return = "number", Notes = "Adds AddToCount to the count of items in the specified slot. If the slot was empty, ignores the call. Returns the new count in the slot, or -1 if invalid slot coords" },
- },
- Clear = { Params = "", Return = "", Notes = "Empties all slots" },
- CopyToItems = { Params = "{{cItems|cItems}}", Return = "", Notes = "Copies all non-empty slots into the cItems object provided; original cItems contents are preserved" },
- DamageItem =
- {
- { Params = "SlotNum, [DamageAmount]", Return = "bool", Notes = "Adds the specified damage (1 by default) to the specified item, returns true if the item reached its max damage and should be destroyed" },
- { Params = "X, Y, [DamageAmount]", Return = "bool", Notes = "Adds the specified damage (1 by default) to the specified item, returns true if the item reached its max damage and should be destroyed" },
- },
- EmptySlot =
- {
- { Params = "SlotNum", Return = "", Notes = "Destroys the item in the specified slot" },
- { Params = "X, Y", Return = "", Notes = "Destroys the item in the specified slot" },
- },
- GetFirstEmptySlot = { Params = "", Return = "number", Notes = "Returns the SlotNumber of the first empty slot, -1 if all slots are full" },
- GetFirstUsedSlot = { Params = "", Return = "number", Notes = "Returns the SlotNumber of the first non-empty slot, -1 if all slots are empty" },
- GetHeight = { Params = "", Return = "number", Notes = "Returns the Y dimension of the grid" },
- GetLastEmptySlot = { Params = "", Return = "number", Notes = "Returns the SlotNumber of the last empty slot, -1 if all slots are full" },
- GetLastUsedSlot = { Params = "", Return = "number", Notes = "Returns the SlotNumber of the last non-empty slot, -1 if all slots are empty" },
- GetNextEmptySlot = { Params = "StartFrom", Return = "number", Notes = "Returns the SlotNumber of the first empty slot following StartFrom, -1 if all the following slots are full" },
- GetNextUsedSlot = { Params = "StartFrom", Return = "number", Notes = "Returns the SlotNumber of the first non-empty slot following StartFrom, -1 if all the following slots are full" },
- GetNumSlots = { Params = "", Return = "number", Notes = "Returns the total number of slots in the grid (Width * Height)" },
- GetSlot =
- {
- { Params = "SlotNumber", Return = "{{cItem|cItem}}", Notes = "Returns the item in the specified slot. Note that the item is read-only" },
- { Params = "X, Y", Return = "{{cItem|cItem}}", Notes = "Returns the item in the specified slot. Note that the item is read-only" },
- },
- GetSlotCoords = { Params = "SlotNum", Return = "number, number", Notes = "Returns the X and Y coords for the specified SlotNumber. Returns \"-1, -1\" on invalid SlotNumber" },
- GetSlotNum = { Params = "X, Y", Return = "number", Notes = "Returns the SlotNumber for the specified slot coords. Returns -1 on invalid coords" },
- GetWidth = { Params = "", Return = "number", Notes = "Returns the X dimension of the grid" },
- HasItems = { Params = "{{cItem|cItem}}", Return = "bool", Notes = "Returns true if there are at least as many items of the specified type as in the parameter" },
- HowManyCanFit = { Params = "{{cItem|cItem}}", Return = "number", Notes = "Returns the number of the specified items that can fit in the storage, including empty slots" },
- HowManyItems = { Params = "{{cItem|cItem}}", Return = "number", Notes = "Returns the number of the specified items that are currently stored" },
- IsSlotEmpty =
- {
- { Params = "SlotNum", Return = "bool", Notes = "Returns true if the specified slot is empty, or an invalid slot is specified" },
- { Params = "X, Y", Return = "bool", Notes = "Returns true if the specified slot is empty, or an invalid slot is specified" },
- },
- RemoveItem = { Params = "{{cItem}}", Return = "number", Notes = "Removes the specified item from the grid, as many as possible, up to the item's m_ItemCount. Returns the number of items that were removed." },
- RemoveOneItem =
- {
- { Params = "SlotNum", Return = "{{cItem|cItem}}", Notes = "Removes one item from the stack in the specified slot and returns it as a single cItem. Empty slots are skipped and an empty item is returned" },
- { Params = "X, Y", Return = "{{cItem|cItem}}", Notes = "Removes one item from the stack in the specified slot and returns it as a single cItem. Empty slots are skipped and an empty item is returned" },
- },
- SetSlot =
- {
- { Params = "SlotNum, {{cItem|cItem}}", Return = "", Notes = "Sets the specified slot to the specified item" },
- { Params = "X, Y, {{cItem|cItem}}", Return = "", Notes = "Sets the specified slot to the specified item" },
- },
- },
- AdditionalInfo =
- {
- {
- Header = "Code example: Add items to player inventory",
- Contents = [[
- The following code tries to add 32 sticks to a player's main inventory:
-<pre class="prettyprint lang-lua">
-local Items = cItem(E_ITEM_STICK, 32);
-local PlayerMainInventory = Player:GetInventorySlots(); -- PlayerMainInventory is of type cItemGrid
-local NumAdded = PlayerMainInventory:AddItem(Items);
-if (NumAdded == Items.m_ItemCount) then
- -- All the sticks did fit
- LOG("Added 32 sticks");
-else
- -- Some (or all) of the sticks didn't fit
- LOG("Tried to add 32 sticks, but only " .. NumAdded .. " could fit");
-end
-</pre>
- ]],
- },
- {
- Header = "Code example: Damage an item",
- Contents = [[
- The following code damages the helmet in the player's armor and destroys it if it reaches max damage:
-<pre class="prettyprint lang-lua">
-local PlayerArmor = Player:GetArmorSlots(); -- PlayerArmor is of type cItemGrid
-if (PlayerArmor:DamageItem(0)) then -- Helmet is at SlotNum 0
- -- The helmet has reached max damage, destroy it:
- PlayerArmor:EmptySlot(0);
-end
-</pre>
- ]],
- },
- }, -- AdditionalInfo
- }, -- cItemGrid
-
- cItems =
- {
- Desc = [[
- This class represents a numbered collection (array) of {{cItem}} objects. The array indices start at
- zero, each consecutive item gets a consecutive index. This class is used for spawning multiple
- pickups or for mass manipulating an inventory.
- ]],
- Functions =
- {
- constructor = { Params = "", Return = "cItems", Notes = "Creates a new cItems object" },
- Add =
- {
- { Params = "{{cItem|cItem}}", Return = "", Notes = "Adds a new item to the end of the collection" },
- { Params = "ItemType, ItemCount, ItemDamage", Return = "", Notes = "Adds a new item to the end of the collection" },
- },
- Clear = { Params = "", Return = "", Notes = "Removes all items from the collection" },
- Delete = { Params = "Index", Return = "", Notes = "Deletes item at the specified index" },
- Get = { Params = "Index", Return = "{{cItem|cItem}}", Notes = "Returns the item at the specified index" },
- Set =
- {
- { Params = "Index, {{cItem|cItem}}", Return = "", Notes = "Sets the item at the specified index to the specified item" },
- { Params = "Index, ItemType, ItemCount, ItemDamage", Return = "", Notes = "Sets the item at the specified index to the specified item" },
- },
- Size = { Params = "", Return = "number", Notes = "Returns the number of items in the collection" },
- },
- }, -- cItems
-
- cLuaWindow =
- {
- Desc = [[This class is used by plugins wishing to display a custom window to the player, unrelated to block entities or entities near the player. The window can be of any type and have any contents that the plugin defines. Callbacks for when the player modifies the window contents and when the player closes the window can be set.
-</p>
- <p>This class inherits from the {{cWindow|cWindow}} class, so all cWindow's functions and constants can be used, in addition to the cLuaWindow-specific functions listed below.
-</p>
- <p>The contents of this window are represented by a {{cWindow|cWindow}}:GetSlot() etc. or {{cPlayer|cPlayer}}:GetInventory() to access the player inventory.
-</p>
- <p>When creating a new cLuaWindow object, you need to specify both the window type and the contents' width and height. Note that Cuberite accepts any combination of these, but opening a window for a player may crash their client if the contents' dimensions don't match the client's expectations.
-</p>
- <p>To open the window for a player, call {{cPlayer|cPlayer}}:OpenWindow(). Multiple players can open window of the same cLuaWindow object. All players see the same items in the window's contents (like chest, unlike crafting table).
-]],
- Functions =
- {
- constructor = { Params = "WindowType, ContentsWidth, ContentsHeight, Title", Return = "", Notes = "Creates a new object of this class" },
- GetContents = { Params = "", Return = "{{cItemGrid|cItemGrid}}", Notes = "Returns the cItemGrid object representing the internal storage in this window" },
- SetOnClosing = { Params = "OnClosingCallback", Return = "", Notes = "Sets the function that the window will call when it is about to be closed by a player" },
- SetOnSlotChanged = { Params = "OnSlotChangedCallback", Return = "", Notes = "Sets the function that the window will call when a slot is changed by a player" },
- },
- AdditionalInfo =
- {
- {
- Header = "Callbacks",
- Contents = [[
- The object calls the following functions at the appropriate time:
- ]],
- },
- {
- Header = "OnClosing Callback",
- Contents = [[
- This callback, settable via the SetOnClosing() function, will be called when the player tries to close the window, or the window is closed for any other reason (such as a player disconnecting).</p>
-<pre class="prettyprint lang-lua">
-function OnWindowClosing(a_Window, a_Player, a_CanRefuse)
-</pre>
- <p>
- The a_Window parameter is the cLuaWindow object representing the window, a_Player is the player for whom the window is about to close. a_CanRefuse specifies whether the callback can refuse the closing. If the callback returns true and a_CanRefuse is true, the window is not closed (internally, the server sends a new OpenWindow packet to the client).
- ]],
- },
- {
- Header = "OnSlotChanged Callback",
- Contents = [[
- This callback, settable via the SetOnSlotChanged() function, will be called whenever the contents of any slot in the window's contents (i. e. NOT in the player inventory!) changes.</p>
-<pre class="prettyprint lang-lua">
-function OnWindowSlotChanged(a_Window, a_SlotNum)
-</pre>
- <p>The a_Window parameter is the cLuaWindow object representing the window, a_SlotNum is the slot number. There is no reference to a {{cPlayer}}, because the slot change needn't originate from the player action. To get or set the slot, you'll need to retrieve a cPlayer object, for example by calling {{cWorld|cWorld}}:DoWithPlayer().
- </p>
- <p>Any returned values are ignored.
- ]],
- },
- {
- Header = "Example",
- Contents = [[
- This example is taken from the Debuggers plugin, used to test the API functionality. It opens a window and refuse to close it 3 times. It also logs slot changes to the server console.
-<pre class="prettyprint lang-lua">
--- Callback that refuses to close the window twice, then allows:
-local Attempt = 1;
-local OnClosing = function(Window, Player, CanRefuse)
- Player:SendMessage("Window closing attempt #" .. Attempt .. "; CanRefuse = " .. tostring(CanRefuse));
- Attempt = Attempt + 1;
- return CanRefuse and (Attempt <= 3); -- refuse twice, then allow, unless CanRefuse is set to true
-end
-
--- Log the slot changes:
-local OnSlotChanged = function(Window, SlotNum)
- LOG("Window \"" .. Window:GetWindowTitle() .. "\" slot " .. SlotNum .. " changed.");
-end
-
--- Set window contents:
--- a_Player is a cPlayer object received from the outside of this code fragment
-local Window = cLuaWindow(cWindow.Hopper, 3, 3, "TestWnd");
-Window:SetSlot(a_Player, 0, cItem(E_ITEM_DIAMOND, 64));
-Window:SetOnClosing(OnClosing);
-Window:SetOnSlotChanged(OnSlotChanged);
-
--- Open the window:
-a_Player:OpenWindow(Window);
-</pre>
- ]],
- },
- }, -- AdditionalInfo
- Inherits = "cWindow",
- }, -- cLuaWindow
-
- cMap =
- {
- Desc = [[
- This class encapsulates a single in-game colored map.</p>
- <p>
- The contents (i.e. pixel data) of a cMap are dynamically updated by each
- tracked {{cPlayer}} instance. Furthermore, a cMap maintains and periodically
- updates a list of map decorators, which are objects drawn on the map that
- can freely move (e.g. Player and item frame pointers).
- ]],
- Functions =
- {
- EraseData = { Params = "", Return = "", Notes = "Erases all pixel data." },
- GetCenterX = { Params = "", Return = "number", Notes = "Returns the X coord of the map's center." },
- GetCenterZ = { Params = "", Return = "number", Notes = "Returns the Y coord of the map's center." },
- GetDimension = { Params = "", Return = "eDimension", Notes = "Returns the dimension of the associated world." },
- GetHeight = { Params = "", Return = "number", Notes = "Returns the height of the map." },
- GetID = { Params = "", Return = "number", Notes = "Returns the numerical ID of the map. (The item damage value)" },
- GetName = { Params = "", Return = "string", Notes = "Returns the name of the map." },
- GetNumPixels = { Params = "", Return = "number", Notes = "Returns the number of pixels in this map." },
- GetPixel = { Params = "PixelX, PixelZ", Return = "ColorID", Notes = "Returns the color of the specified pixel." },
- GetPixelWidth = { Params = "", Return = "number", Notes = "Returns the width of a single pixel in blocks." },
- GetScale = { Params = "", Return = "number", Notes = "Returns the scale of the map. Range: [0,4]" },
- GetWidth = { Params = "", Return = "number", Notes = "Returns the width of the map." },
- GetWorld = { Params = "", Return = "cWorld", Notes = "Returns the associated world." },
- Resize = { Params = "Width, Height", Return = "", Notes = "Resizes the map. WARNING: This will erase the pixel data." },
- SetPixel = { Params = "PixelX, PixelZ, ColorID", Return = "bool", Notes = "Sets the color of the specified pixel. Returns false on error (Out of range)." },
- SetPosition = { Params = "CenterX, CenterZ", Return = "", Notes = "Relocates the map. The pixel data will not be modified." },
- SetScale = { Params = "number", Return = "", Notes = "Rescales the map. The pixel data will not be modified." },
- },
- Constants =
- {
- E_BASE_COLOR_BLUE = { Notes = "" },
- E_BASE_COLOR_BROWN = { Notes = "" },
- E_BASE_COLOR_DARK_BROWN = { Notes = "" },
- E_BASE_COLOR_DARK_GRAY = { Notes = "" },
- E_BASE_COLOR_DARK_GREEN = { Notes = "" },
- E_BASE_COLOR_GRAY_1 = { Notes = "" },
- E_BASE_COLOR_GRAY_2 = { Notes = "" },
- E_BASE_COLOR_LIGHT_BROWN = { Notes = "" },
- E_BASE_COLOR_LIGHT_GRAY = { Notes = "" },
- E_BASE_COLOR_LIGHT_GREEN = { Notes = "" },
- E_BASE_COLOR_PALE_BLUE = { Notes = "" },
- E_BASE_COLOR_RED = { Notes = "" },
- E_BASE_COLOR_TRANSPARENT = { Notes = "" },
- E_BASE_COLOR_WHITE = { Notes = "" },
- },
- }, -- cMap
-
- cMapManager =
- {
- Desc = [[
- This class is associated with a single {{cWorld}} instance and manages a list of maps.
- ]],
- Functions =
- {
- DoWithMap = { Params = "ID, CallbackFunction", Return = "bool", Notes = "If a map with the specified ID exists, calls the CallbackFunction for that map. The CallbackFunction has the following signature: <pre class=\"prettyprint lang-lua\">function Callback({{cMap|Map}})</pre> Returns true if the map was found and the callback called, false if map not found." },
- GetNumMaps = { Params = "", Return = "number", Notes = "Returns the number of registered maps." },
- },
-
- }, -- cMapManager
-
- cMojangAPI =
- {
- Desc = [[
- Provides interface to various API functions that Mojang provides through their servers. Note that
- some of these calls will wait for a response from the network, and so shouldn't be used while the
- server is fully running (or at least when there are players connected) to avoid percepted lag.</p>
- <p>
- All the functions are static, call them using the <code>cMojangAPI:Function()</code> convention.</p>
- <p>
- Mojang uses two formats for UUIDs, short and dashed. Cuberite works with short UUIDs internally, but
- will convert to dashed UUIDs where needed - in the protocol login for example. The MakeUUIDShort()
- and MakeUUIDDashed() functions are provided for plugins to use for conversion between the two
- formats.</p>
- <p>
- This class will cache values returned by the API service. The cache will hold the values for 7 days
- by default, after that, they will no longer be available. This is in order to not let the server get
- banned from using the API service, since they are rate-limited to 600 queries per 10 minutes. The
- cache contents also gets updated whenever a player successfully joins, since that makes the server
- contact the API service, too, and retrieve the relevant data.</p>
- ]],
- Functions =
- {
- AddPlayerNameToUUIDMapping = { Params = "PlayerName, UUID", Return = "", Notes = "(STATIC) Adds the specified PlayerName-to-UUID mapping into the cache, with current timestamp. Accepts both short or dashed UUIDs. " },
- GetPlayerNameFromUUID = { Params = "UUID, [UseOnlyCached]", Return = "PlayerName", Notes = "(STATIC) Returns the playername that corresponds to the given UUID, or an empty string on error. If UseOnlyCached is false (the default), queries the Mojang servers if the UUID is not in the cache. The UUID can be either short or dashed. <br /><b>WARNING</b>: Do NOT use this function with UseOnlyCached set to false while the server is running. Only use it when the server is starting up (inside the Initialize() method), otherwise you will lag the server severely." },
- GetUUIDFromPlayerName = { Params = "PlayerName, [UseOnlyCached]", Return = "UUID", Notes = "(STATIC) Returns the (short) UUID that corresponds to the given playername, or an empty string on error. If UseOnlyCached is false (the default), queries the Mojang servers if the playername is not in the cache. <br /><b>WARNING</b>: Do NOT use this function with UseOnlyCached set to false while the server is running. Only use it when the server is starting up (inside the Initialize() method), otherwise you will lag the server severely." },
- GetUUIDsFromPlayerNames = { Params = "PlayerNames, [UseOnlyCached]", Return = "table", Notes = "(STATIC) Returns a table that contains the map, 'PlayerName' -> '(short) UUID', for all valid playernames in the input array-table. PlayerNames not recognized will not be set in the returned map. If UseOnlyCached is false (the default), queries the Mojang servers for the results that are not in the cache. <br /><b>WARNING</b>: Do NOT use this function with UseOnlyCached set to false while the server is running. Only use it when the server is starting up (inside the Initialize() method), otherwise you will lag the server severely." },
- MakeUUIDDashed = { Params = "UUID", Return = "DashedUUID", Notes = "(STATIC) Converts the UUID to a dashed format (\"01234567-8901-2345-6789-012345678901\"). Accepts both dashed or short UUIDs. Logs a warning and returns an empty string if UUID format not recognized." },
- MakeUUIDShort = { Params = "UUID", Return = "ShortUUID", Notes = "(STATIC) Converts the UUID to a short format (without dashes, \"01234567890123456789012345678901\"). Accepts both dashed or short UUIDs. Logs a warning and returns an empty string if UUID format not recognized." },
- },
-
- },
-
- cMonster =
- {
- Desc = [[
- This class is the base class for all computer-controlled mobs in the game.</p>
- <p>
- To spawn a mob in a world, use the {{cWorld}}:SpawnMob() function.
- ]],
- Functions =
- {
- HasCustomName = { Params = "", Return = "bool", Notes = "Returns true if the monster has a custom name." },
- GetCustomName = { Params = "", Return = "string", Notes = "Gets the custom name of the monster. If no custom name is set, the function returns an empty string." },
- SetCustomName = { Params = "string", Return = "", Notes = "Sets the custom name of the monster. You see the name over the monster. If you want to disable the custom name, simply set an empty string." },
- IsCustomNameAlwaysVisible = { Params = "", Return = "bool", Notes = "Is the custom name of this monster always visible? If not, you only see the name when you sight the mob." },
- SetCustomNameAlwaysVisible = { Params = "bool", Return = "", Notes = "Sets the custom name visiblity of this monster. If it's false, you only see the name when you sight the mob. If it's true, you always see the custom name." },
- FamilyFromType = { Params = "{{Globals#MobType|MobType}}", Return = "{{cMonster#MobFamily|MobFamily}}", Notes = "(STATIC) Returns the mob family ({{cMonster#MobFamily|mfXXX}} constants) based on the mob type ({{Globals#MobType|mtXXX}} constants)" },
- GetMobFamily = { Params = "", Return = "{{cMonster#MobFamily|MobFamily}}", Notes = "Returns this mob's family ({{cMonster#MobFamily|mfXXX}} constant)" },
- GetMobType = { Params = "", Return = "{{Globals#MobType|MobType}}", Notes = "Returns the type of this mob ({{Globals#MobType|mtXXX}} constant)" },
- GetSpawnDelay = { Params = "{{cMonster#MobFamily|MobFamily}}", Return = "number", Notes = "(STATIC) Returns the spawn delay - the number of game ticks between spawn attempts - for the specified mob family." },
- MobTypeToString = { Params = "{{Globals#MobType|MobType}}", Return = "string", Notes = "(STATIC) Returns the string representing the given mob type ({{Globals#MobType|mtXXX}} constant), or empty string if unknown type." },
- MobTypeToVanillaName = { Params = "{{Globals#MobType|MobType}}", Return = "string", Notes = "(STATIC) Returns the vanilla name of the given mob type, or empty string if unknown type." },
- MoveToPosition = { Params = "Position", Return = "", Notes = "Moves mob to the specified position" },
- StringToMobType = { Params = "string", Return = "{{Globals#MobType|MobType}}", Notes = "(STATIC) Returns the mob type ({{Globals#MobType|mtXXX}} constant) parsed from the string type (\"creeper\"), or mtInvalidType if unrecognized." },
- GetRelativeWalkSpeed = { Params = "", Return = "number", Notes = "Returns the relative walk speed of this mob. Standard is 1.0" },
- SetRelativeWalkSpeed = { Params = "number", Return = "", Notes = "Sets the relative walk speed of this mob. Standard is 1.0" },
- SetAge = { Params = "number", Return = "", Notes = "Sets the age of the monster" },
- GetAge = { Params = "", Return = "number", Notes = "Returns the age of the monster" },
- IsBaby = { Params = "", Return = "bool", Notes = "Returns true if the monster is a baby" },
- },
- Constants =
- {
- mfAmbient = { Notes = "Family: ambient (bat)" },
- mfHostile = { Notes = "Family: hostile (blaze, cavespider, creeper, enderdragon, enderman, ghast, giant, magmacube, silverfish, skeleton, slime, spider, witch, wither, zombie, zombiepigman)" },
- mfMaxplusone = { Notes = "The maximum family value, plus one. Returned when monster family not recognized." },
- mfPassive = { Notes = "Family: passive (chicken, cow, horse, irongolem, mooshroom, ocelot, pig, sheep, snowgolem, villager, wolf)" },
- mfWater = { Notes = "Family: water (squid)" },
- mtBat = { Notes = "" },
- mtBlaze = { Notes = "" },
- mtCaveSpider = { Notes = "" },
- mtChicken = { Notes = "" },
- mtCow = { Notes = "" },
- mtCreeper = { Notes = "" },
- mtEnderDragon = { Notes = "" },
- mtEnderman = { Notes = "" },
- mtGhast = { Notes = "" },
- mtGiant = { Notes = "" },
- mtHorse = { Notes = "" },
- mtInvalidType = { Notes = "Invalid monster type. Returned when monster type not recognized" },
- mtIronGolem = { Notes = "" },
- mtMagmaCube = { Notes = "" },
- mtMooshroom = { Notes = "" },
- mtOcelot = { Notes = "" },
- mtPig = { Notes = "" },
- mtSheep = { Notes = "" },
- mtSilverfish = { Notes = "" },
- mtSkeleton = { Notes = "" },
- mtSlime = { Notes = "" },
- mtSnowGolem = { Notes = "" },
- mtSpider = { Notes = "" },
- mtSquid = { Notes = "" },
- mtVillager = { Notes = "" },
- mtWitch = { Notes = "" },
- mtWither = { Notes = "" },
- mtWolf = { Notes = "" },
- mtZombie = { Notes = "" },
- mtZombiePigman = { Notes = "" },
- },
- ConstantGroups =
- {
- MobFamily =
- {
- Include = "mf.*",
- TextBefore = [[
- Mobs are divided into families. The following constants are used for individual family types:
- ]],
- },
- },
- Inherits = "cPawn",
- }, -- cMonster
-
- cPawn =
- {
- Desc = [[cPawn is a controllable pawn object, controlled by either AI or a player. cPawn inherits all functions and members of {{cEntity}}
-]],
- Functions =
- {
- TeleportToEntity = { Return = "" },
- TeleportTo = { Return = "" },
- Heal = { Return = "" },
- TakeDamage = { Return = "" },
- KilledBy = { Return = "" },
- GetHealth = { Return = "number" },
- AddEntityEffect = { Params = "EffectType, {{cEntityEffect}}", Return = "", Notes = "Applies an entity effect" },
- RemoveEntityEffect = { Params = "EffectType", Return = "", Notes = "Removes a currently applied entity effect" },
- ClearEntityEffects = { Return = "", Notes = "Removes all currently applied entity effects" },
- },
- Inherits = "cEntity",
- }, -- cPawn
-
- cPickup =
- {
- Desc = [[
- This class represents a pickup entity (an item that the player or mobs can pick up). It is also
- commonly known as "drops". With this class you could create your own "drop" or modify those
- created automatically.
- ]],
- Functions =
- {
- CollectedBy = { Params = "{{cPlayer}}", Return = "bool", Notes = "Tries to make the player collect the pickup. Returns true if the pickup was collected, at least partially." },
- GetAge = { Params = "", Return = "number", Notes = "Returns the number of ticks that the pickup has existed." },
- GetItem = { Params = "", Return = "{{cItem|cItem}}", Notes = "Returns the item represented by this pickup" },
- IsCollected = { Params = "", Return = "bool", Notes = "Returns true if this pickup has already been collected (is waiting to be destroyed)" },
- IsPlayerCreated = { Params = "", Return = "bool", Notes = "Returns true if the pickup was created by a player" },
- SetAge = { Params = "AgeTicks", Return = "", Notes = "Sets the pickup's age, in ticks." },
- },
- Inherits = "cEntity",
- }, -- cPickup
-
- cPlayer =
- {
- Desc = [[
- This class describes a player in the server. cPlayer inherits all functions and members of
- {{cPawn|cPawn}}. It handles all the aspects of the gameplay, such as hunger, sprinting, inventory
- etc.
- ]],
- Functions =
- {
- AddFoodExhaustion = { Params = "Exhaustion", Return = "", Notes = "Adds the specified number to the food exhaustion. Only positive numbers expected." },
- CalcLevelFromXp = { Params = "XPAmount", Return = "number", Notes = "(STATIC) Returns the level which is reached with the specified amount of XP. Inverse of XpForLevel()." },
- CanFly = { Return = "bool", Notes = "Returns if the player is able to fly." },
- CloseWindow = { Params = "[CanRefuse]", Return = "", Notes = "Closes the currently open UI window. If CanRefuse is true (default), the window may refuse the closing." },
- CloseWindowIfID = { Params = "WindowID, [CanRefuse]", Return = "", Notes = "Closes the currently open UI window if its ID matches the given ID. If CanRefuse is true (default), the window may refuse the closing." },
- DeltaExperience = { Params = "DeltaXP", Return = "", Notes = "Adds or removes XP from the current XP amount. Won't allow XP to go negative. Returns the new experience, -1 on error (XP overflow)." },
- Feed = { Params = "AddFood, AddSaturation", Return = "bool", Notes = "Tries to add the specified amounts to food level and food saturation level (only positive amounts expected). Returns true if player was hungry and the food was consumed, false if too satiated." },
- FoodPoison = { Params = "NumTicks", Return = "", Notes = "Starts the food poisoning for the specified amount of ticks; if already foodpoisoned, sets FoodPoisonedTicksRemaining to the larger of the two" },
- ForceSetSpeed = { Params = "{{Vector3d|Direction}}", Notes = "Forces the player to move to the given direction." },
- GetClientHandle = { Params = "", Return = "{{cClientHandle}}", Notes = "Returns the client handle representing the player's connection. May be nil (AI players)." },
- GetColor = { Return = "string", Notes = "Returns the full color code to be used for this player's messages (based on their rank). Prefix player messages with this code." },
- GetCurrentXp = { Params = "", Return = "number", Notes = "Returns the current amount of XP" },
- GetCustomName = { Params = "", Return = "string", Notes = "Returns the custom name of this player. If the player hasn't a custom name, it will return an empty string." },
- GetEffectiveGameMode = { Params = "", Return = "{{Globals#GameMode|GameMode}}", Notes = "(OBSOLETE) Returns the current resolved game mode of the player. If the player is set to inherit the world's gamemode, returns that instead. See also GetGameMode() and IsGameModeXXX() functions. Note that this function is the same as GetGameMode(), use that function instead." },
- GetEquippedItem = { Params = "", Return = "{{cItem}}", Notes = "Returns the item that the player is currently holding; empty item if holding nothing." },
- GetEyeHeight = { Return = "number", Notes = "Returns the height of the player's eyes, in absolute coords" },
- GetEyePosition = { Return = "{{Vector3d|EyePositionVector}}", Notes = "Returns the position of the player's eyes, as a {{Vector3d}}" },
- GetFloaterID = { Params = "", Return = "number", Notes = "Returns the Entity ID of the fishing hook floater that belongs to the player. Returns -1 if no floater is associated with the player. FIXME: Undefined behavior when the player has used multiple fishing rods simultanously." },
- GetFlyingMaxSpeed = { Params = "", Return = "number", Notes = "Returns the maximum flying speed, relative to the default game flying speed. Defaults to 1, but plugins may modify it for faster or slower flying." },
- GetFoodExhaustionLevel = { Params = "", Return = "number", Notes = "Returns the food exhaustion level" },
- GetFoodLevel = { Params = "", Return = "number", Notes = "Returns the food level (number of half-drumsticks on-screen)" },
- GetFoodPoisonedTicksRemaining = { Params = "", Return = "", Notes = "Returns the number of ticks left for the food posoning effect" },
- GetFoodSaturationLevel = { Params = "", Return = "number", Notes = "Returns the food saturation (overcharge of the food level, is depleted before food level)" },
- GetFoodTickTimer = { Params = "", Return = "", Notes = "Returns the number of ticks past the last food-based heal or damage action; when this timer reaches 80, a new heal / damage is applied." },
- GetGameMode = { Return = "{{Globals#GameMode|GameMode}}", Notes = "Returns the player's gamemode. The player may have their gamemode unassigned, in which case they inherit the gamemode from the current {{cWorld|world}}.<br /> <b>NOTE:</b> Instead of comparing the value returned by this function to the gmXXX constants, use the IsGameModeXXX() functions. These functions handle the gamemode inheritance automatically."},
- GetIP = { Return = "string", Notes = "Returns the IP address of the player, if available. Returns an empty string if there's no IP to report."},
- GetInventory = { Return = "{{cInventory|Inventory}}", Notes = "Returns the player's inventory"},
- GetLastBedPos = { Params = "", Return = "{{Vector3i}}", Notes = "Returns the position of the last bed the player has slept in, or the world's spawn if no such position was recorded." },
- GetMaxSpeed = { Params = "", Return = "number", Notes = "Returns the player's current maximum speed, relative to the game default speed. Takes into account the sprinting / flying status." },
- GetName = { Return = "string", Notes = "Returns the player's name" },
- GetNormalMaxSpeed = { Params = "", Return = "number", Notes = "Returns the player's maximum walking speed, relative to the game default speed. Defaults to 1, but plugins may modify it for faster or slower walking." },
- GetPermissions = { Params = "", Return = "array-table of strings", Notes = "Returns the list of all permissions that the player has assigned to them through their rank." },
- GetPlayerListName = { Return = "string", Notes = "Returns the name that is used in the playerlist." },
- GetResolvedPermissions = { Return = "array-table of string", Notes = "Returns all the player's permissions, as a table. The permissions are stored in the array part of the table, beginning with index 1." },
- GetSprintingMaxSpeed = { Params = "", Return = "number", Notes = "Returns the player's maximum sprinting speed, relative to the game default speed. Defaults to 1.3, but plugins may modify it for faster or slower sprinting." },
- GetStance = { Return = "number", Notes = "Returns the player's stance (Y-pos of player's eyes)" },
- GetTeam = { Params = "", Return = "{{cTeam}}", Notes = "Returns the team that the player belongs to, or nil if none." },
- GetThrowSpeed = { Params = "SpeedCoeff", Return = "{{Vector3d}}", Notes = "Returns the speed vector for an object thrown with the specified speed coeff. Basically returns the normalized look vector multiplied by the coeff, with a slight random variation." },
- GetThrowStartPos = { Params = "", Return = "{{Vector3d}}", Notes = "Returns the position where the projectiles should start when thrown by this player." },
- GetUUID = { Params = "", Return = "string", Notes = "Returns the (short) UUID that the player is using. Could be empty string for players that don't have a Mojang account assigned to them (in the future, bots for example)." },
- GetWindow = { Params = "", Return = "{{cWindow}}", Notes = "Returns the currently open UI window. If the player doesn't have any UI window open, returns the inventory window." },
- GetXpLevel = { Params = "", Return = "number", Notes = "Returns the current XP level (based on current XP amount)." },
- GetXpLifetimeTotal = { Params = "", Return = "number", Notes = "Returns the amount of XP that has been accumulated throughout the player's lifetime." },
- GetXpPercentage = { Params = "", Return = "number", Notes = "Returns the percentage of the experience bar - the amount of XP towards the next XP level. Between 0 and 1." },
- HasCustomName = { Params = "", Return = "bool", Notes = "Returns true if the player has a custom name." },
- HasPermission = { Params = "PermissionString", Return = "bool", Notes = "Returns true if the player has the specified permission" },
- Heal = { Params = "HitPoints", Return = "", Notes = "Heals the player by the specified amount of HPs. Only positive amounts are expected. Sends a health update to the client." },
- IsEating = { Params = "", Return = "bool", Notes = "Returns true if the player is currently eating the item in their hand." },
- IsFishing = { Params = "", Return = "bool", Notes = "Returns true if the player is currently fishing" },
- IsFlying = { Return = "bool", Notes = "Returns true if the player is flying." },
- IsGameModeAdventure = { Params = "", Return = "bool", Notes = "Returns true if the player is in the gmAdventure gamemode, or has their gamemode unset and the world is a gmAdventure world." },
- IsGameModeCreative = { Params = "", Return = "bool", Notes = "Returns true if the player is in the gmCreative gamemode, or has their gamemode unset and the world is a gmCreative world." },
- IsGameModeSpectator = { Params = "", Return = "bool", Notes = "Returns true if the player is in the gmSpectator gamemode, or has their gamemode unset and the world is a gmSpectator world." },
- IsGameModeSurvival = { Params = "", Return = "bool", Notes = "Returns true if the player is in the gmSurvival gamemode, or has their gamemode unset and the world is a gmSurvival world." },
- IsInBed = { Params = "", Return = "bool", Notes = "Returns true if the player is currently lying in a bed." },
- IsSatiated = { Params = "", Return = "bool", Notes = "Returns true if the player is satiated (cannot eat)." },
- IsVisible = { Params = "", Return = "bool", Notes = "Returns true if the player is visible to other players" },
- LoadRank = { Params = "", Return = "", Notes = "Reloads the player's rank, message visuals and permissions from the {{cRankManager}}, based on the player's current rank." },
- MoveTo = { Params = "{{Vector3d|NewPosition}}", Return = "Tries to move the player into the specified position." },
- MoveToWorld = { Params = "WorldName", Return = "bool", Return = "Moves the player to the specified world. Returns true if successful." },
- OpenWindow = { Params = "{{cWindow|Window}}", Return = "", Notes = "Opens the specified UI window for the player." },
- PermissionMatches = { Params = "Permission, Template", Return = "bool", Notes = "(STATIC) Returns true if the specified permission matches the specified template. The template may contain wildcards." },
- PlaceBlock = { Params = "BlockX, BlockY, BlockZ, BlockType, BlockMeta", Return = "bool", Notes = "Places a block while impersonating the player. The {{OnPlayerPlacingBlock|HOOK_PLAYER_PLACING_BLOCK}} hook is called before the placement, and if it succeeds, the block is placed and the {{OnPlayerPlacedBlock|HOOK_PLAYER_PLACED_BLOCK}} hook is called. Returns true iff the block is successfully placed. Assumes that the block is in a currently loaded chunk." },
- Respawn = { Params = "", Return = "", Notes = "Restores the health, extinguishes fire, makes visible and sends the Respawn packet." },
- SendBlocksAround = { Params = "BlockX, BlockY, BlockZ, [Range]", Return = "", Notes = "Sends all the world's blocks in Range from the specified coords to the player, as a BlockChange packet. Range defaults to 1 (only one block sent)." },
- SendMessage = { Params = "Message", Return = "", Notes = "Sends the specified message to the player." },
- SendMessageFailure = { Params = "Message", Return = "", Notes = "Prepends Rose [INFO] / colours entire text (depending on ShouldUseChatPrefixes()) and sends message to player. For a command that failed to run because of insufficient permissions, etc." },
- SendMessageFatal = { Params = "Message", Return = "", Notes = "Prepends Red [FATAL] / colours entire text (depending on ShouldUseChatPrefixes()) and sends message to player. For something serious, such as a plugin crash, etc." },
- SendMessageInfo = { Params = "Message", Return = "", Notes = "Prepends Yellow [INFO] / colours entire text (depending on ShouldUseChatPrefixes()) and sends message to player. Informational message, such as command usage, etc." },
- SendMessagePrivateMsg = { Params = "Message, SenderName", Return = "", Notes = "Prepends Light Blue [MSG: *SenderName*] / prepends SenderName and colours entire text (depending on ShouldUseChatPrefixes()) and sends message to player. For private messaging." },
- SendMessageSuccess = { Params = "Message", Return = "", Notes = "Prepends Green [INFO] / colours entire text (depending on ShouldUseChatPrefixes()) and sends message to player. Success notification." },
- SendMessageWarning = { Params = "Message, Sender", Return = "", Notes = "Prepends Rose [WARN] / colours entire text (depending on ShouldUseChatPrefixes()) and sends message to player. Denotes that something concerning, such as plugin reload, is about to happen." },
- SendAboveActionBarMessage = { Params = "Message", Return = "", Notes = "Sends the specified message to the player (shows above action bar, doesn't show for < 1.8 clients)." },
- SendSystemMessage = { Params = "Message", Return = "", Notes = "Sends the specified message to the player (doesn't show for < 1.8 clients)." },
- SendRotation = { Params = "YawDegrees, PitchDegrees", Return = "", Notes = "Sends the specified rotation to the player, forcing them to look that way" },
- SetBedPos = { Params = "{{Vector3i|Position}}", Return = "", Notes = "Sets the internal representation of the last bed position the player has slept in. The player will respawn at this position if they die." },
- SetCanFly = { Params = "CanFly", Notes = "Sets if the player can fly or not." },
- SetCrouch = { Params = "IsCrouched", Return = "", Notes = "Sets the crouch state, broadcasts the change to other players." },
- SetCurrentExperience = { Params = "XPAmount", Return = "", Notes = "Sets the current amount of experience (and indirectly, the XP level)." },
- SetCustomName = { Params = "string", Return = "", Notes = "Sets the custom name of this player. If you want to disable the custom name, simply set an empty string. The custom name will be used in the tab-list, in the player nametag and in the tab-completion." },
- SetFlying = { Params = "IsFlying", Notes = "Sets if the player is flying or not." },
- SetFlyingMaxSpeed = { Params = "FlyingMaxSpeed", Return = "", Notes = "Sets the flying maximum speed, relative to the game default speed. The default value is 1. Sends the updated speed to the client." },
- SetFoodExhaustionLevel = { Params = "ExhaustionLevel", Return = "", Notes = "Sets the food exhaustion to the specified level." },
- SetFoodLevel = { Params = "FoodLevel", Return = "", Notes = "Sets the food level (number of half-drumsticks on-screen)" },
- SetFoodPoisonedTicksRemaining = { Params = "FoodPoisonedTicksRemaining", Return = "", Notes = "Sets the number of ticks remaining for food poisoning. Doesn't send foodpoisoning effect to the client, use FoodPoison() for that." },
- SetFoodSaturationLevel = { Params = "FoodSaturationLevel", Return = "", Notes = "Sets the food saturation (overcharge of the food level)." },
- SetFoodTickTimer = { Params = "FoodTickTimer", Return = "", Notes = "Sets the number of ticks past the last food-based heal or damage action; when this timer reaches 80, a new heal / damage is applied." },
- SetGameMode = { Params = "{{Globals#GameMode|NewGameMode}}", Return = "", Notes = "Sets the gamemode for the player. The new gamemode overrides the world's default gamemode, unless it is set to gmInherit." },
- SetIsFishing = { Params = "IsFishing, [FloaterEntityID]", Return = "", Notes = "Sets the 'IsFishing' flag for the player. The floater entity ID is expected for the true variant, it can be omitted when IsFishing is false. FIXME: Undefined behavior when multiple fishing rods are used simultanously" },
- SetName = { Params = "Name", Return = "", Notes = "Sets the player name. This rename will NOT be visible to any players already in the server who are close enough to see this player." },
- SetNormalMaxSpeed = { Params = "NormalMaxSpeed", Return = "", Notes = "Sets the normal (walking) maximum speed, relative to the game default speed. The default value is 1. Sends the updated speed to the client, if appropriate." },
- SetSprint = { Params = "IsSprinting", Return = "", Notes = "Sets whether the player is sprinting or not." },
- SetSprintingMaxSpeed = { Params = "SprintingMaxSpeed", Return = "", Notes = "Sets the sprinting maximum speed, relative to the game default speed. The default value is 1.3. Sends the updated speed to the client, if appropriate." },
- SetTeam = { Params = "{{cTeam|Team}}", Return = "", Notes = "Moves the player to the specified team." },
- SetVisible = { Params = "IsVisible", Return = "", Notes = "Sets the player visibility to other players" },
- TossEquippedItem = { Params = "[Amount]", Return = "", Notes = "Tosses the item that the player has selected in their hotbar. Amount defaults to 1." },
- TossHeldItem = { Params = "[Amount]", Return = "", Notes = "Tosses the item held by the cursor, then the player is in a UI window. Amount defaults to 1." },
- TossPickup = { Params = "{{cItem|Item}}", Return = "", Notes = "Tosses a pickup newly created from the specified item." },
- XpForLevel = { Params = "XPLevel", Return = "number", Notes = "(STATIC) Returns the total amount of XP needed for the specified XP level. Inverse of CalcLevelFromXp()." },
- },
- Constants =
- {
- EATING_TICKS = { Notes = "Number of ticks required for consuming an item." },
- MAX_FOOD_LEVEL = { Notes = "The maximum food level value. When the food level is at this value, the player cannot eat." },
- MAX_HEALTH = { Notes = "The maximum health value" },
- },
- Inherits = "cPawn",
- }, -- cPlayer
-
- cRankManager =
- {
- Desc = [[
- Manages the players' permissions. The players are assigned a single rank, which contains groups of
- permissions. The functions in this class query or modify these.</p>
- <p>
- All the functions are static, call them using the <code>cRankManager:Function()</code> convention.</p>
- <p>
- The players are identified by their UUID, to support player renaming.</p>
- <p>
- The rank also contains specific "mesage visuals" - bits that are used for formatting messages from the
- players. There's a message prefix, which is put in front of every message the player sends, and the
- message suffix that is appended to each message. There's also a PlayerNameColorCode, which holds the
- color that is used for the player's name in the messages.</p>
- <p>
- Each rank can contain any number of permission groups. These groups allow for an easier setup of the
- permissions - you can share groups among ranks, so the usual approach is to group similar permissions
- together and add that group to any rank that should use those permissions.</p>
- <p>
- Permissions are added to individual groups. Each group can support unlimited permissions. Note that
- adding a permission to a group will make the permission available to all the ranks that contain that
- permission group.</p>
- <p>
- One rank is reserved as the Default rank. All players that don't have an explicit rank assigned to them
- will behave as if assigned to this rank. The default rank can be changed to any other rank at any time.
- Note that the default rank cannot be removed from the RankManager - RemoveRank() will change the default
- rank to the replacement rank, if specified, and fail if no replacement rank is specified. Renaming the
- default rank using RenameRank() will change the default rank to the new name.
- ]],
- Functions =
- {
- AddGroup = { Params = "GroupName", Return = "", Notes = "Adds the group of the specified name. Logs a warning and does nothing if the group already exists." },
- AddGroupToRank = { Params = "GroupName, RankName", Return = "bool", Notes = "Adds the specified group to the specified rank. Returns true on success, false on failure - if the group name or the rank name is not found." },
- AddPermissionToGroup = { Params = "Permission, GroupName", Return = "bool", Notes = "Adds the specified permission to the specified group. Returns true on success, false on failure - if the group name is not found." },
- AddRank = { Params = "RankName, MsgPrefix, MsgSuffix, MsgNameColorCode", Return = "", Notes = "Adds a new rank of the specified name and with the specified message visuals. Logs an info message and does nothing if the rank already exists." },
- ClearPlayerRanks = { Params = "", Return = "", Notes = "Removes all player ranks from the database. Note that this doesn't change the cPlayer instances for the already connected players, you need to update all the instances manually." },
- GetAllGroups = { Params = "", Return = "array-table of groups' names", Notes = "Returns an array-table containing the names of all the groups that are known to the manager." },
- GetAllPermissions = { Params = "", Return = "array-table of permissions", Notes = "Returns an array-table containing all the permissions that are known to the manager." },
- GetAllPlayerUUIDs = { Params = "", Return = "array-table of uuids", Notes = "Returns the short uuids of all players stored in the rank DB, sorted by the players' names (case insensitive)." },
- GetAllRanks = { Params = "", Return = "array-table of ranks' names", Notes = "Returns an array-table containing the names of all the ranks that are known to the manager." },
- GetDefaultRank = { Params = "", Return = "string", Notes = "Returns the name of the default rank. " },
- GetGroupPermissions = { Params = "GroupName", Return = "array-table of permissions", Notes = "Returns an array-table containing the permissions that the specified group contains." },
- GetPlayerGroups = { Params = "PlayerUUID", Return = "array-table of groups' names", Notes = "Returns an array-table of the names of the groups that are assigned to the specified player through their rank. Returns an empty table if the player is not known or has no rank or groups assigned to them." },
- GetPlayerMsgVisuals = { Params = "PlayerUUID", Return = "MsgPrefix, MsgSuffix, MsgNameColorCode", Notes = "Returns the message visuals assigned to the player. If the player is not explicitly assigned a rank, the default rank's visuals are returned. If there is an error, no value is returned at all." },
- GetPlayerPermissions = { Params = "PlayerUUID", Return = "array-table of permissions", Notes = "Returns the permissions that the specified player is assigned through their rank. Returns the default rank's permissions if the player has no explicit rank assigned to them. Returns an empty array on error." },
- GetPlayerRankName = { Params = "PlayerUUID", Return = "RankName", Notes = "Returns the name of the rank that is assigned to the specified player. An empty string (NOT the default rank) is returned if the player has no rank assigned to them." },
- GetPlayerName = { Params = "PlayerUUID", Return = "PlayerName", Notes = "Returns the last name that the specified player has, for a player in the ranks database. An empty string is returned if the player isn't in the database." },
- GetRankGroups = { Params = "RankName", Return = "array-table of groups' names", Notes = "Returns an array-table of the names of all the groups that are assigned to the specified rank. Returns an empty table if there is no such rank." },
- GetRankPermissions = { Params = "RankName", Return = "array-table of permissions", Notes = "Returns an array-table of all the permissions that are assigned to the specified rank through its groups. Returns an empty table if there is no such rank." },
- GetRankVisuals = { Params = "RankName", Return = "MsgPrefix, MsgSuffix, MsgNameColorCode", Notes = "Returns the message visuals for the specified rank. Returns no value if the specified rank does not exist." },
- GroupExists = { Params = "GroupName", Return = "bool", Notes = "Returns true iff the specified group exists." },
- IsGroupInRank = { Params = "GroupName, RankName", Return = "bool", Notes = "Returns true iff the specified group is assigned to the specified rank." },
- IsPermissionInGroup = { Params = "Permission, GroupName", Return = "bool", Notes = "Returns true iff the specified permission is assigned to the specified group." },
- IsPlayerRankSet = { Params = "PlayerUUID", Return = "bool", Notes = "Returns true iff the specified player has a rank assigned to them." },
- RankExists = { Params = "RankName", Return = "bool", Notes = "Returns true iff the specified rank exists." },
- RemoveGroup = { Params = "GroupName", Return = "", Notes = "Removes the specified group completely. The group will be removed from all the ranks using it and then erased from the manager. Logs an info message and does nothing if the group doesn't exist." },
- RemoveGroupFromRank = { Params = "GroupName, RankName", Return = "", Notes = "Removes the specified group from the specified rank. The group will still exist, even if it isn't assigned to any rank. Logs an info message and does nothing if the group or rank doesn't exist." },
- RemovePermissionFromGroup = { Params = "Permission, GroupName", Return = "", Notes = "Removes the specified permission from the specified group. Logs an info message and does nothing if the group doesn't exist." },
- RemovePlayerRank = { Params = "PlayerUUID", Return = "", Notes = "Removes the player's rank; the player's left without a rank. Note that this doesn't change the {{cPlayer}} instances for the already connected players, you need to update all the instances manually. No action if the player has no rank assigned to them already." },
- RemoveRank = { Params = "RankName, [ReplacementRankName]", Return = "", Notes = "Removes the specified rank. If ReplacementRankName is given, the players that have RankName will get their rank set to ReplacementRankName. If it isn't given, or is an invalid rank, the players will be removed from the manager, their ranks will be unset completely. Logs an info message and does nothing if the rank is not found." },
- RenameGroup = { Params = "OldName, NewName", Return = "", Notes = "Renames the specified group. Logs an info message and does nothing if the group is not found or the new name is already used." },
- RenameRank = { Params = "OldName, NewName", Return = "", Notes = "Renames the specified rank. Logs an info message and does nothing if the rank is not found or the new name is already used." },
- SetDefaultRank = { Params = "RankName", Return = "bool", Notes = "Sets the specified rank as the default rank. Returns true on success, false on failure (rank doesn't exist)." },
- SetPlayerRank = { Params = "PlayerUUID, PlayerName, RankName", Return = "", Notes = "Updates the rank for the specified player. The player name is provided for reference, the UUID is used for identification. Logs a warning and does nothing if the rank is not found." },
- SetRankVisuals = { Params = "RankName, MsgPrefix, MsgSuffix, MsgNameColorCode", Return = "", Notes = "Updates the rank's message visuals. Logs an info message and does nothing if rank not found." },
- },
- }, -- cRankManager
-
- cRoot =
- {
- Desc = [[
- This class represents the root of Cuberite's object hierarchy. There is always only one cRoot
- object. It manages and allows querying all the other objects, such as {{cServer}},
- {{cPluginManager}}, individual {{cWorld|worlds}} etc.</p>
- <p>
- To get the singleton instance of this object, you call the cRoot:Get() function. Then you can call
- the individual functions on this object. Note that some of the functions are static and don't need
- the instance, they are to be called directly on the cRoot class, such as cRoot:GetPhysicalRAMUsage()
- ]],
- Functions =
- {
- BroadcastChat =
- {
- { Params = "MessageText, MessageType", Return = "", Notes = "Broadcasts a message to all players, with its message type set to MessageType (default: mtCustom)." },
- { Params = "{{cCompositeChat|CompositeChat}}", Return = "", Notes = "Broadcasts a {{cCompositeChat|composite chat message}} to all players." },
- },
- BroadcastChatDeath = { Params = "MessageText", Return = "", Notes = "Broadcasts the specified message to all players, with its message type set to mtDeath. Use for when a player has died." },
- BroadcastChatFailure = { Params = "MessageText", Return = "", Notes = "Broadcasts the specified message to all players, with its message type set to mtFailure. Use for a command that failed to run because of insufficient permissions, etc." },
- BroadcastChatFatal = { Params = "MessageText", Return = "", Notes = "Broadcasts the specified message to all players, with its message type set to mtFatal. Use for a plugin that crashed, or similar." },
- BroadcastChatInfo = { Params = "MessageText", Return = "", Notes = "Broadcasts the specified message to all players, with its message type set to mtInfo. Use for informational messages, such as command usage." },
- BroadcastChatJoin = { Params = "MessageText", Return = "", Notes = "Broadcasts the specified message to all players, with its message type set to mtJoin. Use for players joining the server." },
- BroadcastChatLeave = { Params = "MessageText", Return = "", Notes = "Broadcasts the specified message to all players, with its message type set to mtLeave. Use for players leaving the server." },
- BroadcastChatSuccess = { Params = "MessageText", Return = "", Notes = "Broadcasts the specified message to all players, with its message type set to mtSuccess. Use for success messages." },
- BroadcastChatWarning = { Params = "MessageText", Return = "", Notes = "Broadcasts the specified message to all players, with its message type set to mtWarning. Use for concerning events, such as plugin reload etc." },
- CreateAndInitializeWorld = { Params = "WorldName", Return = "{{cWorld|cWorld}}", Notes = "Creates a new world and initializes it. If there is a world whith the same name it returns nil.<br><br><b>NOTE:</b> This function is currently unsafe, do not use!" },
- FindAndDoWithPlayer = { Params = "PlayerName, CallbackFunction", Return = "bool", Notes = "Calls the given callback function for the player with the name best matching the name string provided.<br>This function is case-insensitive and will match partial names.<br>Returns false if player not found or there is ambiguity, true otherwise. The CallbackFunction has the following signature: <pre class=\"prettyprint lang-lua\">function Callback({{cPlayer|Player}})</pre>" },
- DoWithPlayerByUUID = { Params = "PlayerUUID, CallbackFunction", Return = "bool", Notes = "If there is the player with the uuid, calls the CallbackFunction with the {{cPlayer}} parameter representing the player. The CallbackFunction has the following signature: <pre class=\"prettyprint lang-lua\">function Callback({{cPlayer|Player}})</pre> The function returns false if the player was not found, or whatever bool value the callback returned if the player was found." },
- ForEachPlayer = { Params = "CallbackFunction", Return = "", Notes = "Calls the given callback function for each player. The callback function has the following signature: <pre class=\"prettyprint lang-lua\">function Callback({{cPlayer|cPlayer}})</pre>" },
- ForEachWorld = { Params = "CallbackFunction", Return = "", Notes = "Calls the given callback function for each world. The callback function has the following signature: <pre class=\"prettyprint lang-lua\">function Callback({{cWorld|cWorld}})</pre>" },
- Get = { Params = "", Return = "Root object", Notes = "(STATIC) This function returns the cRoot object." },
- GetBuildCommitID = { Params = "", Return = "string", Notes = "(STATIC) For official builds (Travis CI / Jenkins) it returns the exact commit hash used for the build. For unofficial local builds, returns the approximate commit hash (since the true one cannot be determined), formatted as \"approx: &lt;CommitHash&gt;\"." },
- GetBuildDateTime = { Params = "", Return = "string", Notes = "(STATIC) For official builds (Travic CI / Jenkins) it returns the date and time of the build. For unofficial local builds, returns the approximate datetime of the commit (since the true one cannot be determined), formatted as \"approx: &lt;DateTime-iso8601&gt;\"." },
- GetBuildID = { Params = "", Return = "string", Notes = "(STATIC) For official builds (Travis CI / Jenkins) it returns the unique ID of the build, as recognized by the build system. For unofficial local builds, returns the string \"Unknown\"." },
- GetBuildSeriesName = { Params = "", Return = "string", Notes = "(STATIC) For official builds (Travis CI / Jenkins) it returns the series name of the build (for example \"Cuberite Windows x64 Master\"). For unofficial local builds, returns the string \"local build\"." },
- GetCraftingRecipes = { Params = "", Return = "{{cCraftingRecipe|cCraftingRecipe}}", Notes = "Returns the CraftingRecipes object" },
- GetDefaultWorld = { Params = "", Return = "{{cWorld|cWorld}}", Notes = "Returns the world object from the default world." },
- GetFurnaceFuelBurnTime = { Params = "{{cItem|Fuel}}", Return = "number", Notes = "(STATIC) Returns the number of ticks for how long the item would fuel a furnace. Returns zero if not a fuel." },
- GetFurnaceRecipe = { Params = "{{cItem|InItem}}", Return = "{{cItem|OutItem}}, NumTicks, {{cItem|InItem}}", Notes = "(STATIC) Returns the furnace recipe for smelting the specified input. If a recipe is found, returns the smelted result, the number of ticks required for the smelting operation, and the input consumed (note that Cuberite supports smelting M items into N items and different smelting rates). If no recipe is found, returns no value." },
- GetPhysicalRAMUsage = { Params = "", Return = "number", Notes = "Returns the amount of physical RAM that the entire Cuberite process is using, in KiB. Negative if the OS doesn't support this query." },
- GetPluginManager = { Params = "", Return = "{{cPluginManager|cPluginManager}}", Notes = "Returns the cPluginManager object." },
- GetPrimaryServerVersion = { Params = "", Return = "number", Notes = "Returns the servers primary server version." },
- GetProtocolVersionTextFromInt = { Params = "Protocol Version", Return = "string", Notes = "Returns the Minecraft version from the given Protocol. If there is no version found, it returns 'Unknown protocol(Parameter)'" },
- GetServer = { Params = "", Return = "{{cServer|cServer}}", Notes = "Returns the cServer object." },
- GetServerUpTime = { Params = "", Return = "number", Notes = "Returns the uptime of the server in seconds." },
- GetTotalChunkCount = { Params = "", Return = "number", Notes = "Returns the amount of loaded chunks." },
- GetVirtualRAMUsage = { Params = "", Return = "number", Notes = "Returns the amount of virtual RAM that the entire Cuberite process is using, in KiB. Negative if the OS doesn't support this query." },
- GetWebAdmin = { Params = "", Return = "{{cWebAdmin|cWebAdmin}}", Notes = "Returns the cWebAdmin object." },
- GetWorld = { Params = "WorldName", Return = "{{cWorld|cWorld}}", Notes = "Returns the cWorld object of the given world. It returns nil if there is no world with the given name." },
- QueueExecuteConsoleCommand = { Params = "Message", Return = "", Notes = "Queues a console command for execution through the cServer class. The command will be executed in the tick thread. The command's output will be sent to console." },
- SaveAllChunks = { Params = "", Return = "", Notes = "Saves all the chunks in all the worlds. Note that the saving is queued on each world's tick thread and this functions returns before the chunks are actually saved." },
- SetPrimaryServerVersion = { Params = "Protocol Version", Return = "", Notes = "Sets the servers PrimaryServerVersion to the given protocol number." }
- },
- AdditionalInfo =
- {
- {
- Header = "Querying a furnace recipe",
- Contents = [[
- To find the furnace recipe for an item, use the following code (adapted from the Debuggers plugin's /fr command):
-<pre class="prettyprint lang-lua">
-local HeldItem = a_Player:GetEquippedItem();
-local Out, NumTicks, In = cRoot:GetFurnaceRecipe(HeldItem); -- Note STATIC call - no need for a Get()
-if (Out ~= nil) then
- -- There is a recipe, list it:
- a_Player:SendMessage(
- "Furnace turns " .. ItemToFullString(In) ..
- " to " .. ItemToFullString(Out) ..
- " in " .. NumTicks .. " ticks (" ..
- tostring(NumTicks / 20) .. " seconds)."
- );
-else
- -- No recipe found
- a_Player:SendMessage("There is no furnace recipe that would smelt " .. ItemToString(HeldItem));
-end
-</pre>
- ]],
- },
- },
- }, -- cRoot
-
- cScoreboard =
- {
- Desc = [[
- This class manages the objectives and teams of a single world.
- ]],
- Functions =
- {
- AddPlayerScore = { Params = "Name, Type, Value", Return = "", Notes = "Adds a value to all player scores of the specified objective type." },
- ForEachObjective = { Params = "CallBackFunction", Return = "bool", Notes = "Calls the specified callback for each objective in the scoreboard. Returns true if all objectives have been processed (including when there are zero objectives), or false if the callback function has aborted the enumeration by returning true. The callback function has the following signature: <pre class=\"prettyprint lang-lua\">function Callback({{cObjective|Objective}})</pre> The callback should return false or no value to continue with the next objective, or true to abort the enumeration." },
- ForEachTeam = { Params = "CallBackFunction", Return = "bool", Notes = "Calls the specified callback for each team in the scoreboard. Returns true if all teams have been processed (including when there are zero teams), or false if the callback function has aborted the enumeration by returning true. The callback function has the following signature: <pre class=\"prettyprint lang-lua\">function Callback({{cObjective|Objective}})</pre> The callback should return false or no value to continue with the next team, or true to abort the enumeration." },
- GetNumObjectives = { Params = "", Return = "number", Notes = "Returns the nuber of registered objectives." },
- GetNumTeams = { Params = "", Return = "number", Notes = "Returns the number of registered teams." },
- GetObjective = { Params = "string", Return = "{{cObjective}}", Notes = "Returns the objective with the specified name." },
- GetObjectiveIn = { Params = "DisplaySlot", Return = "{{cObjective}}", Notes = "Returns the objective in the specified display slot. Can be nil." },
- GetTeam = { Params = "string", Return = "{{cTeam}}", Notes = "Returns the team with the specified name." },
- RegisterObjective = { Params = "Name, DisplayName, Type", Return = "{{cObjective}}", Notes = "Registers a new scoreboard objective. Returns the {{cObjective}} instance, nil on error." },
- RegisterTeam = { Params = "Name, DisplayName, Prefix, Suffix", Return = "{{cTeam}}", Notes = "Registers a new team. Returns the {{cTeam}} instance, nil on error." },
- RemoveObjective = { Params = "string", Return = "bool", Notes = "Removes the objective with the specified name. Returns true if operation was successful." },
- RemoveTeam = { Params = "string", Return = "bool", Notes = "Removes the team with the specified name. Returns true if operation was successful." },
- SetDisplay = { Params = "Name, DisplaySlot", Return = "", Notes = "Updates the currently displayed objective." },
- },
- Constants =
- {
- dsCount = { Notes = "" },
- dsList = { Notes = "" },
- dsName = { Notes = "" },
- dsSidebar = { Notes = "" },
- },
- }, -- cScoreboard
-
- cServer =
- {
- Desc = [[
- This class manages all the client connections internally. In the API layer, it allows to get and set
- the general properties of the server, such as the description and max players.</p>
- <p>
- It used to support broadcasting chat messages to all players, this functionality has been moved to
- {{cRoot}}:BroadcastChat().
- ]],
- Functions =
- {
- GetDescription = { Return = "string", Notes = "Returns the server description set in the settings.ini." },
- GetMaxPlayers = { Return = "number", Notes = "Returns the max amount of players who can join the server." },
- GetNumPlayers = { Return = "number", Notes = "Returns the amount of players online." },
- GetServerID = { Return = "string", Notes = "Returns the ID of the server?" },
- IsHardcore = { Params = "", Return = "bool", Notes = "Returns true if the server is hardcore (players get banned on death)." },
- SetMaxPlayers = { Params = "number", Notes = "Sets the max amount of players who can join." },
- ShouldAuthenticate = { Params = "", Return = "bool", Notes = "Returns true iff the server is set to authenticate players (\"online mode\")." },
- },
- }, -- cServer
-
- cStringCompression =
- {
- Desc = [[
- Provides functions to compress or decompress string
- <p>
- All functions in this class are static, so they should be called in the dot convention:
-<pre class="prettyprint lang-lua">
-local CompressedString = cStringCompression.CompressStringGZIP("DataToCompress")
-</pre>
- ]],
-
- Functions =
- {
- CompressStringGZIP = {Params = "string", Return = "string", Notes = "Compress a string using GZIP"},
- CompressStringZLIB = {Params = "string, factor", Return = "string", Notes = "Compresses a string using ZLIB. Factor 0 is no compression and factor 9 is maximum compression"},
- InflateString = {Params = "string", Return = "string", Notes = "Uncompresses a string using Inflate"},
- UncompressStringGZIP = {Params = "string", Return = "string", Notes = "Uncompress a string using GZIP"},
- UncompressStringZLIB = {Params = "string, uncompressed length", Return = "string", Notes = "Uncompresses a string using ZLIB"},
- },
- },
-
- cTeam =
- {
- Desc = [[
- This class manages a single player team.
- ]],
- Functions =
- {
- AddPlayer = { Params = "string", Returns = "bool", Notes = "Adds a player to this team. Returns true if the operation was successful." },
- AllowsFriendlyFire = { Params = "", Return = "bool", Notes = "Returns whether team friendly fire is allowed." },
- CanSeeFriendlyInvisible = { Params = "", Return = "bool", Notes = "Returns whether players can see invisible teammates." },
- HasPlayer = { Params = "string", Returns = "bool", Notes = "Returns whether the specified player is a member of this team." },
- GetDisplayName = { Params = "", Return = "string", Notes = "Returns the display name of the team." },
- GetName = { Params = "", Return = "string", Notes = "Returns the internal name of the team." },
- GetNumPlayers = { Params = "", Return = "number", Notes = "Returns the number of registered players." },
- GetPrefix = { Params = "", Return = "string", Notes = "Returns the prefix prepended to the names of the members of this team." },
- RemovePlayer = { Params = "string", Returns = "bool", Notes = "Removes the player with the specified name from this team. Returns true if the operation was successful." },
- Reset = { Params = "", Returns = "", Notes = "Removes all players from this team." },
- GetSuffix = { Params = "", Return = "string", Notes = "Returns the suffix appended to the names of the members of this team." },
- SetCanSeeFriendlyInvisible = { Params = "bool", Return = "", Notes = "Set whether players can see invisible teammates." },
- SetDisplayName = { Params = "string", Return = "", Notes = "Sets the display name of this team. (i.e. what will be shown to the players)" },
- SetFriendlyFire = { Params = "bool", Return = "", Notes = "Sets whether team friendly fire is allowed." },
- SetPrefix = { Params = "string", Return = "", Notes = "Sets the prefix prepended to the names of the members of this team." },
- SetSuffix = { Params = "string", Return = "", Notes = "Sets the suffix appended to the names of the members of this team." },
- },
- }, -- cTeam
-
- cTNTEntity =
- {
- Desc = "This class manages a TNT entity.",
- Functions =
- {
- Explode = { Return = "", Notes = "Explode the tnt." },
- GetFuseTicks = { Return = "number", Notes = "Returns the fuse ticks until the tnt will explode." },
- SetFuseTicks = { Return = "number", Notes = "Set the fuse ticks until the tnt will explode." },
- },
- Inherits = "cEntity",
- },
-
- cWebPlugin =
- {
- Desc = "",
- Functions = {},
- }, -- cWebPlugin
-
- cWindow =
- {
- Desc = [[
- This class is the common ancestor for all window classes used by Cuberite. It is inherited by the
- {{cLuaWindow|cLuaWindow}} class that plugins use for opening custom windows. It is planned to be
- used for window-related hooks in the future. It implements the basic functionality of any
- window.</p>
- <p>
- Note that one cWindow object can be used for multiple players at the same time, and therefore the
- slot contents are player-specific (e. g. crafting grid, or player inventory). Thus the GetSlot() and
- SetSlot() functions need to have the {{cPlayer|cPlayer}} parameter that specifies the player for
- whom the contents are to be queried.</p>
- <p>
- Windows also have numeric properties, these are used to set the progressbars for furnaces or the XP
- costs for enchantment tables.
- ]],
- Functions =
- {
- GetSlot = { Params = "{{cPlayer|Player}}, SlotNumber", Return = "{{cItem}}", Notes = "Returns the item at the specified slot for the specified player. Returns nil and logs to server console on error." },
- GetWindowID = { Params = "", Return = "number", Notes = "Returns the ID of the window, as used by the network protocol" },
- GetWindowTitle = { Params = "", Return = "string", Notes = "Returns the window title that will be displayed to the player" },
- GetWindowType = { Params = "", Return = "number", Notes = "Returns the type of the window, one of the constants in the table above" },
- IsSlotInPlayerHotbar = { Params = "SlotNum", Return = "bool", Notes = "Returns true if the specified slot number is in the player hotbar" },
- IsSlotInPlayerInventory = { Params = "SlotNum", Return = "bool", Notes = "Returns true if the specified slot number is in the player's main inventory or in the hotbar. Note that this returns false for armor slots!" },
- IsSlotInPlayerMainInventory = { Params = "SlotNum", Return = "bool", Notes = "Returns true if the specified slot number is in the player's main inventory" },
- SetProperty = { Params = "PropertyID, PropartyValue, {{cPlayer|Player}}", Return = "", Notes = "Sends the UpdateWindowProperty (0x69) packet to the specified player; or to all players who are viewing this window if Player is not specified or nil." },
- SetSlot = { Params = "{{cPlayer|Player}}, SlotNum, {{cItem|cItem}}", Return = "", Notes = "Sets the contents of the specified slot for the specified player. Ignored if the slot number is invalid" },
- SetWindowTitle = { Params = "string", Return = "", Notes = "Sets the window title that will be displayed to the player" },
- },
- Constants =
- {
- wtInventory = { Notes = "An inventory window" },
- wtChest = { Notes = "A {{cChestEntity|chest}} or doublechest window" },
- wtWorkbench = { Notes = "A workbench (crafting table) window" },
- wtFurnace = { Notes = "A {{cFurnaceEntity|furnace}} window" },
- wtDropSpenser = { Notes = "A {{cDropperEntity|dropper}} or a {{cDispenserEntity|dispenser}} window" },
- wtEnchantment = { Notes = "An enchantment table window" },
- wtBrewery = { Notes = "A brewing stand window" },
- wtNPCTrade = { Notes = "A villager trade window" },
- wtBeacon = { Notes = "A beacon window" },
- wtAnvil = { Notes = "An anvil window" },
- wtHopper = { Notes = "A {{cHopperEntity|hopper}} window" },
- wtAnimalChest = { Notes = "A horse or donkey window" },
- },
- }, -- cWindow
-
- cWorld =
- {
- Desc = [[
- cWorld is the game world. It is the hub of all the information managed by individual classes,
- providing convenient access to them. Cuberite supports multiple worlds in any combination of
- world types. You can have two overworlds, three nethers etc. To enumerate all world the server
- provides, use the {{cRoot}}:ForEachWorld() function.</p>
- <p>
- The world data is held in individual chunks. Each chunk consists of 16 (x) * 16 (z) * 256 (y)
- blocks, each block is specified by its block type (8-bit) and block metadata (4-bit).
- Additionally, each block has two light values calculated - skylight (how much daylight it receives)
- and blocklight (how much light from light-emissive blocks it receives), both 4-bit.</p>
- <p>
- Each world runs several separate threads used for various housekeeping purposes, the most important
- of those is the Tick thread. This thread updates the game logic 20 times per second, and it is
- the thread where all the gameplay actions are evaluated. Liquid physics, entity interactions,
- player ovement etc., all are applied in this thread.</p>
- <p>
- Additional threads include the generation thread (generates new chunks as needed, storage thread
- (saves and loads chunk from the disk), lighting thread (updates block light values) and the
- chunksender thread (compresses chunks to send to the clients).</p>
- <p>
- The world provides access to all its {{cPlayer|players}}, {{cEntity|entities}} and {{cBlockEntity|block
- entities}}. Because of multithreading issues, individual objects cannot be retrieved for indefinite
- handling, but rather must be modified in callbacks, within which they are guaranteed to stay valid.</p>
- <p>
- Physics for individual blocks are handled by the simulators. These will fire in each tick for all
- blocks that have been scheduled for simulator update ("simulator wakeup"). The simulators include
- liquid physics, falling blocks, fire spreading and extinguishing and redstone.</p>
- <p>
- Game time is also handled by the world. It provides the time-of-day and the total world age.
- ]],
-
- Functions =
- {
- AreCommandBlocksEnabled = { Params = "", Return = "bool", Notes = "Returns whether command blocks are enabled on the (entire) server" },
- BroadcastBlockAction = { Params = "BlockX, BlockY, BlockZ, ActionByte1, ActionByte2, BlockType, [{{cClientHandle|ExcludeClient}}]", Return = "", Notes = "Broadcasts the BlockAction packet to all clients who have the appropriate chunk loaded (except ExcludeClient). The contents of the packet are specified by the parameters for the call, the blocktype needn't match the actual block that is present in the world data at the specified location." },
- BroadcastChat = { Params = "Message, [{{cClientHandle|ExcludeClient}}]", Return = "", Notes = "Sends the Message to all players in this world, except the optional ExcludeClient. No formatting is done by the server." },
- BroadcastChatDeath = { Params = "Message, [{{cClientHandle|ExcludeClient}}]", Return = "", Notes = "Prepends Gray [DEATH] / colours entire text (depending on ShouldUseChatPrefixes()) and broadcasts message. For when a player dies." },
- BroadcastChatFailure = { Params = "Message, [{{cClientHandle|ExcludeClient}}]", Return = "", Notes = "Prepends Rose [INFO] / colours entire text (depending on ShouldUseChatPrefixes()) and broadcasts message. For a command that failed to run because of insufficient permissions, etc." },
- BroadcastChatFatal = { Params = "Message, [{{cClientHandle|ExcludeClient}}]", Return = "", Notes = "Prepends Red [FATAL] / colours entire text (depending on ShouldUseChatPrefixes()) and broadcasts message. For a plugin that crashed, or similar." },
- BroadcastChatInfo = { Params = "Message, [{{cClientHandle|ExcludeClient}}]", Return = "", Notes = "Prepends Yellow [INFO] / colours entire text (depending on ShouldUseChatPrefixes()) and broadcasts message. For informational messages, such as command usage." },
- BroadcastChatSuccess = { Params = "Message, [{{cClientHandle|ExcludeClient}}]", Return = "", Notes = "Prepends Green [INFO] / colours entire text (depending on ShouldUseChatPrefixes()) and broadcasts message. For success messages." },
- BroadcastChatWarning = { Params = "Message, [{{cClientHandle|ExcludeClient}}]", Return = "", Notes = "Prepends Rose [WARN] / colours entire text (depending on ShouldUseChatPrefixes()) and broadcasts message. For concerning events, such as plugin reload etc." },
- BroadcastEntityAnimation = { Params = "{{cEntity|TargetEntity}}, Animation, [{{cClientHandle|ExcludeClient}}]", Return = "", Notes = "Sends an animation of an entity to all clienthandles (except ExcludeClient if given)" },
- BroadcastParticleEffect = { Params = "ParticleName, X, Y, Z, OffSetX, OffSetY, OffSetZ, ParticleData, ParticleAmmount, [{{cClientHandle|ExcludeClient}}]", Return = "", Notes = "Spawns the specified particles to all players in the world exept the optional ExeptClient. A list of available particles by thinkofdeath can be found {{https://gist.github.com/thinkofdeath/5110835|Here}}" },
- BroadcastSoundEffect = { Params = "SoundName, X, Y, Z, Volume, Pitch, [{{cClientHandle|ExcludeClient}}]", Return = "", Notes = "Sends the specified sound effect to all players in this world, except the optional ExceptClient" },
- BroadcastSoundParticleEffect = { Params = "EffectID, X, Y, Z, EffectData, [{{cClientHandle|ExcludeClient}}]", Return = "", Notes = "Sends the specified effect to all players in this world, except the optional ExceptClient" },
- CastThunderbolt = { Params = "X, Y, Z", Return = "", Notes = "Creates a thunderbolt at the specified coords" },
- ChangeWeather = { Params = "", Return = "", Notes = "Forces the weather to change in the next game tick. Weather is changed according to the normal rules: wSunny <-> wRain <-> wStorm" },
- ChunkStay = { Params = "ChunkCoordTable, OnChunkAvailable, OnAllChunksAvailable", Return = "", Notes = "Queues the specified chunks to be loaded or generated and calls the specified callbacks once they are loaded. ChunkCoordTable is an arra-table of chunk coords, each coord being a table of 2 numbers: { {Chunk1x, Chunk1z}, {Chunk2x, Chunk2z}, ...}. When any of those chunks are made available (including being available at the start of this call), the OnChunkAvailable() callback is called. When all the chunks are available, the OnAllChunksAvailable() callback is called. The function signatures are: <pre class=\"prettyprint lang-lua\">function OnChunkAvailable(ChunkX, ChunkZ)\nfunction OnAllChunksAvailable()</pre> All return values from the callbacks are ignored." },
- CreateProjectile = { Params = "X, Y, Z, {{cProjectileEntity|ProjectileKind}}, {{cEntity|Creator}}, {{cItem|Originating Item}}, [{{Vector3d|Speed}}]", Return = "", Notes = "Creates a new projectile of the specified kind at the specified coords. The projectile's creator is set to Creator (may be nil). The item that created the projectile entity, commonly the {{cPlayer|player}}'s currently equipped item, is used at present for fireworks to correctly set their entity metadata. It is not used for any other projectile. Optional speed indicates the initial speed for the projectile." },
- DigBlock = { Params = "X, Y, Z", Return = "", Notes = "Replaces the specified block with air, without dropping the usual pickups for the block. Wakes up the simulators for the block and its neighbors." },
- DoExplosionAt = { Params = "Force, X, Y, Z, CanCauseFire, Source, SourceData", Return = "", Notes = "Creates an explosion of the specified relative force in the specified position. If CanCauseFire is set, the explosion will set blocks on fire, too. The Source parameter specifies the source of the explosion, one of the esXXX constants. The SourceData parameter is specific to each source type, usually it provides more info about the source." },
- DoWithBlockEntityAt = { Params = "BlockX, BlockY, BlockZ, CallbackFunction", Return = "bool", Notes = "If there is a block entity at the specified coords, calls the CallbackFunction with the {{cBlockEntity}} parameter representing the block entity. The CallbackFunction has the following signature: <pre class=\"prettyprint lang-lua\">function Callback({{cBlockEntity|BlockEntity}})</pre> The function returns false if there is no block entity, or if there is, it returns the bool value that the callback has returned. Use {{tolua}}.cast() to cast the Callback's BlockEntity parameter to the correct {{cBlockEntity}} descendant." },
- DoWithBeaconAt = { Params = "BlockX, BlockY, BlockZ, CallbackFunction", Return = "bool", Notes = "If there is a beacon at the specified coords, calls the CallbackFunction with the {{cBeaconEntity}} parameter representing the beacon. The CallbackFunction has the following signature: <pre class=\"prettyprint lang-lua\">function Callback({{cBeaconEntity|BeaconEntity}})</pre> The function returns false if there is no beacon, or if there is, it returns the bool value that the callback has returned." },
- DoWithChestAt = { Params = "BlockX, BlockY, BlockZ, CallbackFunction", Return = "bool", Notes = "If there is a chest at the specified coords, calls the CallbackFunction with the {{cChestEntity}} parameter representing the chest. The CallbackFunction has the following signature: <pre class=\"prettyprint lang-lua\">function Callback({{cChestEntity|ChestEntity}})</pre> The function returns false if there is no chest, or if there is, it returns the bool value that the callback has returned." },
- DoWithCommandBlockAt = { Params = "BlockX, BlockY, BlockZ, CallbackFunction", Return = "bool", Notes = "If there is a command block at the specified coords, calls the CallbackFunction with the {{cCommandBlockEntity}} parameter representing the command block. The CallbackFunction has the following signature: <pre class=\"prettyprint lang-lua\">function Callback({{cCommandBlockEntity|CommandBlockEntity}})</pre> The function returns false if there is no command block, or if there is, it returns the bool value that the callback has returned." },
- DoWithDispenserAt = { Params = "BlockX, BlockY, BlockZ, CallbackFunction", Return = "bool", Notes = "If there is a dispenser at the specified coords, calls the CallbackFunction with the {{cDispenserEntity}} parameter representing the dispenser. The CallbackFunction has the following signature: <pre class=\"prettyprint lang-lua\">function Callback({{cDispenserEntity|DispenserEntity}})</pre> The function returns false if there is no dispenser, or if there is, it returns the bool value that the callback has returned." },
- DoWithDropSpenserAt = { Params = "BlockX, BlockY, BlockZ, CallbackFunction", Return = "bool", Notes = "If there is a dropper or a dispenser at the specified coords, calls the CallbackFunction with the {{cDropSpenserEntity}} parameter representing the dropper or dispenser. The CallbackFunction has the following signature: <pre class=\"prettyprint lang-lua\">function Callback({{cDropSpenserEntity|DropSpenserEntity}})</pre> Note that this can be used to access both dispensers and droppers in a similar way. The function returns false if there is neither dispenser nor dropper, or if there is, it returns the bool value that the callback has returned." },
- DoWithDropperAt = { Params = "BlockX, BlockY, BlockZ, CallbackFunction", Return = "bool", Notes = "If there is a dropper at the specified coords, calls the CallbackFunction with the {{cDropperEntity}} parameter representing the dropper. The CallbackFunction has the following signature: <pre class=\"prettyprint lang-lua\">function Callback({{cDropperEntity|DropperEntity}})</pre> The function returns false if there is no dropper, or if there is, it returns the bool value that the callback has returned." },
- DoWithEntityByID = { Params = "EntityID, CallbackFunction", Return = "bool", Notes = "If an entity with the specified ID exists, calls the callback with the {{cEntity}} parameter representing the entity. The CallbackFunction has the following signature: <pre class=\"prettyprint lang-lua\">function Callback({{cEntity|Entity}})</pre> The function returns false if the entity was not found, and it returns the same bool value that the callback has returned if the entity was found." },
- DoWithFlowerPotAt = { Params = "BlockX, BlockY, BlockZ, CallbackFunction", Return = "bool", Notes = "If there is a flower pot at the specified coords, calls the CallbackFunction with the {{cFlowerPotEntity}} parameter representing the flower pot. The CallbackFunction has the following signature: <pre class=\"prettyprint lang-lua\">function Callback({{cFlowerPotEntity|FlowerPotEntity}})</pre> The function returns false if there is no flower pot, or if there is, it returns the bool value that the callback has returned." },
- DoWithFurnaceAt = { Params = "BlockX, BlockY, BlockZ, CallbackFunction", Return = "bool", Notes = "If there is a furnace at the specified coords, calls the CallbackFunction with the {{cFurnaceEntity}} parameter representing the furnace. The CallbackFunction has the following signature: <pre class=\"prettyprint lang-lua\">function Callback({{cFurnaceEntity|FurnaceEntity}})</pre> The function returns false if there is no furnace, or if there is, it returns the bool value that the callback has returned." },
- DoWithMobHeadAt = { Params = "BlockX, BlockY, BlockZ, CallbackFunction", Return = "bool", Notes = "If there is a mob head at the specified coords, calls the CallbackFunction with the {{cMobHeadEntity}} parameter representing the furnace. The CallbackFunction has the following signature: <pre class=\"prettyprint lang-lua\">function Callback({{cMobHeadEntity|MobHeadEntity}})</pre> The function returns false if there is no mob head, or if there is, it returns the bool value that the callback has returned." },
- DoWithNoteBlockAt = { Params = "BlockX, BlockY, BlockZ, CallbackFunction", Return = "bool", Notes = "If there is a note block at the specified coords, calls the CallbackFunction with the {{cNoteEntity}} parameter representing the note block. The CallbackFunction has the following signature: <pre class=\"prettyprint lang-lua\">function Callback({{cNoteEntity|NoteEntity}})</pre> The function returns false if there is no note block, or if there is, it returns the bool value that the callback has returned." },
- DoWithPlayer = { Params = "PlayerName, CallbackFunction", Return = "bool", Notes = "If there is a player of the specified name (exact match), calls the CallbackFunction with the {{cPlayer}} parameter representing the player. The CallbackFunction has the following signature: <pre class=\"prettyprint lang-lua\">function Callback({{cPlayer|Player}})</pre> The function returns false if the player was not found, or whatever bool value the callback returned if the player was found." },
- DoWithPlayerByUUID = { Params = "PlayerUUID, CallbackFunction", Return = "bool", Notes = "If there is the player with the uuid, calls the CallbackFunction with the {{cPlayer}} parameter representing the player. The CallbackFunction has the following signature: <pre class=\"prettyprint lang-lua\">function Callback({{cPlayer|Player}})</pre> The function returns false if the player was not found, or whatever bool value the callback returned if the player was found." },
- FastSetBlock =
- {
- { Params = "BlockX, BlockY, BlockZ, BlockType, BlockMeta", Return = "", Notes = "Sets the block at the specified coords, without waking up the simulators or replacing the block entities for the previous block type. Do not use if the block being replaced has a block entity tied to it!" },
- { Params = "{{Vector3i|BlockCoords}}, BlockType, BlockMeta", Return = "", Notes = "Sets the block at the specified coords, without waking up the simulators or replacing the block entities for the previous block type. Do not use if the block being replaced has a block entity tied to it!" },
- },
- FindAndDoWithPlayer = { Params = "PlayerName, CallbackFunction", Return = "bool", Notes = "Calls the given callback function for the player with the name best matching the name string provided.<br>This function is case-insensitive and will match partial names.<br>Returns false if player not found or there is ambiguity, true otherwise. The CallbackFunction has the following signature: <pre class=\"prettyprint lang-lua\">function Callback({{cPlayer|Player}})</pre>" },
- ForEachBlockEntityInChunk = { Params = "ChunkX, ChunkZ, CallbackFunction", Return = "bool", Notes = "Calls the specified callback for each block entity in the chunk. Returns true if all block entities in the chunk have been processed (including when there are zero block entities), or false if the callback has aborted the enumeration by returning true. The CallbackFunction has the following signature: <pre class=\"prettyprint lang-lua\">function Callback({{cBlockEntity|BlockEntity}})</pre> The callback should return false or no value to continue with the next block entity, or true to abort the enumeration. Use {{tolua}}.cast() to cast the Callback's BlockEntity parameter to the correct {{cBlockEntity}} descendant." },
- ForEachChestInChunk = { Params = "ChunkX, ChunkZ, CallbackFunction", Return = "bool", Notes = "Calls the specified callback for each chest in the chunk. Returns true if all chests in the chunk have been processed (including when there are zero chests), or false if the callback has aborted the enumeration by returning true. The CallbackFunction has the following signature: <pre class=\"prettyprint lang-lua\">function Callback({{cChestEntity|ChestEntity}})</pre> The callback should return false or no value to continue with the next chest, or true to abort the enumeration." },
- ForEachEntity = { Params = "CallbackFunction", Return = "bool", Notes = "Calls the specified callback for each entity in the loaded world. Returns true if all the entities have been processed (including when there are zero entities), or false if the callback function has aborted the enumeration by returning true. The callback function has the following signature: <pre class=\"prettyprint lang-lua\">function Callback({{cEntity|Entity}})</pre> The callback should return false or no value to continue with the next entity, or true to abort the enumeration." },
- ForEachEntityInBox = { Params = "{{cBoundingBox|Box}}, CallbackFunction", Return = "bool", Notes = "Calls the specified callback for each entity in the specified bounding box. Returns true if all the entities have been processed (including when there are zero entities), or false if the callback function has aborted the enumeration by returning true. If any chunk within the bounding box is not valid, it is silently skipped without any notification. The callback function has the following signature: <pre class=\"prettyprint lang-lua\">function Callback({{cEntity|Entity}})</pre> The callback should return false or no value to continue with the next entity, or true to abort the enumeration." },
- ForEachEntityInChunk = { Params = "ChunkX, ChunkZ, CallbackFunction", Return = "bool", Notes = "Calls the specified callback for each entity in the specified chunk. Returns true if all the entities have been processed (including when there are zero entities), or false if the chunk is not loaded or the callback function has aborted the enumeration by returning true. The callback function has the following signature: <pre class=\"prettyprint lang-lua\">function Callback({{cEntity|Entity}})</pre> The callback should return false or no value to continue with the next entity, or true to abort the enumeration." },
- ForEachFurnaceInChunk = { Params = "ChunkX, ChunkZ, CallbackFunction", Return = "bool", Notes = "Calls the specified callback for each furnace in the chunk. Returns true if all furnaces in the chunk have been processed (including when there are zero furnaces), or false if the callback has aborted the enumeration by returning true. The CallbackFunction has the following signature: <pre class=\"prettyprint lang-lua\">function Callback({{cFurnaceEntity|FurnaceEntity}})</pre> The callback should return false or no value to continue with the next furnace, or true to abort the enumeration." },
- ForEachPlayer = { Params = "CallbackFunction", Return = "bool", Notes = "Calls the specified callback for each player in the loaded world. Returns true if all the players have been processed (including when there are zero players), or false if the callback function has aborted the enumeration by returning true. The callback function has the following signature: <pre class=\"prettyprint lang-lua\">function Callback({{cPlayer|Player}})</pre> The callback should return false or no value to continue with the next player, or true to abort the enumeration." },
- GenerateChunk = { Params = "ChunkX, ChunkZ", Return = "", Notes = "Queues the specified chunk in the chunk generator. Ignored if the chunk is already generated (use RegenerateChunk() to force chunk re-generation)." },
- GetBiomeAt = { Params = "BlockX, BlockZ", Return = "eBiome", Notes = "Returns the biome at the specified coords. Reads the biome from the chunk, if it is loaded, otherwise it uses the chunk generator to provide the biome value." },
- GetBlock =
- {
- { Params = "BlockX, BlockY, BlockZ", Return = "BLOCKTYPE", Notes = "Returns the block type of the block at the specified coords, or 0 if the appropriate chunk is not loaded." },
- { Params = "{{Vector3i|BlockCoords}}", Return = "BLOCKTYPE", Notes = "Returns the block type of the block at the specified coords, or 0 if the appropriate chunk is not loaded." },
- },
- GetBlockBlockLight = { Params = "BlockX, BlockY, BlockZ", Return = "number", Notes = "Returns the amount of block light at the specified coords, or 0 if the appropriate chunk is not loaded." },
- GetBlockInfo = { Params = "BlockX, BlockY, BlockZ", Return = "BlockValid, BlockType, BlockMeta, BlockSkyLight, BlockBlockLight", Notes = "Returns the complete block info for the block at the specified coords. The first value specifies if the block is in a valid loaded chunk, the other values are valid only if BlockValid is true." },
- GetBlockMeta =
- {
- { Params = "BlockX, BlockY, BlockZ", Return = "number", Notes = "Returns the block metadata of the block at the specified coords, or 0 if the appropriate chunk is not loaded." },
- { Params = "{{Vector3i|BlockCoords}}", Return = "number", Notes = "Returns the block metadata of the block at the specified coords, or 0 if the appropriate chunk is not loaded." },
- },
- GetBlockSkyLight = { Params = "BlockX, BlockY, BlockZ", Return = "number", Notes = "Returns the block skylight of the block at the specified coords, or 0 if the appropriate chunk is not loaded." },
- GetBlockTypeMeta = { Params = "BlockX, BlockY, BlockZ", Return = "BlockValid, BlockType, BlockMeta", Notes = "Returns the block type and metadata for the block at the specified coords. The first value specifies if the block is in a valid loaded chunk, the other values are valid only if BlockValid is true." },
- GetDefaultWeatherInterval = { Params = "eWeather", Return = "", Notes = "Returns the default weather interval for the specific weather type. Returns -1 for any unknown weather." },
- GetDimension = { Params = "", Return = "eDimension", Notes = "Returns the dimension of the world - dimOverworld, dimNether or dimEnd." },
- GetGameMode = { Params = "", Return = "eGameMode", Notes = "Returns the gamemode of the world - gmSurvival, gmCreative or gmAdventure." },
- GetGeneratorQueueLength = { Params = "", Return = "number", Notes = "Returns the number of chunks that are queued in the chunk generator." },
- GetHeight = { Params = "BlockX, BlockZ", Return = "number", Notes = "Returns the maximum height of the particula block column in the world. If the chunk is not loaded, it waits for it to load / generate. <b>WARNING</b>: Do not use, Use TryGetHeight() instead for a non-waiting version, otherwise you run the risk of a deadlock!" },
- GetIniFileName = { Params = "", Return = "string", Notes = "Returns the name of the world.ini file that the world uses to store the information." },
- GetLightingQueueLength = { Params = "", Return = "number", Notes = "Returns the number of chunks in the lighting thread's queue." },
- GetLinkedEndWorldName = { Params = "", Return = "string", Notes = "Returns the name of the end world this world is linked to." },
- GetLinkedNetherWorldName = { Params = "", Return = "string", Notes = "Returns the name of the Netherworld linked to this world." },
- GetLinkedOverworldName = { Params = "", Return = "string", Notes = "Returns the name of the world this world is linked to." },
- GetMapManager = { Params = "", Return = "{{cMapManager}}", Notes = "Returns the {{cMapManager|MapManager}} object used by this world." },
- GetMaxCactusHeight = { Params = "", Return = "number", Notes = "Returns the configured maximum height to which cacti will grow naturally." },
- GetMaxNetherPortalHeight = { Params = "", Return = "number", Notes = "Returns the maximum height for a nether portal" },
- GetMaxNetherPortalWidth = { Params = "", Return = "number", Notes = "Returns the maximum width for a nether portal" },
- GetMaxSugarcaneHeight = { Params = "", Return = "number", Notes = "Returns the configured maximum height to which sugarcane will grow naturally." },
- GetMaxViewDistance = { Params = "", Return = "number", Notes = "Returns the maximum viewdistance that players can see in this world. The view distance is the amount of chunks around the player that the player can see." },
- GetMinNetherPortalHeight = { Params = "", Return = "number", Notes = "Returns the minimum height for a nether portal" },
- GetMinNetherPortalWidth = { Params = "", Return = "number", Notes = "Returns the minimum width for a nether portal" },
- GetName = { Params = "", Return = "string", Notes = "Returns the name of the world, as specified in the settings.ini file." },
- GetNumChunks = { Params = "", Return = "number", Notes = "Returns the number of chunks currently loaded." },
- GetScoreBoard = { Params = "", Return = "{{cScoreBoard}}", Notes = "Returns the {{cScoreBoard|ScoreBoard}} object used by this world. " },
- GetSignLines = { Params = "BlockX, BlockY, BlockZ", Return = "IsValid, [Line1, Line2, Line3, Line4]", Notes = "Returns true and the lines of a sign at the specified coords, or false if there is no sign at the coords." },
- GetSpawnX = { Params = "", Return = "number", Notes = "Returns the X coord of the default spawn" },
- GetSpawnY = { Params = "", Return = "number", Notes = "Returns the Y coord of the default spawn" },
- GetSpawnZ = { Params = "", Return = "number", Notes = "Returns the Z coord of the default spawn" },
- GetStorageLoadQueueLength = { Params = "", Return = "number", Notes = "Returns the number of chunks queued up for loading" },
- GetStorageSaveQueueLength = { Params = "", Return = "number", Notes = "Returns the number of chunks queued up for saving" },
- GetTicksUntilWeatherChange = { Params = "", Return = "number", Notes = "Returns the number of ticks that will pass before the weather is changed" },
- GetTimeOfDay = { Params = "", Return = "number", Notes = "Returns the number of ticks that have passed from the sunrise, 0 .. 24000." },
- GetTNTShrapnelLevel = { Params = "", Return = "{{Globals#ShrapnelLevel|ShrapnelLevel}}", Notes = "Returns the shrapnel level, representing the block types that are propelled outwards following an explosion. Based on this value and a random picker, blocks are selectively converted to physics entities (FallingSand) and flung outwards." },
- GetWeather = { Params = "", Return = "eWeather", Notes = "Returns the current weather in the world (wSunny, wRain, wStorm). To check for weather, use IsWeatherXXX() functions instead." },
- GetWorldAge = { Params = "", Return = "number", Notes = "Returns the total age of the world, in ticks. The age always grows, cannot be set by plugins and is unrelated to TimeOfDay." },
- GrowCactus = { Params = "BlockX, BlockY, BlockZ, NumBlocksToGrow", Return = "", Notes = "Grows a cactus block at the specified coords, by up to the specified number of blocks. Adheres to the world's maximum cactus growth (GetMaxCactusHeight())." },
- GrowMelonPumpkin = { Params = "BlockX, BlockY, BlockZ, StemType", Return = "", Notes = "Grows a melon or pumpkin, based on the stem type specified (assumed to be in the coords provided). Checks for normal melon / pumpkin growth conditions - stem not having another produce next to it and suitable ground below." },
- GrowRipePlant = { Params = "BlockX, BlockY, BlockZ, IsByBonemeal", Return = "bool", Notes = "Grows the plant at the specified coords. If IsByBonemeal is true, checks first if the specified plant type is bonemealable in the settings. Returns true if the plant was grown, false if not." },
- GrowSugarcane = { Params = "BlockX, BlockY, BlockZ, NumBlocksToGrow", Return = "", Notes = "Grows a sugarcane block at the specified coords, by up to the specified number of blocks. Adheres to the world's maximum sugarcane growth (GetMaxSugarcaneHeight())." },
- GrowTree = { Params = "BlockX, BlockY, BlockZ", Return = "", Notes = "Grows a tree based at the specified coords. If there is a sapling there, grows the tree based on that sapling, otherwise chooses a tree image based on the biome." },
- GrowTreeByBiome = { Params = "BlockX, BlockY, BlockZ", Return = "", Notes = "Grows a tree based at the specified coords. The tree type is picked from types available for the biome at those coords." },
- GrowTreeFromSapling = { Params = "BlockX, BlockY, BlockZ, SaplingMeta", Return = "", Notes = "Grows a tree based at the specified coords. The tree type is determined from the sapling meta (the sapling itself needn't be present)." },
- IsBlockDirectlyWatered = { Params = "BlockX, BlockY, BlockZ", Return = "bool", Notes = "Returns true if the specified block has a water block right next to it (on the X/Z axes)" },
- IsDaylightCycleEnabled = { Params = "", Return = "bool", Notes = "Returns true if the daylight cycle is enabled." },
- IsDeepSnowEnabled = { Params = "", Return = "bool", Notes = "Returns whether the configuration has DeepSnow enabled." },
- IsGameModeAdventure = { Params = "", Return = "bool", Notes = "Returns true if the current gamemode is gmAdventure." },
- IsGameModeCreative = { Params = "", Return = "bool", Notes = "Returns true if the current gamemode is gmCreative." },
- IsGameModeSpectator = { Params = "", Return = "bool", Notes = "Returns true if the current gamemode is gmSpectator." },
- IsGameModeSurvival = { Params = "", Return = "bool", Notes = "Returns true if the current gamemode is gmSurvival." },
- IsPVPEnabled = { Params = "", Return = "bool", Notes = "Returns whether PVP is enabled in the world settings." },
- IsTrapdoorOpen = { Params = "BlockX, BlockY, BlockZ", Return = "bool", Notes = "Returns false if there is no trapdoor there or if the block isn't a trapdoor or if the chunk wasn't loaded. Returns true if trapdoor is open." },
- IsWeatherRain = { Params = "", Return = "bool", Notes = "Returns true if the current world is raining." },
- IsWeatherRainAt = { Params = "BlockX, BlockZ", Return = "bool", Notes = "Returns true if the specified location is raining (takes into account biomes)." },
- IsWeatherStorm = { Params = "", Return = "bool", Notes = "Returns true if the current world is stormy." },
- IsWeatherStormAt = { Params = "BlockX, BlockZ", Return = "bool", Notes = "Returns true if the specified location is stormy (takes into account biomes)." },
- IsWeatherSunny = { Params = "", Return = "bool", Notes = "Returns true if the current weather is sunny." },
- IsWeatherSunnyAt = { Params = "BlockX, BlockZ", Return = "bool", Notes = "Returns true if the current weather is sunny at the specified location (takes into account biomes)." },
- IsWeatherWet = { Params = "", Return = "bool", Notes = "Returns true if the current world has any precipitation (rain or storm)." },
- IsWeatherWetAt = { Params = "BlockX, BlockZ", Return = "bool", Notes = "Returns true if the specified location has any precipitation (rain or storm) (takes into account biomes)." },
- PrepareChunk = { Params = "ChunkX, ChunkZ, [Callback]", Return = "", Notes = "Queues the chunk for preparing - making sure that it's generated and lit. It is legal to call with no callback. The callback function has the following signature: <pre class=\"prettyprint lang-lua\">function Callback(ChunkX, ChunkZ)</pre>" },
- QueueBlockForTick = { Params = "BlockX, BlockY, BlockZ, TicksToWait", Return = "", Notes = "Queues the specified block to be ticked after the specified number of gameticks." },
- QueueSaveAllChunks = { Params = "", Return = "", Notes = "Queues all chunks to be saved in the world storage thread" },
- QueueSetBlock = { Params = "BlockX, BlockY, BlockZ, BlockType, BlockMeta, TickDelay", Return = "", Notes = "Queues the block to be set to the specified blocktype and meta after the specified amount of game ticks. Uses SetBlock() for the actual setting, so simulators are woken up and block entities are handled correctly." },
- QueueTask = { Params = "TaskFunction", Return = "", Notes = "Queues the specified function to be executed in the tick thread. This is the primary means of interaction with a cWorld from the WebAdmin page handlers (see {{WebWorldThreads}}). The function signature is <pre class=\"pretty-print lang-lua\">function()</pre>All return values from the function are ignored. Note that this function is actually called *after* the QueueTask() function returns. Note that it is unsafe to store references to Cuberite objects, such as entities, across from the caller to the task handler function; store the EntityID instead." },
- QueueUnloadUnusedChunks = { Params = "", Return = "", Notes = "Queues a cTask that unloads chunks that are no longer needed and are saved." },
- RegenerateChunk = { Params = "ChunkX, ChunkZ", Return = "", Notes = "Queues the specified chunk to be re-generated, overwriting the current data. To queue a chunk for generating only if it doesn't exist, use the GenerateChunk() instead." },
- ScheduleTask = { Params = "DelayTicks, TaskFunction", Return = "", Notes = "Queues the specified function to be executed in the world's tick thread after a the specified number of ticks. This enables operations to be queued for execution in the future. The function signature is <pre class=\"pretty-print lang-lua\">function({{cWorld|World}})</pre>All return values from the function are ignored. Note that it is unsafe to store references to Cuberite objects, such as entities, across from the caller to the task handler function; store the EntityID instead." },
- SendBlockTo = { Params = "BlockX, BlockY, BlockZ, {{cPlayer|Player}}", Return = "", Notes = "Sends the block at the specified coords to the specified player's client, as an UpdateBlock packet." },
- SetAreaBiome = {
- { Params = "MinX, MaxX, MinZ, MaxZ, EMCSBiome", Return = "bool", Notes = "Sets the biome in the rectangular area specified. Returns true if successful, false if any of the chunks were unloaded." },
- { Params = "{{cCuboid|Cuboid}}, EMCSBiome", Return = "bool", Notes = "Sets the biome in the cuboid specified. Returns true if successful, false if any of the chunks were unloaded. The cuboid needn't be sorted." },
- },
- SetBiomeAt = { Params = "BlockX, BlockZ, EMCSBiome", Return = "bool", Notes = "Sets the biome at the specified block coords. Returns true if successful, false otherwise." },
- SetBlock = { Params = "BlockX, BlockY, BlockZ, BlockType, BlockMeta", Return = "", Notes = "Sets the block at the specified coords, replaces the block entities for the previous block type, creates a new block entity for the new block, if appropriate, and wakes up the simulators. This is the preferred way to set blocks, as opposed to FastSetBlock(), which is only to be used under special circumstances." },
- SetBlockMeta =
- {
- { Params = "BlockX, BlockY, BlockZ, BlockMeta", Return = "", Notes = "Sets the meta for the block at the specified coords." },
- { Params = "{{Vector3i|BlockCoords}}, BlockMeta", Return = "", Notes = "Sets the meta for the block at the specified coords." },
- },
- SetChunkAlwaysTicked = { Params = "ChunkX, ChunkZ, IsAlwaysTicked", Return = "", Notes = "Sets the chunk to always be ticked even when it doesn't contain any clients. IsAlwaysTicked set to true turns forced ticking on, set to false turns it off. Every call with 'true' should be paired with a later call with 'false', otherwise the ticking won't stop. Multiple actions can request ticking independently, the ticking will continue until the last call with 'false'. Note that when the chunk unloads, it loses the value of this flag." },
- SetNextBlockTick = { Params = "BlockX, BlockY, BlockZ", Return = "", Notes = "Sets the blockticking to start at the specified block in the next tick." },
- SetCommandBlockCommand = { Params = "BlockX, BlockY, BlockZ, Command", Return = "bool", Notes = "Sets the command to be executed in a command block at the specified coordinates. Returns if command was changed." },
- SetCommandBlocksEnabled = { Params = "IsEnabled (bool)", Return = "", Notes = "Sets whether command blocks should be enabled on the (entire) server." },
- SetDaylightCycleEnabled = { Params = "bool", Return = "", Notes = "Starts or stops the daylight cycle." },
- SetLinkedEndWorldName = { Params = "string", Return = "", Notes = "Sets the name of the world that the end portal should link to." },
- SetLinkedNetherWorldName = { Params = "string", Return = "", Notes = "Sets the name of the world that the nether portal should link to." },
- SetLinkedOverworldName = { Params = "string", Return = "", Notes = "Sets the name of the world that the nether portal should link to?" },
- SetMaxViewDistance = { Params = "number", Return = "", Notes = "Sets the maximum viewdistance of the players in the world." },
- SetMaxNetherPortalHeight = { Params = "number", Return = "", Notes = "Sets the maximum height for a nether portal" },
- SetMaxNetherPortalWidth = { Params = "number", Return = "", Notes = "Sets the maximum width for a nether portal" },
- SetMinNetherPortalHeight = { Params = "number", Return = "", Notes = "Sets the minimum height for a nether portal" },
- SetMinNetherPortalWidth = { Params = "number", Return = "", Notes = "Sets the minimum width for a nether portal" },
- SetShouldUseChatPrefixes = { Params = "", Return = "ShouldUse (bool)", Notes = "Sets whether coloured chat prefixes such as [INFO] is used with the SendMessageXXX() or BroadcastChatXXX(), or simply the entire message is coloured in the respective colour." },
- SetSignLines = { Params = "X, Y, Z, Line1, Line2, Line3, Line4, [{{cPlayer|Player}}]", Return = "", Notes = "Sets the sign text at the specified coords. The sign-updating hooks are called for the change. The Player parameter is used to indicate the player from whom the change has come, it may be nil." },
- SetTicksUntilWeatherChange = { Params = "NumTicks", Return = "", Notes = "Sets the number of ticks after which the weather will be changed." },
- SetTimeOfDay = { Params = "TimeOfDayTicks", Return = "", Notes = "Sets the time of day, expressed as number of ticks past sunrise, in the range 0 .. 24000." },
- SetTNTShrapnelLevel = { Params = "{{Globals#ShrapnelLevel|ShrapnelLevel}}", Return = "", Notes = "Sets the Shrampel level of the world." },
- SetTrapdoorOpen = { Params = "BlockX, BlockY, BlockZ, bool", Return = "", Notes = "Opens or closes a trapdoor at the specific coordinates." },
- SetWeather = { Params = "Weather", Return = "", Notes = "Sets the current weather (wSunny, wRain, wStorm) and resets the TicksUntilWeatherChange to the default value for the new weather. The normal weather-changing hooks are called for the change." },
- ShouldBroadcastAchievementMessages = { Params = "", Return = "bool", Notes = "Returns true if the server should broadcast achievement messages in this world." },
- ShouldBroadcastDeathMessages = { Params = "", Return = "bool", Notes = "Returns true if the server should broadcast death messages in this world." },
- ShouldUseChatPrefixes = { Params = "", Return = "bool", Notes = "Returns whether coloured chat prefixes are prepended to chat messages or the entire message is simply coloured." },
- ShouldLavaSpawnFire = { Params = "", Return = "bool", Notes = "Returns true if the world is configured to spawn fires near lava (world.ini: [Physics].ShouldLavaSpawnFire value)" },
- SpawnItemPickups =
- {
- { Params = "{{cItems|Pickups}}, X, Y, Z, FlyAwaySpeed", Return = "", Notes = "Spawns the specified pickups at the position specified. The FlyAway speed is used to initialize the random speed in which the pickups fly away from the spawn position." },
- { Params = "{{cItems|Pickups}}, X, Y, Z, SpeedX, SpeedY, SpeedZ", Return = "", Notes = "Spawns the specified pickups at the position specified. All the pickups fly away from the spawn position using the specified speed." },
- },
- SpawnMinecart = { Params = "X, Y, Z, MinecartType, Item, BlockHeight", Return = "number", Notes = "Spawns a minecart at the specific coordinates. MinecartType is the item type of the minecart. If the minecart is an empty minecart then the given item is the block inside the minecart, and blockheight is the distance of the block and the minecart." },
- SpawnMob = { Params = "X, Y, Z, {{cMonster|MonsterType}}, [Baby]", Return = "EntityID", Notes = "Spawns the specified type of mob at the specified coords. If the Baby parameter is true, the mob will be a baby. Returns the EntityID of the creates entity, or -1 on failure. " },
- SpawnFallingBlock = { Params = "X, Y, Z, BlockType, BlockMeta", Return = "EntityID", Notes = "Spawns an {{cFallingBlock|Falling Block}} entity at the specified coords with the given block type/meta" },
- SpawnExperienceOrb = { Params = "X, Y, Z, Reward", Return = "EntityID", Notes = "Spawns an {{cExpOrb|experience orb}} at the specified coords, with the given reward" },
- SpawnPrimedTNT = { Params = "X, Y, Z, FuseTicks, InitialVelocityCoeff", Return = "", Notes = "Spawns a {{cTNTEntity|primed TNT entity}} at the specified coords, with the given fuse ticks. The entity gets a random speed multiplied by the InitialVelocityCoeff, 1 being the default value." },
- TryGetHeight = { Params = "BlockX, BlockZ", Return = "IsValid, Height", Notes = "Returns true and height of the highest non-air block if the chunk is loaded, or false otherwise." },
- UpdateSign = { Params = "X, Y, Z, Line1, Line2, Line3, Line4, [{{cPlayer|Player}}]", Return = "", Notes = "(<b>DEPRECATED</b>) Please use SetSignLines()." },
- UseBlockEntity = { Params = "{{cPlayer|Player}}, BlockX, BlockY, BlockZ", Return = "", Notes = "Makes the specified Player use the block entity at the specified coords (open chest UI, etc.) If the cords are in an unloaded chunk or there's no block entity, ignores the call." },
- VillagersShouldHarvestCrops = { Params = "", Return = "", Notes = "Returns true if villagers can harvest crops." },
- WakeUpSimulators = { Params = "BlockX, BlockY, BlockZ", Return = "", Notes = "Wakes up the simulators for the specified block." },
- WakeUpSimulatorsInArea = { Params = "MinBlockX, MaxBlockX, MinBlockY, MaxBlockY, MinBlockZ, MaxBlockZ", Return = "", Notes = "Wakes up the simulators for all the blocks in the specified area (edges inclusive)." },
- },
- AdditionalInfo =
- {
- {
- Header = "Using callbacks",
- Contents = [[
- To avoid problems with stale objects, the cWorld class will not let plugins get a direct pointer
- to an {{cEntity|entity}}, {{cBlockEntity|block entity}} or a {{cPlayer|player}}. Such an object
- could be modified or even destroyed by another thread while the plugin holds it, so it would be
- rather unsafe.</p>
- <p>
- Instead, the cWorld provides access to these objects using callbacks. The plugin provides a
- function that is called and receives the object as a parameter; cWorld guarantees that while
- the callback is executing, the object will stay valid. If a plugin needs to "remember" the
- object outside of the callback, it needs to store the entity ID, blockentity coords or player
- name.</p>
- <p>
- The following code examples show how to use the callbacks</p>
- <p>
- This code teleports player Player to another player named ToName in the same world:
-<pre class="prettyprint lang-lua">
--- Player is a cPlayer object
--- ToName is a string
--- World is a cWorld object
-World:ForEachPlayer(
- function (a_OtherPlayer)
- if (a_OtherPlayer:GetName() == ToName) then
- Player:TeleportToEntity(a_OtherPlayer);
- end
-);
-</pre></p>
- <p>
- This code fills each furnace in the chunk with 64 coals:
-<pre class="prettyprint lang-lua">
--- Player is a cPlayer object
--- World is a cWorld object
-World:ForEachFurnaceInChunk(Player:GetChunkX(), Player:GetChunkZ(),
- function (a_Furnace)
- a_Furnace:SetFuelSlot(cItem(E_ITEM_COAL, 64));
- end
-);
-</pre></p>
- <p>
- This code teleports all spiders up by 100 blocks:
-<pre class="prettyprint lang-lua">
--- World is a cWorld object
-World:ForEachEntity(
- function (a_Entity)
- if not(a_Entity:IsMob()) then
- return;
- end
-
- -- Get the cMonster out of cEntity, now that we know the entity represents one.
- local Monster = tolua.cast(a_Entity, "cMonster");
- if (Monster:GetMobType() == mtSpider) then
- Monster:TeleportToCoords(Monster:GetPosX(), Monster:GetPosY() + 100, Monster:GetPosZ());
- end
- end
-);
-</pre></p>
- ]],
- },
- }, -- AdditionalInfo
- }, -- cWorld
-
- ItemCategory =
- {
- Desc = [[
- This class contains static functions for determining item categories. All of the functions are
- called directly on the class table, unlike most other object, which require an instance first.
- ]],
- Functions =
- {
- IsArmor = { Params = "ItemType", Return = "bool", Notes = "(STATIC) Returns true if the specified item type is any kind of an armor." },
- IsAxe = { Params = "ItemType", Return = "bool", Notes = "(STATIC) Returns true if the specified item type is any kind of an axe." },
- IsBoots = { Params = "ItemType", Return = "bool", Notes = "(STATIC) Returns true if the specified item type is any kind of boots." },
- IsChestPlate = { Params = "ItemType", Return = "bool", Notes = "(STATIC) Returns true if the specified item type is any kind of a chestplate." },
- IsHelmet = { Params = "ItemType", Return = "bool", Notes = "(STATIC) Returns true if the specified item type is any kind of a helmet." },
- IsHoe = { Params = "ItemType", Return = "bool", Notes = "(STATIC) Returns true if the specified item type is any kind of a hoe." },
- IsLeggings = { Params = "ItemType", Return = "bool", Notes = "(STATIC) Returns true if the specified item type is any kind of a leggings." },
- IsPickaxe = { Params = "ItemType", Return = "bool", Notes = "(STATIC) Returns true if the specified item type is any kind of a pickaxe." },
- IsShovel = { Params = "ItemType", Return = "bool", Notes = "(STATIC) Returns true if the specified item type is any kind of a shovel." },
- IsSword = { Params = "ItemType", Return = "bool", Notes = "(STATIC) Returns true if the specified item type is any kind of a sword." },
- IsTool = { Params = "ItemType", Return = "bool", Notes = "(STATIC) Returns true if the specified item type is any kind of a tool (axe, hoe, pickaxe, shovel or FIXME: sword)" },
- },
- AdditionalInfo =
- {
- {
- Header = "Code example",
- Contents = [[
- The following code snippet checks if the player holds a shovel.
-<pre class="prettyprint lang-lua">
--- a_Player is a {{cPlayer}} object, possibly received as a hook param
-local HeldItem = a_Player:GetEquippedItem()
-if (ItemCategory.IsShovel(HeldItem.m_ItemType)) then
- -- It's a shovel
-end
-</pre>
- ]],
- }
- },
- }, -- ItemCategory
-
- lxp =
- {
- Desc = [[
- This class provides an interface to the XML parser,
- {{http://matthewwild.co.uk/projects/luaexpat/|LuaExpat}}. It provides a SAX interface with an
- incremental XML parser.</p>
- <p>
- With an event-based API like SAX the XML document can be fed to the parser in chunks, and the
- parsing begins as soon as the parser receives the first document chunk. LuaExpat reports parsing
- events (such as the start and end of elements) directly to the application through callbacks. The
- parsing of huge documents can benefit from this piecemeal operation.</p>
- <p>
- See the online
- {{http://matthewwild.co.uk/projects/luaexpat/manual.html#parser|LuaExpat documentation}} for details
- on how to work with this parser. The code examples below should provide some basic help, too.
- ]],
- Functions =
- {
- new = {Params = "CallbacksTable, [SeparatorChar]", Return = "XMLParser object", Notes = "Creates a new XML parser object, with the specified callbacks table and optional separator character."},
- },
- Constants =
- {
- _COPYRIGHT = { Notes = "" },
- _DESCRIPTION = { Notes = "" },
- _VERSION = { Notes = "" },
- },
- AdditionalInfo =
- {
- {
- Header = "Parser callbacks",
- Contents = [[
- The callbacks table passed to the new() function specifies the Lua functions that the parser
- calls upon various events. The following table lists the most common functions used, for a
- complete list see the online
- {{http://matthewwild.co.uk/projects/luaexpat/manual.html#parser|LuaExpat documentation}}.</p>
- <table>
- <tr><th>Function name</th><th>Parameters</th><th>Notes</th></tr>
- <tr><td>CharacterData</td><td>Parser, string</td><td>Called when the parser recognizes a raw string inside the element</td></tr>
- <tr><td>EndElement</td><td>Parser, ElementName</td><td>Called when the parser detects the ending of an XML element</td></tr>
- <tr><td>StartElement</td><td>Parser, ElementName, AttributesTable</td><td>Called when the parser detects the start of an XML element. The AttributesTable is a Lua table containing all the element's attributes, both in the array section (in the order received) and in the dictionary section.</td></tr>
- </table>
- ]],
- },
- {
- Header = "XMLParser object",
- Contents = [[
- The XMLParser object returned by lxp.new provides the functions needed to parse the XML. The
- following list provides the most commonly used ones, for a complete list see the online
- {{http://matthewwild.co.uk/projects/luaexpat/manual.html#parser|LuaExpat documentation}}.
- <ul>
- <li>close() - closes the parser, freeing all memory used by it.</li>
- <li>getCallbacks() - returns the callbacks table for this parser.</li>
- <li>parse(string) - parses more document data. the string contains the next part (or possibly all) of the document. Returns non-nil for success or nil, msg, line, col, pos for error.</li>
- <li>stop() - aborts parsing (can be called from within the parser callbacks).</li>
- </ul>
- ]],
- },
- {
- Header = "Code example",
- Contents = [[
- The following code reads an entire XML file and outputs its logical structure into the console:
-<pre class="prettyprint lang-lua">
-local Depth = 0;
-
--- Define the callbacks:
-local Callbacks = {
- CharacterData = function(a_Parser, a_String)
- LOG(string.rep(" ", Depth) .. "* " .. a_String);
- end
-
- EndElement = function(a_Parser, a_ElementName)
- Depth = Depth - 1;
- LOG(string.rep(" ", Depth) .. "- " .. a_ElementName);
- end
-
- StartElement = function(a_Parser, a_ElementName, a_Attribs)
- LOG(string.rep(" ", Depth) .. "+ " .. a_ElementName);
- Depth = Depth + 1;
- end
-}
-
--- Create the parser:
-local Parser = lxp.new(Callbacks);
-
--- Parse the XML file:
-local f = io.open("file.xml", "rb");
-while (true) do
- local block = f:read(128 * 1024); -- Use a 128KiB buffer for reading
- if (block == nil) then
- -- End of file
- break;
- end
- Parser:parse(block);
-end
-
--- Signalize to the parser that no more data is coming
-Parser:parse();
-
--- Close the parser:
-Parser:close();
-</pre>
- ]],
- },
- }, -- AdditionalInfo
- }, -- lxp
-
- sqlite3 =
- {
- Desc = [[
- ]],
-
- Functions =
- {
- complete = { Params = "string", Return = "bool", Notes = "Returns true if the string sql comprises one or more complete SQL statements and false otherwise." },
- open = { Params = "FileName", Return = "DBClass", Notes = [[
- Opens (or creates if it does not exist) an SQLite database with name filename and returns its
- handle as userdata (the returned object should be used for all further method calls in connection
- with this specific database, see
- {{http://lua.sqlite.org/index.cgi/doc/tip/doc/lsqlite3.wiki#database_methods|Database methods}}).
- Example:
-<pre class="prettyprint lang-lua">
--- open the database:
-myDB = sqlite3.open('MyDatabaseFile.sqlite3')
-
--- do some database calls...
-
--- Close the database:
-myDB:close()
-</pre>
- ]], },
- open_memory = { Return = "DBClass", Notes = "Opens an SQLite database in memory and returns its handle as userdata. In case of an error, the function returns nil, an error code and an error message. (In-memory databases are volatile as they are never stored on disk.)" },
- version = { Return = "string", Notes = "Returns a string with SQLite version information, in the form 'x.y[.z]'." },
- },
- },
-
- TakeDamageInfo =
- {
- Desc = [[
- This class contains the amount of damage, and the entity that caused the damage. It is used in the
- {{OnTakeDamage|HOOK_TAKE_DAMAGE}} hook and in the {{cEntity}}'s TakeDamage() function.
- ]],
- Variables =
- {
- Attacker = { Type = "{{cEntity}}", Notes = "The entity who is attacking. Only valid if dtAttack." },
- DamageType = { Type = "eDamageType", Notes = "Source of the damage. One of the dtXXX constants." },
- FinalDamage = { Type = "number", Notes = " The final amount of damage that will be applied to the Receiver. It is the RawDamage minus any Receiver's armor-protection " },
- Knockback = { Type = "{{Vector3d}}", Notes = "Vector specifying the amount and direction of knockback that will be applied to the Receiver " },
- RawDamage = { Type = "number", Notes = "Amount of damage that the attack produces on the Receiver, including the Attacker's equipped weapon, but excluding the Receiver's armor." },
- },
- AdditionalInfo =
- {
- {
- Header = "",
- Contents = [[
- The TDI is passed as the second parameter in the HOOK_TAKE_DAMAGE hook, and can be used to
- modify the damage before it is applied to the receiver:
-<pre class="prettyprint lang-lua">
-function OnTakeDamage(Receiver, TDI)
- LOG("Damage: Raw ".. TDI.RawDamage .. ", Final:" .. TDI.FinalDamage);
-
- -- If the attacker is a spider, make it deal 999 points of damage (insta-death spiders):
- if ((TDI.Attacker ~= nil) and TDI.Attacker:IsA("cSpider")) then
- TDI.FinalDamage = 999;
- end
-end
-</pre>
- ]],
- },
- }, -- AdditionalInfo
- }, -- TakeDamageInfo
-
- tolua =
- {
- Desc = [[
- This class represents the tolua bridge between the Lua API and Cuberite. It supports some low
- level operations and queries on the objects. See also the tolua++'s documentation at
- {{http://www.codenix.com/~tolua/tolua++.html#utilities}}. Normally you shouldn't use any of these
- functions except for type()
- ]],
- Functions =
- {
- cast = { Params = "Object, TypeStr", Return = "Object", Notes = "Casts the object to the specified type.<br/><b>Note:</b> This is a potentially unsafe operation and it could crash the server. There is normally no need to use this function at all, so don't use it unless you know exactly what you're doing." },
- getpeer = { Params = "", Return = "", Notes = "" },
- inherit = { Params = "", Return = "", Notes = "" },
- releaseownership = { Params = "", Return = "", Notes = "" },
- setpeer = { Params = "", Return = "", Notes = "" },
- takeownership = { Params = "", Return = "", Notes = "" },
- type = { Params = "Object", Return = "TypeStr", Notes = "Returns a string representing the type of the object. This works similar to Lua's built-in type() function, but recognizes the underlying C++ classes, too." },
- },
- }, -- tolua
-
- Globals =
- {
- Desc = [[
- These functions are available directly, without a class instance. Any plugin can call them at any
- time.
- ]],
- Functions =
- {
- AddFaceDirection = {Params = "BlockX, BlockY, BlockZ, BlockFace, [IsInverse]", Return = "BlockX, BlockY, BlockZ", Notes = "Returns the coords of a block adjacent to the specified block through the specified {{Globals#BlockFaces|face}}"},
- BlockFaceToString = {Params = "{{Globals#BlockFaces|eBlockFace}}", Return = "string", Notes = "Returns the string representation of the {{Globals#BlockFaces|eBlockFace}} constant. Uses the axis-direction-based names, such as BLOCK_FACE_XP." },
- BlockStringToType = {Params = "BlockTypeString", Return = "BLOCKTYPE", Notes = "Returns the block type parsed from the given string"},
- Clamp = {Params = "Number, Min, Max", Return = "number", Notes = "Clamp the number to the specified range."},
- ClickActionToString = {Params = "{{Globals#ClickAction|ClickAction}}", Return = "string", Notes = "Returns a string description of the ClickAction enumerated value"},
- DamageTypeToString = {Params = "{{Globals#DamageType|DamageType}}", Return = "string", Notes = "Converts the {{Globals#DamageType|DamageType}} enumerated value to a string representation "},
- EscapeString = {Params = "string", Return = "string", Notes = "Returns a copy of the string with all quotes and backslashes escaped by a backslash"},
- GetChar = {Params = "String, Pos", Return = "string", Notes = "Returns one character from the string, specified by position "},
- GetIniItemSet = { Params = "IniFile, SectionName, KeyName, DefaultValue", Return = "{{cItem}}", Notes = "Returns the item that has been read from the specified INI file value. If the value is not present in the INI file, the DefaultValue is stored in the file and parsed as the result. Returns empty item if the value cannot be parsed. " },
- GetTime = {Return = "number", Notes = "Returns the current OS time, as a unix time stamp (number of seconds since Jan 1, 1970)"},
- IsBiomeNoDownfall = {Params = "Biome", Return = "bool", Notes = "Returns true if the biome is 'dry', that is, there is no precipitation during rains and storms." },
- IsValidBlock = {Params = "BlockType", Return = "bool", Notes = "Returns true if BlockType is a known block type"},
- IsValidItem = {Params = "ItemType", Return = "bool", Notes = "Returns true if ItemType is a known item type"},
- ItemToFullString = {Params = "{{cItem|cItem}}", Return = "string", Notes = "Returns the string representation of the item, in the format 'ItemTypeText:ItemDamage * Count'"},
- ItemToString = {Params = "{{cItem|cItem}}", Return = "string", Notes = "Returns the string representation of the item type"},
- ItemTypeToString = {Params = "ItemType", Return = "string", Notes = "Returns the string representation of ItemType "},
- LOG =
- {
- {Params = "string", Notes = "Logs a text into the server console using 'normal' severity (gray text)"},
- {Params = "{{cCompositeChat|CompositeChat}}", Notes = "Logs the {{cCompositeChat}}'s human-readable text into the server console. The severity is converted from the CompositeChat's MessageType."},
- },
- LOGERROR =
- {
- {Params = "string", Notes = "Logs a text into the server console using 'error' severity (black text on red background)"},
- {Params = "{{cCompositeChat|CompositeChat}}", Notes = "Logs the {{cCompositeChat}}'s human-readable text into the server console using 'error' severity (black text on red background)"},
- },
- LOGINFO =
- {
- {Params = "string", Notes = "Logs a text into the server console using 'info' severity (yellow text)"},
- {Params = "{{cCompositeChat|CompositeChat}}", Notes = "Logs the {{cCompositeChat}}'s human-readable text into the server console using 'info' severity (yellow text)"},
- },
- LOGWARN =
- {
- {Params = "string", Notes = "Logs a text into the server console using 'warning' severity (red text); OBSOLETE, use LOGWARNING() instead"},
- {Params = "{{cCompositeChat|CompositeChat}}", Notes = "Logs the {{cCompositeChat}}'s human-readable text into the server console using 'warning' severity (red text); OBSOLETE, use LOGWARNING() instead"},
- },
- LOGWARNING =
- {
- {Params = "string", Notes = "Logs a text into the server console using 'warning' severity (red text)"},
- {Params = "{{cCompositeChat|CompositeChat}}", Notes = "Logs the {{cCompositeChat}}'s human-readable text into the server console using 'warning' severity (red text)"},
- },
- MirrorBlockFaceY = { Params = "{{Globals#BlockFaces|eBlockFace}}", Return = "{{Globals#BlockFaces|eBlockFace}}", Notes = "Returns the {{Globals#BlockFaces|eBlockFace}} that corresponds to the given {{Globals#BlockFaces|eBlockFace}} after mirroring it around the Y axis (or rotating 180 degrees around it)." },
- NoCaseCompare = {Params = "string, string", Return = "number", Notes = "Case-insensitive string comparison; returns 0 if the strings are the same"},
- NormalizeAngleDegrees = { Params = "AngleDegrees", Return = "AngleDegrees", Notes = "Returns the angle, wrapped into the [-180, +180) range." },
- ReplaceString = {Params = "full-string, to-be-replaced-string, to-replace-string", Return = "string", Notes = "Replaces *each* occurence of to-be-replaced-string in full-string with to-replace-string"},
- RotateBlockFaceCCW = { Params = "{{Globals#BlockFaces|eBlockFace}}", Return = "{{Globals#BlockFaces|eBlockFace}}", Notes = "Returns the {{Globals#BlockFaces|eBlockFace}} that corresponds to the given {{Globals#BlockFaces|eBlockFace}} after rotating it around the Y axis 90 degrees counter-clockwise." },
- RotateBlockFaceCW = { Params = "{{Globals#BlockFaces|eBlockFace}}", Return = "{{Globals#BlockFaces|eBlockFace}}", Notes = "Returns the {{Globals#BlockFaces|eBlockFace}} that corresponds to the given {{Globals#BlockFaces|eBlockFace}} after rotating it around the Y axis 90 degrees clockwise." },
- StringSplit = {Params = "string, SeperatorsString", Return = "array table of strings", Notes = "Seperates string into multiple by splitting every time any of the characters in SeperatorsString is encountered."},
- StringSplitAndTrim = {Params = "string, SeperatorsString", Return = "array table of strings", Notes = "Seperates string into multiple by splitting every time any of the characters in SeperatorsString is encountered. Each of the separate strings is trimmed (whitespace removed from the beginning and end of the string)"},
- StringSplitWithQuotes = {Params = "string, SeperatorsString", Return = "array table of strings", Notes = "Seperates string into multiple by splitting every time any of the characters in SeperatorsString is encountered. Whitespace wrapped with single or double quotes will be ignored"},
- StringToBiome = {Params = "string", Return = "{{Globals#BiomeTypes|BiomeType}}", Notes = "Converts a string representation to a {{Globals#BiomeTypes|BiomeType}} enumerated value"},
- StringToDamageType = {Params = "string", Return = "{{Globals#DamageType|DamageType}}", Notes = "Converts a string representation to a {{Globals#DamageType|DamageType}} enumerated value."},
- StringToDimension = {Params = "string", Return = "{{Globals#WorldDimension|Dimension}}", Notes = "Converts a string representation to a {{Globals#WorldDimension|Dimension}} enumerated value"},
- StringToItem = {Params = "string, {{cItem|cItem}}", Return = "bool", Notes = "Parses the given string and sets the item; returns true if successful"},
- StringToMobType = {Params = "string", Return = "{{Globals#MobType|MobType}}", Notes = "<b>DEPRECATED!</b> Please use cMonster:StringToMobType(). Converts a string representation to a {{Globals#MobType|MobType}} enumerated value"},
- StripColorCodes = {Params = "string", Return = "string", Notes = "Removes all control codes used by MC for colors and styles"},
- TrimString = {Params = "string", Return = "string", Notes = "Trims whitespace at both ends of the string"},
- md5 = {Params = "string", Return = "string", Notes = "<b>OBSOLETE</b>, use the {{cCryptoHash}} functions instead.<br>Converts a string to a raw binary md5 hash."},
- },
- ConstantGroups =
- {
- BlockTypes =
- {
- Include = "^E_BLOCK_.*",
- TextBefore = [[
- These constants are used for block types. They correspond directly with MineCraft's data values
- for blocks.
- ]],
- },
- ItemTypes =
- {
- Include = "^E_ITEM_.*",
- TextBefore = [[
- These constants are used for item types. They correspond directly with MineCraft's data values
- for items.
- ]],
- },
- MetaValues =
- {
- Include = "^E_META_.*",
- },
- BiomeTypes =
- {
- Include = "^bi.*",
- TextBefore = [[
- These constants represent the biomes that the server understands. Note that there is a global
- StringToBiome() function that can convert a string into one of these constants.
- ]],
- },
- BlockFaces =
- {
- Include = "^BLOCK_FACE_.*",
- TextBefore = [[
- These constants are used to describe individual faces of the block. They are used when the
- client is interacting with a block in the {{OnPlayerBreakingBlock|HOOK_PLAYER_BREAKING_BLOCK}},
- {{OnPlayerBrokenBlock|HOOK_PLAYER_BROKEN_BLOCK}}, {{OnPlayerLeftClick|HOOK_PLAYER_LEFT_CLICK}},
- {{OnPlayerPlacedBlock|HOOK_PLAYER_PLACED_BLOCK}}, {{OnPlayerPlacingBlock|HOOK_PLAYER_PLACING_BLOCK}},
- {{OnPlayerRightClick|HOOK_PLAYER_RIGHT_CLICK}}, {{OnPlayerUsedBlock|HOOK_PLAYER_USED_BLOCK}},
- {{OnPlayerUsedItem|HOOK_PLAYER_USED_ITEM}}, {{OnPlayerUsingBlock|HOOK_PLAYER_USING_BLOCK}},
- and {{OnPlayerUsingItem|HOOK_PLAYER_USING_ITEM}} hooks, or when the {{cLineBlockTracer}} hits a
- block, etc.
- ]],
- },
- ClickAction =
- {
- Include = "^ca.*",
- TextBefore = [[
- These constants are used to signalize various interactions that the user can do with the
- {{cWindow|UI windows}}. The server translates the protocol events into these constants. Note
- that there is a global ClickActionToString() function that can translate these constants into
- their textual representation.
- ]],
- },
- WorldDimension =
- {
- Include = "^dim.*",
- TextBefore = [[
- These constants represent dimension of a world. In Cuberite, the dimension is only reflected in
- the world's overall tint - overworld gets sky-like colors and dark shades, the nether gets
- reddish haze and the end gets dark haze. World generator is not directly affected by the
- dimension, same as fluid simulators; those only default to the expected values if not set
- specifically otherwise in the world.ini file.
- ]],
- },
- DamageType =
- {
- Include = "^dt.*",
- TextBefore = [[
- These constants are used for specifying the cause of damage to entities. They are used in the
- {{TakeDamageInfo}} structure, as well as in {{cEntity}}'s damage-related API functions.
- ]],
- },
- GameMode =
- {
- Include = { "^gm.*", "^eGameMode_.*" },
- TextBefore = [[
- The following constants are used for the gamemode - survival, creative or adventure. Use the
- gmXXX constants, the eGameMode_ constants are deprecated and will be removed from the API.
- ]],
- },
- MobType =
- {
- Include = { "^mt.*" },
- TextBefore = [[
- The following constants are used for distinguishing between the individual mob types:
- ]],
- },
- Weather =
- {
- Include = { "^eWeather_.*", "wSunny", "wRain", "wStorm", "wThunderstorm" },
- TextBefore = [[
- These constants represent the weather in the world. Note that unlike vanilla, Cuberite allows
- different weathers even in non-overworld {{Globals#WorldDimension|dimensions}}.
- ]],
- },
- ExplosionSource =
- {
- Include = "^es.*",
- TextBefore = [[
- These constants are used to differentiate the various sources of explosions. They are used in
- the {{OnExploded|HOOK_EXPLODED}} hook, {{OnExploding|HOOK_EXPLODING}} hook and in the
- {{cWorld}}:DoExplosionAt() function. These constants also dictate the type of the additional
- data provided with the explosions, such as the exploding {{cCreeper|creeper}} entity or the
- {{Vector3i|coords}} of the exploding bed.
- ]],
- },
- SpreadSource =
- {
- Include = "^ss.*",
- TextBefore = [[
- These constants are used to differentiate the various sources of spreads, such as grass growing.
- They are used in the {{OnBlockSpread|HOOK_BLOCK_SPREAD}} hook.
- ]],
- },
- ShrapnelLevel =
- {
- Include = "^sl.*",
- TextBefore = [[
- The following constants define the block types that are propelled outwards after an explosion.
- ]],
- },
- },
- }, -- Globals
- },
-
-
- IgnoreClasses =
- {
- "^coroutine$",
- "^debug$",
- "^io$",
- "^math$",
- "^package$",
- "^os$",
- "^string$",
- "^table$",
- "^g_Stats$",
- "^g_TrackedPages$",
- },
-
- IgnoreFunctions =
- {
- "Globals.assert",
- "Globals.collectgarbage",
- "Globals.xpcall",
- "Globals.decoda_output", -- When running under Decoda, this function gets added to the global namespace
- "sqlite3.__newindex",
- "%a+%.__%a+", -- AnyClass.__Anything
- "%a+%.%.collector", -- AnyClass..collector
- "%a+%.new", -- AnyClass.new
- "%a+%.new_local", -- AnyClass.new_local
- "%a+%.delete", -- AnyClass.delete
-
- -- Functions global in the APIDump plugin:
- "CreateAPITables",
- "DumpAPIHtml",
- "DumpAPITxt",
- "Initialize",
- "LinkifyString",
- "ListMissingPages",
- "ListUndocumentedObjects",
- "ListUnexportedObjects",
- "LoadAPIFiles",
- "ReadDescriptions",
- "ReadHooks",
- "WriteHtmlClass",
- "WriteHtmlHook",
- "WriteStats",
- },
-
- IgnoreConstants =
- {
- "cChestEntity.__cBlockEntityWindowOwner__",
- "cDropSpenserEntity.__cBlockEntityWindowOwner__",
- "cFurnaceEntity.__cBlockEntityWindowOwner__",
- "cHopperEntity.__cBlockEntityWindowOwner__",
- "cLuaWindow.__cItemGrid__cListener__",
- },
-
- IgnoreVariables =
- {
- "__.*__", -- tolua exports multiple inheritance this way
- } ,
-
- ExtraPages =
- {
- -- No sorting is provided for these, they will be output in the same order as defined here
- { FileName = "Writing-a-Cuberite-plugin.html", Title = "Writing a Cuberite plugin" },
- { FileName = "InfoFile.html", Title = "Using the Info.lua file" },
- { FileName = "SettingUpDecoda.html", Title = "Setting up the Decoda Lua IDE" },
- { FileName = "SettingUpZeroBrane.html", Title = "Setting up the ZeroBrane Studio Lua IDE" },
- { FileName = "UsingChunkStays.html", Title = "Using ChunkStays" },
- { FileName = "WebWorldThreads.html", Title = "Webserver vs World threads" },
- }
-} ;
diff --git a/MCServer/Plugins/APIDump/APIDump.deproj b/MCServer/Plugins/APIDump/APIDump.deproj
deleted file mode 100644
index 0e6fcd325..000000000
--- a/MCServer/Plugins/APIDump/APIDump.deproj
+++ /dev/null
@@ -1,168 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<project>
- <file>
- <filename>APIDesc.lua</filename>
- </file>
- <file>
- <filename>Classes\BlockEntities.lua</filename>
- </file>
- <file>
- <filename>Classes\Geometry.lua</filename>
- </file>
- <file>
- <filename>Hooks\OnBlockToPickups.lua</filename>
- </file>
- <file>
- <filename>Hooks\OnChat.lua</filename>
- </file>
- <file>
- <filename>Hooks\OnChunkAvailable.lua</filename>
- </file>
- <file>
- <filename>Hooks\OnChunkGenerated.lua</filename>
- </file>
- <file>
- <filename>Hooks\OnChunkGenerating.lua</filename>
- </file>
- <file>
- <filename>Hooks\OnChunkUnloaded.lua</filename>
- </file>
- <file>
- <filename>Hooks\OnChunkUnloading.lua</filename>
- </file>
- <file>
- <filename>Hooks\OnCollectingPickup.lua</filename>
- </file>
- <file>
- <filename>Hooks\OnCraftingNoRecipe.lua</filename>
- </file>
- <file>
- <filename>Hooks\OnDisconnect.lua</filename>
- </file>
- <file>
- <filename>Hooks\OnExecuteCommand.lua</filename>
- </file>
- <file>
- <filename>Hooks\OnExploded.lua</filename>
- </file>
- <file>
- <filename>Hooks\OnExploding.lua</filename>
- </file>
- <file>
- <filename>Hooks\OnHandshake.lua</filename>
- </file>
- <file>
- <filename>Hooks\OnHopperPullingItem.lua</filename>
- </file>
- <file>
- <filename>Hooks\OnHopperPushingItem.lua</filename>
- </file>
- <file>
- <filename>Hooks\OnKilling.lua</filename>
- </file>
- <file>
- <filename>Hooks\OnLogin.lua</filename>
- </file>
- <file>
- <filename>Hooks\OnPlayerAnimation.lua</filename>
- </file>
- <file>
- <filename>Hooks\OnPlayerBreakingBlock.lua</filename>
- </file>
- <file>
- <filename>Hooks\OnPlayerBrokenBlock.lua</filename>
- </file>
- <file>
- <filename>Hooks\OnPlayerEating.lua</filename>
- </file>
- <file>
- <filename>Hooks\OnPlayerJoined.lua</filename>
- </file>
- <file>
- <filename>Hooks\OnPlayerLeftClick.lua</filename>
- </file>
- <file>
- <filename>Hooks\OnPlayerMoving.lua</filename>
- </file>
- <file>
- <filename>Hooks\OnPlayerPlacedBlock.lua</filename>
- </file>
- <file>
- <filename>Hooks\OnPlayerPlacingBlock.lua</filename>
- </file>
- <file>
- <filename>Hooks\OnPlayerRightClick.lua</filename>
- </file>
- <file>
- <filename>Hooks\OnPlayerRightClickingEntity.lua</filename>
- </file>
- <file>
- <filename>Hooks\OnPlayerShooting.lua</filename>
- </file>
- <file>
- <filename>Hooks\OnPlayerSpawned.lua</filename>
- </file>
- <file>
- <filename>Hooks\OnPlayerTossingItem.lua</filename>
- </file>
- <file>
- <filename>Hooks\OnPlayerUsedBlock.lua</filename>
- </file>
- <file>
- <filename>Hooks\OnPlayerUsedItem.lua</filename>
- </file>
- <file>
- <filename>Hooks\OnPlayerUsingBlock.lua</filename>
- </file>
- <file>
- <filename>Hooks\OnPlayerUsingItem.lua</filename>
- </file>
- <file>
- <filename>Hooks\OnPluginMessage.lua</filename>
- </file>
- <file>
- <filename>Hooks\OnPostCrafting.lua</filename>
- </file>
- <file>
- <filename>Hooks\OnPreCrafting.lua</filename>
- </file>
- <file>
- <filename>Hooks\OnSpawnedEntity.lua</filename>
- </file>
- <file>
- <filename>Hooks\OnSpawnedMonster.lua</filename>
- </file>
- <file>
- <filename>Hooks\OnSpawningEntity.lua</filename>
- </file>
- <file>
- <filename>Hooks\OnSpawningMonster.lua</filename>
- </file>
- <file>
- <filename>Hooks\OnTakeDamage.lua</filename>
- </file>
- <file>
- <filename>Hooks\OnTick.lua</filename>
- </file>
- <file>
- <filename>Hooks\OnUpdatedSign.lua</filename>
- </file>
- <file>
- <filename>Hooks\OnUpdatingSign.lua</filename>
- </file>
- <file>
- <filename>Hooks\OnWeatherChanged.lua</filename>
- </file>
- <file>
- <filename>Hooks\OnWeatherChanging.lua</filename>
- </file>
- <file>
- <filename>Hooks\OnWorldTick.lua</filename>
- </file>
- <file>
- <filename>Classes\Projectiles.lua</filename>
- </file>
- <file>
- <filename>main_APIDump.lua</filename>
- </file>
-</project>
diff --git a/MCServer/Plugins/APIDump/Classes/BlockEntities.lua b/MCServer/Plugins/APIDump/Classes/BlockEntities.lua
deleted file mode 100644
index daa658654..000000000
--- a/MCServer/Plugins/APIDump/Classes/BlockEntities.lua
+++ /dev/null
@@ -1,322 +0,0 @@
-return
-{
- cBlockEntity =
- {
- Desc = [[
- Block entities are simply blocks in the world that have persistent data, such as the text for a sign
- or contents of a chest. All block entities are also saved in the chunk data of the chunk they reside in.
- The cBlockEntity class acts as a common ancestor for all the individual block entities.
- ]],
-
- Functions =
- {
- GetBlockType = { Params = "", Return = "BLOCKTYPE", Notes = "Returns the blocktype which is represented by this blockentity. This is the primary means of type-identification" },
- GetChunkX = { Params = "", Return = "number", Notes = "Returns the chunk X-coord of the block entity's chunk" },
- GetChunkZ = { Params = "", Return = "number", Notes = "Returns the chunk Z-coord of the block entity's chunk" },
- GetPosX = { Params = "", Return = "number", Notes = "Returns the block X-coord of the block entity's block" },
- GetPosY = { Params = "", Return = "number", Notes = "Returns the block Y-coord of the block entity's block" },
- GetPosZ = { Params = "", Return = "number", Notes = "Returns the block Z-coord of the block entity's block" },
- GetRelX = { Params = "", Return = "number", Notes = "Returns the relative X coord of the block entity's block within the chunk" },
- GetRelZ = { Params = "", Return = "number", Notes = "Returns the relative Z coord of the block entity's block within the chunk" },
- GetWorld = { Params = "", Return = "{{cWorld|cWorld}}", Notes = "Returns the world to which the block entity belongs" },
- },
- },
-
- cBlockEntityWithItems =
- {
- Desc = [[
- This class is a common ancestor for all {{cBlockEntity|block entities}} that provide item storage.
- Internally, the object has a {{cItemGrid|cItemGrid}} object for storing the items; this ItemGrid is
- accessible through the API. The storage is a grid of items, items in it can be addressed either by a slot
- number, or by XY coords within the grid. If a UI window is opened for this block entity, the item storage
- is monitored for changes and the changes are immediately sent to clients of the UI window.
- ]],
-
- Inherits = "cBlockEntity",
-
- Functions =
- {
- GetContents = { Params = "", Return = "{{cItemGrid|cItemGrid}}", Notes = "Returns the cItemGrid object representing the items stored within this block entity" },
- GetSlot =
- {
- { Params = "SlotNum", Return = "{{cItem|cItem}}", Notes = "Returns the cItem for the specified slot number. Returns nil for invalid slot numbers" },
- { Params = "X, Y", Return = "{{cItem|cItem}}", Notes = "Returns the cItem for the specified slot coords. Returns nil for invalid slot coords" },
- },
- SetSlot =
- {
- { Params = "SlotNum, {{cItem|cItem}}", Return = "", Notes = "Sets the cItem for the specified slot number. Ignored if invalid slot number" },
- { Params = "X, Y, {{cItem|cItem}}", Return = "", Notes = "Sets the cItem for the specified slot coords. Ignored if invalid slot coords" },
- },
- },
- },
-
- cBeaconEntity =
- {
- Desc = [[
- A beacon entity is a {{cBlockEntityWithItems|cBlockEntityWithItems}} descendant that represents a beacon
- in the world.
- ]],
-
- Inherits = "cBlockEntityWithItems",
-
- Functions =
- {
- IsActive = { Params = "", Return = "bool", Notes = "Is the beacon active?" },
- GetBeaconLevel = { Params = "", Return = "number", Notes = "Returns the beacon level. (0 - 4)" },
- GetPrimaryEffect = { Params = "", Return = "EffectType", Notes = "Returns the primary effect." },
- GetSecondaryEffect = { Params = "", Return = "EffectType", Notes = "Returns the secondary effect." },
- SetPrimaryEffect = { Params = "EffectType", Return = "bool", Notes = "Select the primary effect. Returns false when the effect is invalid." },
- SetSecondaryEffect = { Params = "EffectType", Return = "bool", Notes = "Select the secondary effect. Returns false when the effect is invalid." },
- CalculatePyramidLevel = { Params = "", Return = "number", Notes = "Calculate the amount of layers the pyramid below the beacon has." },
- IsBeaconBlocked = { Params = "", Return = "bool", Notes = "Is the beacon blocked by non-transparent blocks that are higher than the beacon?" },
- UpdateBeacon = { Params = "", Return = "", Notes = "Update the beacon." },
- GiveEffects = { Params = "", Return = "", Notes = "Give the near-players the effects." },
- IsMineralBlock = { Params = "BLOCKTYPE", Return = "bool", Notes = "Returns true if the block is a diamond block, a golden block, an iron block or an emerald block." },
- IsValidEffect = { Params = "EffectType", Return = "bool", Notes = "Returns true if the effect can be used." },
- },
- },
-
- cChestEntity =
- {
- Desc = [[
- A chest entity is a {{cBlockEntityWithItems|cBlockEntityWithItems}} descendant that represents a chest
- in the world. Note that doublechests consist of two separate cChestEntity objects, they do not collaborate
- in any way.</p>
- <p>
- To manipulate a chest already in the game, you need to use {{cWorld}}'s callback mechanism with
- either DoWithChestAt() or ForEachChestInChunk() function. See the code example below
- ]],
-
- Inherits = "cBlockEntityWithItems",
-
- Constants =
- {
- ContentsHeight = { Notes = "Height of the contents' {{cItemGrid|ItemGrid}}, as required by the parent class, {{cBlockEntityWithItems}}" },
- ContentsWidth = { Notes = "Width of the contents' {{cItemGrid|ItemGrid}}, as required by the parent class, {{cBlockEntityWithItems}}" },
- },
- AdditionalInfo =
- {
- {
- Header = "Code example",
- Contents = [[
- The following example code sets the top-left item of each chest in the same chunk as Player to
- 64 * diamond:
-<pre class="prettyprint lang-lua">
--- Player is a {{cPlayer}} object instance
-local World = Player:GetWorld();
-World:ForEachChestInChunk(Player:GetChunkX(), Player:GetChunkZ(),
- function (ChestEntity)
- ChestEntity:SetSlot(0, 0, cItem(E_ITEM_DIAMOND, 64));
- end
-);
-</pre>
- ]],
- },
- }, -- AdditionalInfo
- },
-
- cDispenserEntity =
- {
- Desc = [[
- This class represents a dispenser block entity in the world. Most of this block entity's
- functionality is implemented in the {{cDropSpenserEntity|cDropSpenserEntity}} class that represents
- the behavior common with a {{cDropperEntity|dropper}} entity.
- ]],
- Inherits = "cDropSpenserEntity",
- },
-
- cDropperEntity =
- {
- Desc = [[
- This class represents a dropper block entity in the world. Most of this block entity's functionality
- is implemented in the {{cDropSpenserEntity|cDropSpenserEntity}} class that represents the behavior
- common with the {{cDispenserEntity|dispenser}} entity.</p>
- <p>
- An object of this class can be created from scratch when generating chunks ({{OnChunkGenerated|OnChunkGenerated}} and {{OnChunkGenerating|OnChunkGenerating}} hooks).
- ]],
- Inherits = "cDropSpenserEntity",
- }, -- cDropperEntity
-
- cDropSpenserEntity =
- {
- Desc = [[
- This is a class that implements behavior common to both {{cDispenserEntity|dispensers}} and {{cDropperEntity|droppers}}.
- ]],
- Functions =
- {
- Activate = { Params = "", Return = "", Notes = "Sets the block entity to dropspense an item in the next tick" },
- AddDropSpenserDir = { Params = "BlockX, BlockY, BlockZ, BlockMeta", Return = "BlockX, BlockY, BlockZ", Notes = "Adjusts the block coords to where the dropspenser items materialize" },
- SetRedstonePower = { Params = "IsPowered", Return = "", Notes = "Sets the redstone status of the dropspenser. If the redstone power goes from off to on, the dropspenser will be activated" },
- },
- Constants =
- {
- ContentsWidth = { Notes = "Width (X) of the {{cItemGrid}} representing the contents" },
- ContentsHeight = { Notes = "Height (Y) of the {{cItemGrid}} representing the contents" },
- },
- Inherits = "cBlockEntityWithItems";
- }, -- cDropSpenserEntity
-
- cFurnaceEntity =
- {
- Desc = [[
- This class represents a furnace block entity in the world.</p>
- <p>
- See also {{cRoot}}'s GetFurnaceRecipe() and GetFurnaceFuelBurnTime() functions
- ]],
- Functions =
- {
- GetCookTimeLeft = { Params = "", Return = "number", Notes = "Returns the time until the current item finishes cooking, in ticks" },
- GetFuelBurnTimeLeft = { Params = "", Return = "number", Notes = "Returns the time until the current fuel is depleted, in ticks" },
- GetFuelSlot = { Params = "", Return = "{{cItem|cItem}}", Notes = "Returns the item in the fuel slot" },
- GetInputSlot = { Params = "", Return = "{{cItem|cItem}}", Notes = "Returns the item in the input slot" },
- GetOutputSlot = { Params = "", Return = "{{cItem|cItem}}", Notes = "Returns the item in the output slot" },
- GetTimeCooked = { Params = "", Return = "number", Notes = "Returns the time that the current item has been cooking, in ticks" },
- HasFuelTimeLeft = { Params = "", Return = "bool", Notes = "Returns true if there's time before the current fuel is depleted" },
- SetFuelSlot = { Params = "{{cItem|cItem}}", Return = "", Notes = "Sets the item in the fuel slot" },
- SetInputSlot = { Params = "{{cItem|cItem}}", Return = "", Notes = "Sets the item in the input slot" },
- SetOutputSlot = { Params = "{{cItem|cItem}}", Return = "", Notes = "Sets the item in the output slot" },
- },
- Constants =
- {
- fsInput = { Notes = "Index of the input slot" },
- fsFuel = { Notes = "Index of the fuel slot" },
- fsOutput = { Notes = "Index of the output slot" },
- ContentsWidth = { Notes = "Width (X) of the {{cItemGrid|cItemGrid}} representing the contents" },
- ContentsHeight = { Notes = "Height (Y) of the {{cItemGrid|cItemGrid}} representing the contents" },
- },
- ConstantGroups =
- {
- SlotIndices =
- {
- Include = "fs.*",
- TextBefore = "When using the GetSlot() or SetSlot() function, use these constants for slot index:",
- },
- },
- Inherits = "cBlockEntityWithItems"
- }, -- cFurnaceEntity
-
- cHopperEntity =
- {
- Desc = [[
- This class represents a hopper block entity in the world.
- ]],
- Functions =
- {
- GetOutputBlockPos = { Params = "BlockMeta", Return = "bool, BlockX, BlockY, BlockZ", Notes = "Returns whether the hopper is attached, and if so, the block coords of the block receiving the output items, based on the given meta." },
- },
- Constants =
- {
- ContentsHeight = { Notes = "Height (Y) of the internal {{cItemGrid}} representing the hopper contents." },
- ContentsWidth = { Notes = "Width (X) of the internal {{cItemGrid}} representing the hopper contents." },
- TICKS_PER_TRANSFER = { Notes = "Number of ticks between when the hopper transfers items." },
- },
- Inherits = "cBlockEntityWithItems",
- }, -- cHopperEntity
-
- cJukeboxEntity =
- {
- Desc = [[
- This class represents a jukebox in the world. It can play the records, either when the
- {{cPlayer|player}} uses the record on the jukebox, or when a plugin instructs it to play.
- ]],
- Inherits = "cBlockEntity",
- Functions =
- {
- EjectRecord = { Params = "", Return = "bool", Notes = "Ejects the current record as a {{cPickup|pickup}}. No action if there's no current record. To remove record without generating the pickup, use SetRecord(0). Returns true if pickup ejected." },
- GetRecord = { Params = "", Return = "number", Notes = "Returns the record currently present. Zero for no record, E_ITEM_*_DISC for records." },
- IsPlayingRecord = { Params = "", Return = "bool", Notes = "Returns true if the jukebox is playing a record." },
- IsRecordItem = { Params = "ItemType", Return = "bool", Notes = "Returns true if the specified item is a record that can be played." },
- PlayRecord = { Params = "RecordItemType", Return = "bool", Notes = "Plays the specified Record. Return false if the parameter isn't a playable Record (E_ITEM_XXX_DISC). If there is a record already playing, ejects it first." },
- SetRecord = { Params = "number", Return = "", Notes = "Sets the currently present record. Use zero for no record, or E_ITEM_*_DISC for records." },
- },
- }, -- cJukeboxEntity
-
- cMobHeadEntity =
- {
- Desc = [[
- This class represents a mob head block entity in the world.
- ]],
- Inherits = "cBlockEntity",
- Functions =
- {
- SetType = { Params = "eMobHeadType", Return = "", Notes = "Set the type of the mob head" },
- SetRotation = { Params = "eMobHeadRotation", Return = "", Notes = "Sets the rotation of the mob head" },
- SetOwner = { Params = "string", Return = "", Notes = "Set the player name for mob heads with player type" },
- GetType = { Params = "", Return = "eMobHeadType", Notes = "Returns the type of the mob head" },
- GetRotation = { Params = "", Return = "eMobHeadRotation", Notes = "Returns the rotation of the mob head" },
- GetOwner = { Params = "", Return = "string", Notes = "Returns the player name of the mob head" },
- },
- }, -- cMobHeadEntity
-
- cMobSpawnerEntity =
- {
- Desc = [[
- This class represents a mob spawner block entity in the world.
- ]],
- Inherits = "cBlockEntity",
- Functions =
- {
- UpdateActiveState = { Params = "", Return = "", Notes = "Upate the active flag from the mob spawner. This function will called every 5 seconds from the Tick() function." },
- ResetTimer = { Params = "", Return = "", Notes = "Sets the spawn delay to a new random value." },
- SpawnEntity = { Params = "", Return = "", Notes = "Spawns the entity. This function automaticly change the spawn delay!" },
- GetEntity = { Params = "", Return = "{{Globals#MobType|MobType}}", Notes = "Returns the entity type that will be spawn by this mob spawner." },
- SetEntity = { Params = "{{Globals#MobType|MobType}}", Return = "", Notes = "Sets the entity type who will be spawn by this mob spawner." },
- GetSpawnDelay = { Params = "", Return = "number", Notes = "Returns the spawn delay. This is the tick delay that is needed to spawn new monsters." },
- SetSpawnDelay = { Params = "number", Return = "", Notes = "Sets the spawn delay." },
- GetNearbyPlayersNum = { Params = "", Return = "number", Notes = "Returns the amount of the nearby players in a 16-block radius." },
- GetNearbyMonsterNum = { Params = "", Return = "number", Notes = "Returns the amount of this monster type in a 8-block radius (Y: 4-block radius)." },
- },
- }, -- cMobSpawnerEntity
-
- cNoteEntity =
- {
- Desc = [[
- This class represents a note block entity in the world. It takes care of the note block's pitch,
- and also can play the sound, either when the {{cPlayer|player}} right-clicks it, redstone activates
- it, or upon a plugin's request.</p>
- <p>
- The pitch is stored as an integer between 0 and 24.
- ]],
- Functions =
- {
- GetPitch = { Params = "", Return = "number", Notes = "Returns the current pitch set for the block" },
- IncrementPitch = { Params = "", Return = "", Notes = "Adds 1 to the current pitch. Wraps around to 0 when the pitch cannot go any higher." },
- MakeSound = { Params = "", Return = "", Notes = "Plays the sound for all {{cClientHandle|clients}} near this block." },
- SetPitch = { Params = "Pitch", Return = "", Notes = "Sets a new pitch for the block." },
- },
- Inherits = "cBlockEntity",
- }, -- cNoteEntity
-
- cSignEntity =
- {
- Desc = [[
- A sign entity represents a sign in the world. This class is only used when generating chunks, so
- that the plugins may generate signs within new chunks. See the code example in {{cChunkDesc}}.
- ]],
- Functions =
- {
- GetLine = { Params = "LineIndex", Return = "string", Notes = "Returns the specified line. LineIndex is expected between 0 and 3. Returns empty string and logs to server console when LineIndex is invalid." },
- SetLine = { Params = "LineIndex, LineText", Return = "", Notes = "Sets the specified line. LineIndex is expected between 0 and 3. Logs to server console when LineIndex is invalid." },
- SetLines = { Params = "Line1, Line2, Line3, Line4", Return = "", Notes = "Sets all the sign's lines at once." },
- },
- Inherits = "cBlockEntity";
- }, -- cSignEntity
-
- cFlowerPotEntity =
- {
- Desc = [[
- This class represents a flower pot entity in the world.
- ]],
- Functions =
- {
- IsItemInPot = { Params = "", Return = "bool", Notes = "Is a flower in the pot?" },
- GetItem = { Params = "", Return = "{{cItem|Item}}", Notes = "Returns the item in the flower pot." },
- SetItem = { Params = "{{cItem|Item}}", Return = "", Notes = "Set the item in the flower pot" },
- },
- Inherits = "cBlockEntity";
- }, -- cFlowerPotEntity
-}
-
-
-
-
diff --git a/MCServer/Plugins/APIDump/Classes/Geometry.lua b/MCServer/Plugins/APIDump/Classes/Geometry.lua
deleted file mode 100644
index 36bd222a6..000000000
--- a/MCServer/Plugins/APIDump/Classes/Geometry.lua
+++ /dev/null
@@ -1,332 +0,0 @@
-
--- Geometry.lua
-
--- Defines the documentation for geometry-related classes:
--- cBoundingBox, cCuboid, cLineBlockTracer, cTracer, Vector3X
-
-
-
-
-return
-{
- cBoundingBox =
- {
- Desc = [[
- Represents two sets of coordinates, minimum and maximum for each direction; thus defining an
- axis-aligned cuboid with floating-point boundaries. It supports operations changing the size and
- position of the box, as well as querying whether a point or another BoundingBox is inside the box.</p>
- <p>
- All the points within the coordinate limits (inclusive the edges) are considered "inside" the box.
- However, for intersection purposes, if the intersection is "sharp" in any coord (min1 == max2, i. e.
- zero volume), the boxes are considered non-intersecting.</p>
- ]],
- Functions =
- {
- constructor =
- {
- { Params = "MinX, MaxX, MinY, MaxY, MinZ, MaxZ", Return = "cBoundingBox", Notes = "Creates a new bounding box with the specified edges" },
- { Params = "{{Vector3d|Min}}, {{Vector3d|Max}}", Return = "cBoundingBox", Notes = "Creates a new bounding box with the coords specified as two vectors" },
- { Params = "{{Vector3d|Pos}}, Radius, Height", Return = "cBoundingBox", Notes = "Creates a new bounding box from the position given and radius (X/Z) and height. Radius is added from X/Z to calculate the maximum coords and subtracted from X/Z to get the minimum; minimum Y is set to Pos.y and maxumim Y to Pos.y plus Height. This corresponds with how {{cEntity|entities}} are represented in Minecraft." },
- { Params = "OtherBoundingBox", Return = "cBoundingBox", Notes = "Creates a new copy of the given bounding box. Same result can be achieved by using a simple assignment." },
- },
- CalcLineIntersection = { Params = "{{Vector3d|LineStart}}, {{Vector3d|LinePt2}}", Return = "DoesIntersect, LineCoeff, Face", Notes = "Calculates the intersection of a ray (half-line), given by two of its points, with the bounding box. Returns false if the line doesn't intersect the bounding box, or true, together with coefficient of the intersection (how much of the difference between the two ray points is needed to reach the intersection), and the face of the box which is intersected.<br /><b>TODO</b>: Lua binding for this function is wrong atm." },
- DoesIntersect = { Params = "OtherBoundingBox", Return = "bool", Notes = "Returns true if the two bounding boxes have an intersection of nonzero volume." },
- Expand = { Params = "ExpandX, ExpandY, ExpandZ", Return = "", Notes = "Expands this bounding box by the specified amount in each direction (so the box becomes larger by 2 * Expand in each axis)." },
- IsInside =
- {
- { Params = "{{Vector3d|Point}}", Return = "bool", Notes = "Returns true if the specified point is inside (including on the edge) of the box." },
- { Params = "PointX, PointY, PointZ", Return = "bool", Notes = "Returns true if the specified point is inside (including on the edge) of the box." },
- { Params = "OtherBoundingBox", Return = "bool", Notes = "Returns true if OtherBoundingBox is inside of this box." },
- { Params = "{{Vector3d|OtherBoxMin}}, {{Vector3d|OtherBoxMax}}", Return = "bool", Notes = "Returns true if the other bounding box, specified by its 2 corners, is inside of this box." },
- },
- Move =
- {
- { Params = "OffsetX, OffsetY, OffsetZ", Return = "", Notes = "Moves the bounding box by the specified offset in each axis" },
- { Params = "{{Vector3d|Offset}}", Return = "", Notes = "Moves the bounding box by the specified offset in each axis" },
- },
- Union = { Params = "OtherBoundingBox", Return = "cBoundingBox", Notes = "Returns the smallest bounding box that contains both OtherBoundingBox and this bounding box. Note that unlike the strict geometrical meaning of \"union\", this operation actually returns a cBoundingBox." },
- },
- }, -- cBoundingBox
-
-
- cCuboid =
- {
- Desc = [[
- cCuboid offers some native support for integral-boundary cuboids. A cuboid internally consists of
- two {{Vector3i}}-s. By default the cuboid doesn't make any assumptions about the defining points,
- but for most of the operations in the cCuboid class, the p1 member variable is expected to be the
- minima and the p2 variable the maxima. The Sort() function guarantees this condition.</p>
- <p>
- The Cuboid considers both its edges inclusive.</p>
- ]],
- Functions =
- {
- constructor =
- {
- { Params = "", Return = "cCuboid", Notes = "Creates a new Cuboid object with all-zero coords" },
- { Params = "OtherCuboid", Return = "cCuboid", Notes = "Creates a new Cuboid object as a copy of OtherCuboid" },
- { Params = "{{Vector3i|Point1}}, {{Vector3i|Point2}}", Return = "cCuboid", Notes = "Creates a new Cuboid object with the specified points as its corners." },
- { Params = "X, Y, Z", Return = "cCuboid", Notes = "Creates a new Cuboid object with the specified point as both its corners (the cuboid has a size of 1 in each direction)." },
- { Params = "X1, Y1, Z1, X2, Y2, Z2", Return = "cCuboid", Notes = "Creates a new Cuboid object with the specified points as its corners." },
- },
- Assign =
- {
- { Params = "SrcCuboid", Return = "", Notes = "Copies all the coords from the src cuboid to this cuboid. Sort-state is ignored." },
- { Params = "X1, Y1, Z1, X2, Y2, Z2", Return = "", Notes = "Assigns all the coords to the specified values. Sort-state is ignored." },
- },
- ClampX = { Params = "MinX, MaxX", Return = "", Notes = "Clamps both X coords into the range provided. Sortedness-agnostic." },
- ClampY = { Params = "MinY, MaxY", Return = "", Notes = "Clamps both Y coords into the range provided. Sortedness-agnostic." },
- ClampZ = { Params = "MinZ, MaxZ", Return = "", Notes = "Clamps both Z coords into the range provided. Sortedness-agnostic." },
- DifX = { Params = "", Return = "number", Notes = "Returns the difference between the two X coords (X-size minus 1). Assumes sorted." },
- DifY = { Params = "", Return = "number", Notes = "Returns the difference between the two Y coords (Y-size minus 1). Assumes sorted." },
- DifZ = { Params = "", Return = "number", Notes = "Returns the difference between the two Z coords (Z-size minus 1). Assumes sorted." },
- DoesIntersect = { Params = "OtherCuboid", Return = "bool", Notes = "Returns true if this cuboid has at least one voxel in common with OtherCuboid. Note that edges are considered inclusive. Assumes both sorted." },
- Engulf = { Params = "{{Vector3i|Point}}", Return = "", Notes = "If needed, expands the cuboid to include the specified point. Doesn't shrink. Assumes sorted. " },
- Expand = { Params = "SubMinX, AddMaxX, SubMinY, AddMaxY, SubMinZ, AddMaxZ", Return = "", Notes = "Expands the cuboid by the specified amount in each direction. Works on unsorted cuboids as well. NOTE: this function doesn't check for underflows." },
- GetVolume = { Params = "", Return = "number", Notes = "Returns the volume of the cuboid, in blocks. Note that the volume considers both coords inclusive. Works on unsorted cuboids, too." },
- IsCompletelyInside = { Params = "OuterCuboid", Return = "bool", Notes = "Returns true if this cuboid is completely inside (in all directions) in OuterCuboid. Assumes both sorted." },
- IsInside =
- {
- { Params = "X, Y, Z", Return = "bool", Notes = "Returns true if the specified point (integral coords) is inside this cuboid. Assumes sorted." },
- { Params = "{{Vector3i|Point}}", Return = "bool", Notes = "Returns true if the specified point (integral coords) is inside this cuboid. Assumes sorted." },
- { Params = "{{Vector3d|Point}}", Return = "bool", Notes = "Returns true if the specified point (floating-point coords) is inside this cuboid. Assumes sorted." },
- },
- IsSorted = { Params = "", Return = "bool", Notes = "Returns true if this cuboid is sorted" },
- Move = { Params = "OffsetX, OffsetY, OffsetZ", Return = "", Notes = "Adds the specified offsets to each respective coord, effectively moving the Cuboid. Sort-state is ignored and preserved." },
- Sort = { Params = "", Return = "" , Notes = "Sorts the internal representation so that p1 contains the lesser coords and p2 contains the greater coords." },
- },
- Variables =
- {
- p1 = { Type = "{{Vector3i}}", Notes = "The first corner. Usually the lesser of the two coords in each set" },
- p2 = { Type = "{{Vector3i}}", Notes = "The second corner. Usually the larger of the two coords in each set" },
- },
- }, -- cCuboid
-
-
- cLineBlockTracer =
- {
- Desc = [[This class provides an easy-to-use interface for tracing lines through individual
-blocks in the world. It will call the provided callbacks according to what events it encounters along the
-way.</p>
-<p>
-For the Lua API, there's only one static function exported that takes all the parameters necessary to do
-the tracing. The Callbacks parameter is a table containing all the functions that will be called upon the
-various events. See below for further information.
- ]],
- Functions =
- {
- Trace = { Params = "{{cWorld}}, Callbacks, StartX, StartY, StartZ, EndX, EndY, EndZ", Return = "bool", Notes = "(STATIC) Performs the trace on the specified line. Returns true if the entire trace was processed (no callback returned true)" },
- },
-
- AdditionalInfo =
- {
- {
- Header = "Callbacks",
- Contents = [[
-The Callbacks in the Trace() function is a table that contains named functions. Cuberite will call
-individual functions from that table for the events that occur on the line - hitting a block, going out of
-valid world data etc. The following table lists all the available callbacks. If the callback function is
-not defined, Cuberite skips it. Each function can return a bool value, if it returns true, the tracing is
-aborted and Trace() returns false.</p>
-<p>
-<table><tr><th>Name</th><th>Parameters</th><th>Notes</th></tr>
-<tr><td>OnNextBlock</td><td>BlockX, BlockY, BlockZ, BlockType, BlockMeta, EntryFace</td>
- <td>Called when the ray hits a new valid block. The block type and meta is given. EntryFace is one of the
- BLOCK_FACE_ constants indicating which "side" of the block got hit by the ray.</td></tr>
-<tr><td>OnNextBlockNoData</td><td>BlockX, BlockY, BlockZ, EntryFace</td>
- <td>Called when the ray hits a new block, but the block is in an unloaded chunk - no valid data is
- available. Only the coords and the entry face are given.</td></tr>
-<tr><td>OnOutOfWorld</td><td>X, Y, Z</td>
- <td>Called when the ray goes outside of the world (Y-wise); the coords specify the exact exit point. Note
- that for other paths than lines (considered for future implementations) the path may leave the world and
- go back in again later, in such a case this callback is followed by OnIntoWorld() and further
- OnNextBlock() calls.</td></tr>
-<tr><td>OnIntoWorld</td><td>X, Y, Z</td>
- <td>Called when the ray enters the world (Y-wise); the coords specify the exact entry point.</td></tr>
-<tr><td>OnNoMoreHits</td><td>&nbsp;</td>
- <td>Called when the path is sure not to hit any more blocks. This is the final callback, no more
- callbacks are called after this function. Unlike the other callbacks, this function doesn't have a return
- value.</td></tr>
-<tr><td>OnNoChunk</td><td>&nbsp;</td>
- <td>Called when the ray enters a chunk that is not loaded. This usually means that the tracing is aborted.
- Unlike the other callbacks, this function doesn't have a return value.</td></tr>
-</table>
- ]],
- },
- {
- Header = "Example",
- Contents = [[
-<p>The following example is taken from the Debuggers plugin. It is a command handler function for the
-"/spidey" command that creates a line of cobweb blocks from the player's eyes up to 50 blocks away in
-the direction they're looking, but only through the air.
-<pre class="prettyprint lang-lua">
-function HandleSpideyCmd(a_Split, a_Player)
- local World = a_Player:GetWorld();
-
- local Callbacks = {
- OnNextBlock = function(a_BlockX, a_BlockY, a_BlockZ, a_BlockType, a_BlockMeta)
- if (a_BlockType ~= E_BLOCK_AIR) then
- -- abort the trace
- return true;
- end
- World:SetBlock(a_BlockX, a_BlockY, a_BlockZ, E_BLOCK_COBWEB, 0);
- end
- };
-
- local EyePos = a_Player:GetEyePosition();
- local LookVector = a_Player:GetLookVector();
- LookVector:Normalize(); -- Make the vector 1 m long
-
- -- Start cca 2 blocks away from the eyes
- local Start = EyePos + LookVector + LookVector;
- local End = EyePos + LookVector * 50;
-
- cLineBlockTracer.Trace(World, Callbacks, Start.x, Start.y, Start.z, End.x, End.y, End.z);
-
- return true;
-end
-</pre>
-</p>
- ]],
- },
- }, -- AdditionalInfo
- }, -- cLineBlockTracer
-
-
- cTracer =
- {
- Desc = [[
- A cTracer object is used to trace lines in the world. One thing you can use the cTracer for, is
- tracing what block a player is looking at, but you can do more with it if you want.</p>
- <p>
- The cTracer is still a work in progress.</p>
- <p>
- See also the {{cLineBlockTracer}} class for an alternative approach using callbacks.
- ]],
- Functions =
- {
- },
- }, -- cTracer
-
-
- Vector3d =
- {
- Desc = [[
- A Vector3d object uses double precision floating point values to describe a point in 3D space.</p>
- <p>
- See also {{Vector3f}} for single-precision floating point 3D coords and {{Vector3i}} for integer
- 3D coords.
- ]],
- Functions =
- {
- constructor =
- {
- { Params = "{{Vector3f}}", Return = "Vector3d", Notes = "Creates a new Vector3d object by copying the coords from the given Vector3f." },
- { Params = "", Return = "Vector3d", Notes = "Creates a new Vector3d object with all its coords set to 0." },
- { Params = "X, Y, Z", Return = "Vector3d", Notes = "Creates a new Vector3d object with its coords set to the specified values." },
- },
- operator_div = { Params = "number", Return = "Vector3d", Notes = "Returns a new Vector3d with each coord divided by the specified number." },
- operator_mul = { Params = "number", Return = "Vector3d", Notes = "Returns a new Vector3d with each coord multiplied." },
- operator_sub = { Params = "Vector3d", Return = "Vector3d", Notes = "Returns a new Vector3d containing the difference between this object and the specified vector." },
- operator_plus = {Params = "Vector3d", Return = "Vector3d", Notes = "Returns a new Vector3d containing the sum of this vector and the specified vector" },
- Cross = { Params = "Vector3d", Return = "Vector3d", Notes = "Returns a new Vector3d that is a {{http://en.wikipedia.org/wiki/Cross_product|cross product}} of this vector and the specified vector." },
- Dot = { Params = "Vector3d", Return = "number", Notes = "Returns the dot product of this vector and the specified vector." },
- Equals = { Params = "Vector3d", Return = "bool", Notes = "Returns true if this vector is exactly equal to the specified vector." },
- Length = { Params = "", Return = "number", Notes = "Returns the (euclidean) length of the vector." },
- LineCoeffToXYPlane = { Params = "Vector3d, Z", Return = "number", Notes = "Returns the coefficient for the line from the specified vector through this vector to reach the specified Z coord. The result satisfies the following equation: (this + Result * (Param - this)).z = Z. Returns the NO_INTERSECTION constant if there's no intersection." },
- LineCoeffToXZPlane = { Params = "Vector3d, Y", Return = "number", Notes = "Returns the coefficient for the line from the specified vector through this vector to reach the specified Y coord. The result satisfies the following equation: (this + Result * (Param - this)).y = Y. Returns the NO_INTERSECTION constant if there's no intersection." },
- LineCoeffToYZPlane = { Params = "Vector3d, X", Return = "number", Notes = "Returns the coefficient for the line from the specified vector through this vector to reach the specified X coord. The result satisfies the following equation: (this + Result * (Param - this)).x = X. Returns the NO_INTERSECTION constant if there's no intersection." },
- Normalize = { Params = "", Return = "", Notes = "Changes this vector so that it keeps current direction but is exactly 1 unit long. FIXME: Fails for a zero vector." },
- NormalizeCopy = { Params = "", Return = "Vector3d", Notes = "Returns a new vector that has the same directino as this but is exactly 1 unit long. FIXME: Fails for a zero vector." },
- Set = { Params = "X, Y, Z", Return = "", Notes = "Sets all the coords in this object." },
- SqrLength = { Params = "", Return = "number", Notes = "Returns the (euclidean) length of this vector, squared. This operation is slightly less computationally expensive than Length(), while it conserves some properties of Length(), such as comparison. " },
- },
- Constants =
- {
- EPS = { Notes = "The max difference between two coords for which the coords are assumed equal (in LineCoeffToXYPlane() et al)." },
- NO_INTERSECTION = { Notes = "Special return value for the LineCoeffToXYPlane() et al meaning that there's no intersectino with the plane." },
- },
- Variables =
- {
- x = { Type = "number", Notes = "The X coord of the vector." },
- y = { Type = "number", Notes = "The Y coord of the vector." },
- z = { Type = "number", Notes = "The Z coord of the vector." },
- },
- }, -- Vector3d
-
- Vector3f =
- {
- Desc = [[
- A Vector3f object uses floating point values to describe a point in space.</p>
- <p>
- See also {{Vector3d}} for double-precision floating point 3D coords and {{Vector3i}} for integer
- 3D coords.
- ]],
- Functions =
- {
- constructor =
- {
- { Params = "", Return = "Vector3f", Notes = "Creates a new Vector3f object with zero coords" },
- { Params = "x, y, z", Return = "Vector3f", Notes = "Creates a new Vector3f object with the specified coords" },
- { Params = "Vector3f", Return = "Vector3f", Notes = "Creates a new Vector3f object as a copy of the specified vector" },
- { Params = "{{Vector3d}}", Return = "Vector3f", Notes = "Creates a new Vector3f object as a copy of the specified {{Vector3d}}" },
- { Params = "{{Vector3i}}", Return = "Vector3f", Notes = "Creates a new Vector3f object as a copy of the specified {{Vector3i}}" },
- },
- operator_mul =
- {
- { Params = "number", Return = "Vector3f", Notes = "Returns a new Vector3f object that has each of its coords multiplied by the specified number" },
- { Params = "Vector3f", Return = "Vector3f", Notes = "Returns a new Vector3f object that has each of its coords multiplied by the respective coord of the specified vector." },
- },
- operator_plus = { Params = "Vector3f", Return = "Vector3f", Notes = "Returns a new Vector3f object that holds the vector sum of this vector and the specified vector." },
- operator_sub = { Params = "Vector3f", Return = "Vector3f", Notes = "Returns a new Vector3f object that holds the vector differrence between this vector and the specified vector." },
- Cross = { Params = "Vector3f", Return = "Vector3f", Notes = "Returns a new Vector3f object that holds the cross product of this vector and the specified vector." },
- Dot = { Params = "Vector3f", Return = "number", Notes = "Returns the dot product of this vector and the specified vector." },
- Equals = { Params = "Vector3f", Return = "bool", Notes = "Returns true if the specified vector is exactly equal to this vector." },
- Length = { Params = "", Return = "number", Notes = "Returns the (euclidean) length of this vector" },
- Normalize = { Params = "", Return = "", Notes = "Normalizes this vector (makes it 1 unit long while keeping the direction). FIXME: Fails for zero vectors." },
- NormalizeCopy = { Params = "", Return = "Vector3f", Notes = "Returns a copy of this vector that is normalized (1 unit long while keeping the same direction). FIXME: Fails for zero vectors." },
- Set = { Params = "x, y, z", Return = "", Notes = "Sets all the coords of the vector at once." },
- SqrLength = { Params = "", Return = "number", Notes = "Returns the (euclidean) length of this vector, squared. This operation is slightly less computationally expensive than Length(), while it conserves some properties of Length(), such as comparison." },
- },
- Variables =
- {
- x = { Type = "number", Notes = "The X coord of the vector." },
- y = { Type = "number", Notes = "The Y coord of the vector." },
- z = { Type = "number", Notes = "The Z coord of the vector." },
- },
- }, -- Vector3f
-
- Vector3i =
- {
- Desc = [[
- A Vector3i object uses integer values to describe a point in space.</p>
- <p>
- See also {{Vector3d}} for double-precision floating point 3D coords and {{Vector3f}} for
- single-precision floating point 3D coords.
- ]],
- Functions =
- {
- constructor =
- {
- { Params = "", Return = "Vector3i", Notes = "Creates a new Vector3i object with zero coords." },
- { Params = "x, y, z", Return = "Vector3i", Notes = "Creates a new Vector3i object with the specified coords." },
- { Params = "{{Vector3d}}", Return = "Vector3i", Notes = "Creates a new Vector3i object with coords copied and floor()-ed from the specified {{Vector3d}}." },
- },
- Equals = { Params = "Vector3i", Return = "bool", Notes = "Returns true if this vector is exactly the same as the specified vector." },
- Length = { Params = "", Return = "number", Notes = "Returns the (euclidean) length of this vector." },
- Move = { Params = "X, Y, Z", Return = "", Notes = "Moves the vector by the specified amount in each axis direction." },
- Set = { Params = "x, y, z", Return = "", Notes = "Sets all the coords of the vector at once" },
- SqrLength = { Params = "", Return = "number", Notes = "Returns the (euclidean) length of this vector, squared. This operation is slightly less computationally expensive than Length(), while it conserves some properties of Length(), such as comparison." },
- },
- Variables =
- {
- x = { Type = "number", Notes = "The X coord of the vector." },
- y = { Type = "number", Notes = "The Y coord of the vector." },
- z = { Type = "number", Notes = "The Z coord of the vector." },
- },
- }, -- Vector3i
-}
-
-
-
-
diff --git a/MCServer/Plugins/APIDump/Classes/Network.lua b/MCServer/Plugins/APIDump/Classes/Network.lua
deleted file mode 100644
index c7626562d..000000000
--- a/MCServer/Plugins/APIDump/Classes/Network.lua
+++ /dev/null
@@ -1,372 +0,0 @@
-
--- Network.lua
-
--- Defines the documentation for the cNetwork-related classes
-
-
-
-
-
-return
-{
- cNetwork =
- {
- Desc =
- [[
- This is the namespace for high-level network-related operations. Allows plugins to make TCP
- connections to the outside world using a callback-based API.</p>
- <p>
- All functions in this namespace are static, they should be called on the cNetwork class itself:
-<pre class="prettyprint lang-lua">
-local Server = cNetwork:Listen(1024, ListenCallbacks);
-</pre></p>
- ]],
- AdditionalInfo =
- {
- {
- Header = "Using callbacks",
- Contents =
- [[
- The entire Networking API is callback-based. Whenever an event happens on the network object, a
- specific plugin-provided function is called. The callbacks are stored in tables which are passed
- to the API functions, each table contains multiple callbacks for the various situations.</p>
- <p>
- There are four different callback variants used: LinkCallbacks, LookupCallbacks, ListenCallbacks
- and UDPCallbacks. Each is used in the situation appropriate by its name - LinkCallbacks are used
- for handling the traffic on a single network link (plus additionally creation of such link when
- connecting as a client), LookupCallbacks are used when doing DNS and reverse-DNS lookups,
- ListenCallbacks are used for handling incoming connections as a server and UDPCallbacks are used
- for incoming UDP datagrams.</p>
- <p>
- LinkCallbacks have the following structure:<br/>
-<pre class="prettyprint lang-lua">
-local LinkCallbacks =
-{
- OnConnected = function ({{cTCPLink|a_TCPLink}})
- -- The specified {{cTCPLink|link}} has succeeded in connecting to the remote server.
- -- Only called if the link is being connected as a client (using cNetwork:Connect() )
- -- Not used for incoming server links
- -- All returned values are ignored
- end,
-
- OnError = function ({{cTCPLink|a_TCPLink}}, a_ErrorCode, a_ErrorMsg)
- -- The specified error has occured on the {{cTCPLink|link}}
- -- No other callback will be called for this link from now on
- -- For a client link being connected, this reports a connection error (destination unreachable etc.)
- -- It is an Undefined Behavior to send data to a_TCPLink in or after this callback
- -- All returned values are ignored
- end,
-
- OnReceivedData = function ({{cTCPLink|a_TCPLink}}, a_Data)
- -- Data has been received on the {{cTCPLink|link}}
- -- Will get called whenever there's new data on the {{cTCPLink|link}}
- -- a_Data contains the raw received data, as a string
- -- All returned values are ignored
- end,
-
- OnRemoteClosed = function ({{cTCPLink|a_TCPLink}})
- -- The remote peer has closed the {{cTCPLink|link}}
- -- The link is already closed, any data sent to it now will be lost
- -- No other callback will be called for this link from now on
- -- All returned values are ignored
- end,
-}
-</pre></p>
- <p>
- LookupCallbacks have the following structure:<br/>
-<pre class="prettyprint lang-lua">
-local LookupCallbacks =
-{
- OnError = function (a_Query, a_ErrorCode, a_ErrorMsg)
- -- The specified error has occured while doing the lookup
- -- a_Query is the hostname or IP being looked up
- -- No other callback will be called for this lookup from now on
- -- All returned values are ignored
- end,
-
- OnFinished = function (a_Query)
- -- There are no more DNS records for this query
- -- a_Query is the hostname or IP being looked up
- -- No other callback will be called for this lookup from now on
- -- All returned values are ignored
- end,
-
- OnNameResolved = function (a_Hostname, a_IP)
- -- A DNS record has been found, the specified hostname resolves to the IP
- -- Called for both Hostname -&gt; IP and IP -&gt; Hostname lookups
- -- May be called multiple times if a hostname resolves to multiple IPs
- -- All returned values are ignored
- end,
-}
-</pre></p>
- <p>
- ListenCallbacks have the following structure:<br/>
-<pre class="prettyprint lang-lua">
-local ListenCallbacks =
-{
- OnAccepted = function ({{cTCPLink|a_TCPLink}})
- -- A new connection has been accepted and a {{cTCPLink|Link}} for it created
- -- It is safe to send data to the link now
- -- All returned values are ignored
- end,
-
- OnError = function (a_ErrorCode, a_ErrorMsg)
- -- The specified error has occured while trying to listen
- -- No other callback will be called for this server handle from now on
- -- This callback is called before the cNetwork:Listen() call returns
- -- All returned values are ignored
- end,
-
- OnIncomingConnection = function (a_RemoteIP, a_RemotePort, a_LocalPort)
- -- A new connection is being accepted, from the specified remote peer
- -- This function needs to return either nil to drop the connection,
- -- or valid LinkCallbacks to use for the new connection's {{cTCPLink|TCPLink}} object
- return SomeLinkCallbacks
- end,
-}
-</pre></p>
- <p>
- UDPCallbacks have the following structure:<br/>
-<pre class="prettyprint lang-lua">
-local UDPCallbacks =
-{
- OnError = function (a_ErrorCode, a_ErrorMsg)
- -- The specified error has occured when trying to listen for incoming UDP datagrams
- -- No other callback will be called for this endpoint from now on
- -- This callback is called before the cNetwork:CreateUDPEndpoint() call returns
- -- All returned values are ignored
- end,
-
- OnReceivedData = function ({{cUDPEndpoint|a_UDPEndpoint}}, a_Data, a_RemotePeer, a_RemotePort)
- -- A datagram has been received on the {{cUDPEndpoint|endpoint}} from the specified remote peer
- -- a_Data contains the raw received data, as a string
- -- All returned values are ignored
- end,
-}
-</pre>
- ]],
- },
-
- {
- Header = "Example client connection",
- Contents =
- [[
- The following example, adapted from the NetworkTest plugin, shows a simple example of a client
- connection using the cNetwork API. It connects to www.google.com on port 80 (http) and sends a http
- request for the front page. It dumps the received data to the console.</p>
- <p>
- First, the callbacks are defined in a table. The OnConnected() callback takes care of sending the http
- request once the socket is connected. The OnReceivedData() callback sends all data to the console. The
- OnError() callback logs any errors. Then, the connection is initiated using the cNetwork::Connect() API
- function.</p>
- <p>
-<pre class="prettyprint lang-lua">
--- Define the callbacks to use for the client connection:
-local ConnectCallbacks =
-{
- OnConnected = function (a_Link)
- -- Connection succeeded, send the http request:
- a_Link:Send("GET / HTTP/1.0\r\nHost: www.google.com\r\n\r\n")
- end,
-
- OnError = function (a_Link, a_ErrorCode, a_ErrorMsg)
- -- Log the error to console:
- LOG("An error has occurred while talking to google.com: " .. a_ErrorCode .. " (" .. a_ErrorMsg .. ")")
- end,
-
- OnReceivedData = function (a_Link, a_Data)
- -- Log the received data to console:
- LOG("Incoming http data:\r\n" .. a_Data)
- end,
-
- OnRemoteClosed = function (a_Link)
- -- Log the event into the console:
- LOG("Connection to www.google.com closed")
- end,
-}
-
--- Connect:
-if not(cNetwork:Connect("www.google.com", 80, ConnectCallbacks)) then
- -- Highly unlikely, but better check for errors
- LOG("Cannot queue connection to www.google.com")
-end
--- Note that the connection is being made on the background,
--- there's no guarantee that it's already connected at this point in code
-</pre>
- ]],
- },
-
- {
- Header = "Example server implementation",
- Contents =
- [[
- The following example, adapted from the NetworkTest plugin, shows a simple example of creating a
- server listening on a TCP port using the cNetwork API. The server listens on port 9876 and for
- each incoming connection it sends a welcome message and then echoes back whatever the client has
- sent ("echo server").</p>
- <p>
- First, the callbacks for the listening server are defined. The most important of those is the
- OnIncomingConnection() callback that must return the LinkCallbacks that will be used for the new
- connection. In our simple scenario each connection uses the same callbacks, so a predefined
- callbacks table is returned; it is, however, possible to define different callbacks for each
- connection. This allows the callbacks to be "personalised", for example by the remote IP or the
- time of connection. The OnAccepted() and OnError() callbacks only log that they occurred, there's
- no processing needed for them.</p>
- <p>
- Finally, the cNetwork:Listen() API function is used to create the listening server. The status of
- the server is checked and if it is successfully listening, it is stored in a global variable, so
- that Lua doesn't garbage-collect it until we actually want the server closed.</p>
- <p>
-<pre class="prettyprint lang-lua">
--- Define the callbacks used for the incoming connections:
-local EchoLinkCallbacks =
-{
- OnConnected = function (a_Link)
- -- This will not be called for a server connection, ever
- assert(false, "Unexpected Connect callback call")
- end,
-
- OnError = function (a_Link, a_ErrorCode, a_ErrorMsg)
- -- Log the error to console:
- local RemoteName = "'" .. a_Link:GetRemoteIP() .. ":" .. a_Link:GetRemotePort() .. "'"
- LOG("An error has occurred while talking to " .. RemoteName .. ": " .. a_ErrorCode .. " (" .. a_ErrorMsg .. ")")
- end,
-
- OnReceivedData = function (a_Link, a_Data)
- -- Send the received data back to the remote peer
- a_Link:Send(Data)
- end,
-
- OnRemoteClosed = function (a_Link)
- -- Log the event into the console:
- local RemoteName = "'" .. a_Link:GetRemoteIP() .. ":" .. a_Link:GetRemotePort() .. "'"
- LOG("Connection to '" .. RemoteName .. "' closed")
- end,
-}
-
--- Define the callbacks used by the server:
-local ListenCallbacks =
-{
- OnAccepted = function (a_Link)
- -- No processing needed, just log that this happened:
- LOG("OnAccepted callback called")
- end,
-
- OnError = function (a_ErrorCode, a_ErrorMsg)
- -- An error has occured while listening for incoming connections, log it:
- LOG("Cannot listen, error " .. a_ErrorCode .. " (" .. a_ErrorMsg .. ")"
- end,
-
- OnIncomingConnection = function (a_RemoteIP, a_RemotePort, a_LocalPort)
- -- A new connection is being accepted, give it the EchoCallbacks
- return EchoLinkCallbacks
- end,
-}
-
--- Start the server:
-local Server = cNetwork:Listen(9876, ListenCallbacks)
-if not(Server:IsListening()) then
- -- The error has been already printed in the OnError() callbacks
- -- Just bail out
- return;
-end
-
--- Store the server globally, so that it stays open:
-g_Server = Server
-
-...
-
--- Elsewhere in the code, when terminating:
--- Close the server and let it be garbage-collected:
-g_Server:Close()
-g_Server = nil
-</pre>
- ]],
- },
- }, -- AdditionalInfo
-
- Functions =
- {
- Connect = { Params = "Host, Port, LinkCallbacks", Return = "bool", Notes = "(STATIC) Begins establishing a (client) TCP connection to the specified host. Uses the LinkCallbacks table to report progress, success, errors and incoming data. Returns false if it fails immediately (bad port value, bad hostname format), true otherwise. Host can be either an IP address or a hostname." },
- CreateUDPEndpoint = { Params = "Port, UDPCallbacks", Return = "{{cUDPEndpoint|UDPEndpoint}}", Notes = "(STATIC) Creates a UDP endpoint that listens for incoming datagrams on the specified port, and can be used to send or broadcast datagrams. Uses the UDPCallbacks to report incoming datagrams or errors. If the endpoint cannot be created, the OnError callback is called with the error details and the returned endpoint will report IsOpen() == false. The plugin needs to store the returned endpoint object for as long as it needs the UDP port open; if the endpoint is garbage-collected by Lua, the socket will be closed and no more incoming data will be reported.<br>If the Port is zero, the OS chooses an available UDP port for the endpoint; use {{cUDPEndpoint}}:GetPort() to query the port number in such case." },
- EnumLocalIPAddresses = { Params = "", Return = "array-table of strings", Notes = "(STATIC) Returns all local IP addresses for network interfaces currently available on the machine." },
- HostnameToIP = { Params = "Host, LookupCallbacks", Return = "bool", Notes = "(STATIC) Begins a DNS lookup to find the IP address(es) for the specified host. Uses the LookupCallbacks table to report progress, success or errors. Returns false if it fails immediately (bad hostname format), true if the lookup started successfully. Host can be either a hostname or an IP address." },
- IPToHostname = { Params = "Address, LookupCallbacks", Return = "bool", Notes = "(STATIC) Begins a reverse-DNS lookup to find out the hostname for the specified IP address. Uses the LookupCallbacks table to report progress, success or errors. Returns false if it fails immediately (bad address format), true if the lookup started successfully." },
- Listen = { Params = "Port, ListenCallbacks", Return = "{{cServerHandle|ServerHandle}}", Notes = "(STATIC) Starts listening on the specified port. Uses the ListenCallbacks to report incoming connections or errors. Returns a {{cServerHandle}} object representing the server. If the listen operation failed, the OnError callback is called with the error details and the returned server handle will report IsListening() == false. The plugin needs to store the server handle object for as long as it needs the server running, if the server handle is garbage-collected by Lua, the listening socket will be closed and all current connections dropped." },
- },
- }, -- cNetwork
-
- cServerHandle =
- {
- Desc =
- [[
- This class provides an interface for TCP sockets listening for a connection. In order to listen, the
- plugin needs to use the {{cNetwork}}:Listen() function to create the listening socket.</p>
- <p>
- Note that when Lua garbage-collects this class, the listening socket is closed. Therefore the plugin
- should keep it referenced in a global variable for as long as it wants the server running.
- ]],
-
- Functions =
- {
- Close = { Params = "", Return = "", Notes = "Closes the listening socket. No more connections will be accepted, and all current connections will be closed." },
- IsListening = { Params = "", Return = "bool", Notes = "Returns true if the socket is listening." },
- },
- }, -- cServerHandle
-
- cTCPLink =
- {
- Desc =
- [[
- This class wraps a single TCP connection, that has been established. Plugins can create these by
- calling {{cNetwork}}:Connect() to connect to a remote server, or by listening using
- {{cNetwork}}:Listen() and accepting incoming connections. The links are callback-based - when an event
- such as incoming data or remote disconnect happens on the link, a specific callback is called. See the
- additional information in {{cNetwork}} documentation for details.</p>
- <p>
- The link can also optionally perform TLS encryption. Plugins can use the StartTLSClient() function to
- start the TLS handshake as the client side. Since that call, the OnReceivedData() callback is
- overridden internally so that the data is first routed through the TLS decryptor, and the plugin's
- callback is only called for the decrypted data, once it starts arriving. The Send function changes its
- behavior so that the data written by the plugin is first encrypted and only then sent over the
- network. Note that calling Send() before the TLS handshake finishes is supported, but the data is
- queued internally and only sent once the TLS handshake is completed.
- ]],
-
- Functions =
- {
- Close = { Params = "", Return = "", Notes = "Closes the link forcefully (TCP RST). There's no guarantee that the last sent data is even being delivered. See also the Shutdown() method." },
- GetLocalIP = { Params = "", Return = "string", Notes = "Returns the IP address of the local endpoint of the TCP connection." },
- GetLocalPort = { Params = "", Return = "number", Notes = "Returns the port of the local endpoint of the TCP connection." },
- GetRemoteIP = { Params = "", Return = "string", Notes = "Returns the IP address of the remote endpoint of the TCP connection." },
- GetRemotePort = { Params = "", Return = "number", Notes = "Returns the port of the remote endpoint of the TCP connection." },
- Send = { Params = "Data", Return = "", Notes = "Sends the data (raw string) to the remote peer. The data is sent asynchronously and there is no report on the success of the send operation, other than the connection being closed or reset by the underlying OS." },
- Shutdown = { Params = "", Return = "", Notes = "Shuts the socket down for sending data. Notifies the remote peer that there will be no more data coming from us (TCP FIN). The data that is in flight will still be delivered. The underlying socket will be closed when the remote end shuts down as well, or after a timeout." },
- StartTLSClient = { Params = "OwnCert, OwnPrivateKey, OwnPrivateKeyPassword", Return = "", Notes = "Starts a TLS handshake on the link, as a client side of the TLS. The Own___ parameters specify the client certificate and its corresponding private key and password; all three parameters are optional and no client certificate is presented to the remote peer if they are not used or all empty. Once the TLS handshake is started by this call, all incoming data is first decrypted before being sent to the OnReceivedData callback, and all outgoing data is queued until the TLS handshake completes, and then sent encrypted over the link." },
- StartTLSServer = { Params = "Certificate, PrivateKey, PrivateKeyPassword, StartTLSData", Return = "", Notes = "Starts a TLS handshake on the link, as a server side of the TLS. The plugin needs to specify the server certificate and its corresponding private key and password. The StartTLSData can contain data that the link has already reported as received but it should be used as part of the TLS handshake. Once the TLS handshake is started by this call, all incoming data is first decrypted before being sent to the OnReceivedData callback, and all outgoing data is queued until the TLS handshake completes, and then sent encrypted over the link." },
- },
- }, -- cTCPLink
-
- cUDPEndpoint =
- {
- Desc =
- [[
- Represents a UDP socket that is listening for incoming datagrams on a UDP port and can send or broadcast datagrams to other peers on the network. Plugins can create an instance of the endpoint by calling {{cNetwork}}:CreateUDPEndpoint(). The endpoints are callback-based - when a datagram is read from the network, the OnRececeivedData() callback is called with details about the datagram. See the additional information in {{cNetwork}} documentation for details.</p>
- <p>
- Note that when Lua garbage-collects this class, the listening socket is closed. Therefore the plugin should keep this object referenced in a global variable for as long as it wants the endpoint open.
- ]],
-
- Functions =
- {
- Close = { Params = "", Return = "", Notes = "Closes the UDP endpoint. No more datagrams will be reported through the callbacks, the UDP port will be closed." },
- EnableBroadcasts = { Params = "", Return = "", Notes = "Some OSes need this call before they allow UDP broadcasts on an endpoint." },
- GetPort = { Params = "", Return = "number", Notes = "Returns the local port number of the UDP endpoint listening for incoming datagrams. Especially useful if the UDP endpoint was created with auto-assign port (0)." },
- IsOpen = { Params = "", Return = "bool", Notes = "Returns true if the UDP endpoint is listening for incoming datagrams." },
- Send = { Params = "RawData, RemoteHost, RemotePort", Return = "bool", Notes = "Sends the specified raw data (string) to the specified remote host. The RemoteHost can be either a hostname or an IP address; if it is a hostname, the endpoint will queue a DNS lookup first, if it is an IP address, the send operation is executed immediately. Returns true if there was no immediate error, false on any failure. Note that the return value needn't represent whether the packet was actually sent, only if it was successfully queued." },
- },
- }, -- cUDPEndpoint
-}
-
-
-
-
diff --git a/MCServer/Plugins/APIDump/Classes/Plugins.lua b/MCServer/Plugins/APIDump/Classes/Plugins.lua
deleted file mode 100644
index 0d0aae04f..000000000
--- a/MCServer/Plugins/APIDump/Classes/Plugins.lua
+++ /dev/null
@@ -1,207 +0,0 @@
-return
-{
- cPlugin =
- {
- Desc = [[cPlugin describes a Lua plugin. This page is dedicated to new-style plugins and contain their functions. Each plugin has its own Plugin object.
-]],
- Functions =
- {
- GetDirectory = { Return = "string", Notes = "<b>OBSOLETE</b>, use GetFolderName() instead!" },
- GetFolderName = { Params = "", Return = "string", Notes = "Returns the name of the folder where the plugin's files are. (APIDump)" },
- GetLoadError = { Params = "", Return = "string", Notes = "If the plugin failed to load, returns the error message for the failure." },
- GetLocalDirectory = { Notes = "<b>OBSOLETE</b>, use GetLocalFolder instead." },
- GetLocalFolder = { Return = "string", Notes = "Returns the path where the plugin's files are. (Plugins/APIDump)" },
- GetName = { Return = "string", Notes = "Returns the name of the plugin." },
- GetStatus = { Params = "", Return = "{{cPluginManager#PluginStatus|PluginStatus}}", Notes = "Returns the status of the plugin (loaded, disabled, unloaded, error, not found)" },
- GetVersion = { Return = "number", Notes = "Returns the version of the plugin." },
- IsLoaded = { Params = "", Return = "", Notes = "" },
- SetName = { Params = "string", Notes = "Sets the name of the Plugin." },
- SetVersion = { Params = "number", Notes = "Sets the version of the plugin." },
- },
- }, -- cPlugin
-
- cPluginLua =
- {
- Desc = "",
- Functions =
- {
- AddWebTab = { Params = "", Return = "", Notes = "Adds a new webadmin tab" },
- },
- Inherits = "cPlugin",
- }, -- cPluginLua
-
- cPluginManager =
- {
- Desc = [[
- This class is used for generic plugin-related functionality. The plugin manager has a list of all
- plugins, can enable or disable plugins, manages hooks and in-game console commands.</p>
- <p>
- Plugins can be identified by either the PluginFolder or PluginName. Note that these two can differ,
- refer to <a href="http://forum.mc-server.org/showthread.php?tid=1877">the forum</a> for detailed discussion.
- <p>
- There is one instance of cPluginManager in Cuberite, to get it, call either
- {{cRoot|cRoot}}:Get():GetPluginManager() or cPluginManager:Get() function.</p>
- <p>
- Note that some functions are "static", that means that they are called using a dot operator instead
- of the colon operator. For example:
-<pre class="prettyprint lang-lua">
-cPluginManager.AddHook(cPluginManager.HOOK_CHAT, OnChatMessage);
-</pre></p>
- ]],
- Functions =
- {
- AddHook =
- {
- { Params = "{{cPluginManager#Hooks|HookType}}, [HookFunction]", Return = "", Notes = "(STATIC) Informs the plugin manager that it should call the specified function when the specified hook event occurs. If a function is not specified, a default global function name is looked up, based on the hook type" },
- { Params = "{{cPlugin|Plugin}}, {{cPluginManager#Hooks|HookType}}, [HookFunction]", Return = "", Notes = "(STATIC, <b>DEPRECATED</b>) Informs the plugin manager that it should call the specified function when the specified hook event occurs. If a function is not specified, a default function name is looked up, based on the hook type. NOTE: This format is deprecated and the server outputs a warning if it is used!" },
- },
- BindCommand =
- {
- { Params = "Command, Permission, Callback, HelpString", Return = "[bool]", Notes = "(STATIC) Binds an in-game command with the specified callback function, permission and help string. By common convention, providing an empty string for HelpString will hide the command from the /help display. Returns true if successful, logs to console and returns no value on error. The callback uses the following signature: <pre class=\"prettyprint lang-lua\">function(Split, {{cPlayer|Player}})</pre> The Split parameter contains an array-table of the words that the player has sent, Player is the {{cPlayer}} object representing the player who sent the command. If the callback returns true, the command is assumed to have executed successfully; in all other cases the server sends a warning to the player that the command is unknown (this is so that subcommands can be implemented)." },
- { Params = "Command, Permission, Callback, HelpString", Return = "[bool]", Notes = "Binds an in-game command with the specified callback function, permission and help string. By common convention, providing an empty string for HelpString will hide the command from the /help display. Returns true if successful, logs to console and returns no value on error. The callback uses the following signature: <pre class=\"prettyprint lang-lua\">function(Split, {{cPlayer|Player}})</pre> The Split parameter contains an array-table of the words that the player has sent, Player is the {{cPlayer}} object representing the player who sent the command. If the callback returns true, the command is assumed to have executed successfully; in all other cases the server sends a warning to the player that the command is unknown (this is so that subcommands can be implemented)." },
- },
- BindConsoleCommand =
- {
- { Params = "Command, Callback, HelpString", Return = "[bool]", Notes = "(STATIC) Binds a console command with the specified callback function and help string. By common convention, providing an empty string for HelpString will hide the command from the \"help\" console command. Returns true if successful, logs to console and returns no value on error. The callback uses the following signature: <pre class=\"prettyprint lang-lua\">function(Split)</pre> The Split parameter contains an array-table of the words that the admin has typed. If the callback returns true, the command is assumed to have executed successfully; in all other cases the server issues a warning to the console that the command is unknown (this is so that subcommands can be implemented)." },
- { Params = "Command, Callback, HelpString", Return = "[bool]", Notes = "Binds a console command with the specified callback function and help string. By common convention, providing an empty string for HelpString will hide the command from the \"help\" console command. Returns true if successful, logs to console and returns no value on error. The callback uses the following signature: <pre class=\"prettyprint lang-lua\">function(Split)</pre> The Split parameter contains an array-table of the words that the admin has typed. If the callback returns true, the command is assumed to have executed successfully; in all other cases the server issues a warning to the console that the command is unknown (this is so that subcommands can be implemented)." },
- },
- CallPlugin = { Params = "PluginName, FunctionName, [FunctionArgs...]", Return = "[FunctionRets]", Notes = "(STATIC) Calls the specified function in the specified plugin, passing all the given arguments to it. If it succeeds, it returns all the values returned by that function. If it fails, returns no value at all. Note that only strings, numbers, bools, nils and classes can be used for parameters and return values; tables and functions cannot be copied across plugins." },
- DoWithPlugin = { Params = "PluginName, CallbackFn", Return = "bool", Notes = "(STATIC) Calls the CallbackFn for the specified plugin, if found. A plugin can be found even if it is currently unloaded, disabled or errored, the callback should check the plugin status. If the plugin is not found, this function returns false, otherwise it returns the bool value that the callback has returned. The CallbackFn has the following signature: <pre class=\"prettyprint lang-lua\">function ({{cPlugin|Plugin}})</pre>" },
- ExecuteCommand = { Params = "{{cPlayer|Player}}, CommandStr", Return = "{{cPluginManager#CommandResult|CommandResult}}", Notes = "Executes the command as if given by the specified Player. Checks permissions." },
- ExecuteConsoleCommand = { Params = "CommandStr", Return = "bool, string", Notes = "Executes the console command as if given by the admin on the console. If the command is successfully executed, returns true and the text that would be output to the console normally. On error it returns false and an error message." },
- FindPlugins = { Params = "", Return = "", Notes = "<b>OBSOLETE</b>, use RefreshPluginList() instead"},
- ForceExecuteCommand = { Params = "{{cPlayer|Player}}, CommandStr", Return = "{{cPluginManager#CommandResult|CommandResult}}", Notes = "Same as ExecuteCommand, but doesn't check permissions" },
- ForEachCommand = { Params = "CallbackFn", Return = "bool", Notes = "Calls the CallbackFn function for each command that has been bound using BindCommand(). The CallbackFn has the following signature: <pre class=\"prettyprint lang-lua\">function(Command, Permission, HelpString)</pre> If the callback returns true, the enumeration is aborted and this API function returns false; if it returns false or no value, the enumeration continues with the next command, and the API function returns true." },
- ForEachConsoleCommand = { Params = "CallbackFn", Return = "bool", Notes = "Calls the CallbackFn function for each command that has been bound using BindConsoleCommand(). The CallbackFn has the following signature: <pre class=\"prettyprint lang-lua\">function (Command, HelpString)</pre> If the callback returns true, the enumeration is aborted and this API function returns false; if it returns false or no value, the enumeration continues with the next command, and the API function returns true." },
- ForEachPlugin = { Params = "CallbackFn", Return = "bool", Notes = "(STATIC) Calls the CallbackFn function for each plugin that is currently discovered by Cuberite (including disabled, unloaded and errrored plugins). The CallbackFn has the following signature: <pre class=\"prettyprint lang-lua\">function ({{cPlugin|Plugin}})</pre> If the callback returns true, the enumeration is aborted and this API function returns false; if it returns false or no value, the enumeration continues with the next command, and the API function returns true." },
- Get = { Params = "", Return = "cPluginManager", Notes = "(STATIC) Returns the single instance of the plugin manager" },
- GetAllPlugins = { Params = "", Return = "table", Notes = "Returns a table (dictionary) of all plugins, [name => value], where value is a valid {{cPlugin}} if the plugin is loaded, or the bool value false if the plugin is not loaded." },
- GetCommandPermission = { Params = "Command", Return = "Permission", Notes = "Returns the permission needed for executing the specified command" },
- GetCurrentPlugin = { Params = "", Return = "{{cPlugin}}", Notes = "Returns the {{cPlugin}} object for the calling plugin. This is the same object that the Initialize function receives as the argument." },
- GetNumLoadedPlugins = { Params = "", Return = "number", Notes = "Returns the number of loaded plugins (psLoaded only)" },
- GetNumPlugins = { Params = "", Return = "number", Notes = "Returns the number of plugins, including the disabled, errored, unloaded and not-found ones" },
- GetPlugin = { Params = "PluginName", Return = "{{cPlugin}}", Notes = "(<b>DEPRECATED, UNSAFE</b>) Returns a plugin handle of the specified plugin, or nil if such plugin is not loaded. Note thatdue to multithreading the handle is not guaranteed to be safe for use when stored - a single-plugin reload may have been triggered in the mean time for the requested plugin." },
- GetPluginsPath = { Params = "", Return = "string", Notes = "Returns the path where the individual plugin folders are located. Doesn't include the path separator at the end of the returned string." },
- IsCommandBound = { Params = "Command", Return = "bool", Notes = "Returns true if in-game Command is already bound (by any plugin)" },
- IsConsoleCommandBound = { Params = "Command", Return = "bool", Notes = "Returns true if console Command is already bound (by any plugin)" },
- IsPluginLoaded = { Params = "PluginName", Return = "", Notes = "Returns true if the specified plugin is loaded." },
- LoadPlugin = { Params = "PluginFolder", Return = "", Notes = "(<b>DEPRECATED</b>) Loads a plugin from the specified folder. NOTE: Loading plugins may be an unsafe operation and may result in a deadlock or a crash. This API is deprecated and might be removed." },
- LogStackTrace = { Params = "", Return = "", Notes = "(STATIC) Logs a current stack trace of the Lua engine to the server console log. Same format as is used when the plugin fails." },
- RefreshPluginList = { Params = "", Return = "", Notes = "Refreshes the list of plugins to include all folders inside the Plugins folder (potentially new disabled plugins)" },
- ReloadPlugins = { Params = "", Return = "", Notes = "Reloads all active plugins" },
- UnloadPlugin = { Params = "PluginName", Return = "", Notes = "Queues the specified plugin to be unloaded. To avoid deadlocks, the unloading happens in the main tick thread asynchronously." },
- },
- ConstantGroups=
- {
- CommandResult =
- {
- Include = "^cr.*",
- TextBefore = [[
- Results that the (Force)ExecuteCommand return. This gives information if the command is executed or not and the reason.
- ]],
- },
- },
- Constants =
- {
- crBlocked = { Notes = "When a plugin stopped the command using the OnExecuteCommand hook" },
- crError = { Notes = "When the command handler for the given command results in an error" },
- crExecuted = { Notes = "When the command is successfully executed." },
- crNoPermission = { Notes = "When the player doesn't have permission to execute the given command." },
- crUnknownCommand = { Notes = "When the given command doesn't exist." },
- HOOK_BLOCK_SPREAD = { Notes = "Called when a block spreads based on world conditions" },
- HOOK_BLOCK_TO_PICKUPS = { Notes = "Called when a block has been dug and is being converted to pickups. The server has provided the default pickups and the plugins may modify them." },
- HOOK_CHAT = { Notes = "Called when a client sends a chat message that is not a command. The plugin may modify the chat message" },
- HOOK_CHUNK_AVAILABLE = { Notes = "Called when a chunk is loaded or generated and becomes available in the {{cWorld|world}}." },
- HOOK_CHUNK_GENERATED = { Notes = "Called after a chunk is generated. A plugin may do last modifications on the generated chunk before it is handed of to the {{cWorld|world}}." },
- HOOK_CHUNK_GENERATING = { Notes = "Called before a chunk is generated. A plugin may override some parts of the generation algorithm." },
- HOOK_CHUNK_UNLOADED = { Notes = "Called after a chunk has been unloaded from a {{cWorld|world}}." },
- HOOK_CHUNK_UNLOADING = { Notes = "Called before a chunk is unloaded from a {{cWorld|world}}. The chunk has already been saved." },
- HOOK_COLLECTING_PICKUP = { Notes = "Called when a player is about to collect a pickup." },
- HOOK_CRAFTING_NO_RECIPE = { Notes = "Called when a player has items in the crafting slots and the server cannot locate any recipe. Plugin may provide a recipe." },
- HOOK_DISCONNECT = { Notes = "Called after the player has disconnected." },
- HOOK_ENTITY_ADD_EFFECT = { Notes = "Called when an effect is being added to an {{cEntity|entity}}. Plugin may refuse the effect." },
- HOOK_ENTITY_TELEPORT = { Notes = "Called when an {{cEntity|entity}} is being teleported. Plugin may refuse the teleportation." },
- HOOK_EXECUTE_COMMAND = { Notes = "Called when a client sends a chat message that is recognized as a command, before handing that command to the regular command handler. A plugin may stop the command from being handled. This hook is called even when the player doesn't have permissions for the command." },
- HOOK_EXPLODED = { Notes = "Called after an explosion has been processed in a {{cWorld|world}}." },
- HOOK_EXPLODING = { Notes = "Called before an explosion is processed in a {{cWorld|world}}. A plugin may alter the explosion parameters or cancel the explosion altogether." },
- HOOK_HANDSHAKE = { Notes = "Called when a Handshake packet is received from a client." },
- HOOK_HOPPER_PULLING_ITEM = { Notes = "Called when a hopper is pulling an item from the container above it." },
- HOOK_HOPPER_PUSHING_ITEM = { Notes = "Called when a hopper is pushing an item into the container it is aimed at." },
- HOOK_KILLING = { Notes = "Called when an entity has just been killed. A plugin may resurrect the entity by setting its health to above zero." },
- HOOK_LOGIN = { Notes = "Called when a Login packet is sent to the client, before the client is queued for authentication." },
- HOOK_PLAYER_ANIMATION = { Notes = "Called when a client send the Animation packet." },
- HOOK_PLAYER_BREAKING_BLOCK = { Notes = "Called when a player is about to break a block. A plugin may cancel the event." },
- HOOK_PLAYER_BROKEN_BLOCK = { Notes = "Called after a player has broken a block." },
- HOOK_PLAYER_DESTROYED = { Notes = "Called when the {{cPlayer}} object is destroyed - a player has disconnected." },
- HOOK_PLAYER_EATING = { Notes = "Called when the player starts eating a held item. Plugins may abort the eating." },
- HOOK_PLAYER_FISHED = { Notes = "Called when the player reels the fishing rod back in, after the server decides the player's fishing reward." },
- HOOK_PLAYER_FISHING = { Notes = "Called when the player reels the fishing rod back in, plugins may alter the fishing reward." },
- HOOK_PLAYER_FOOD_LEVEL_CHANGE = { Notes = "Called when the player's food level is changing. Plugins may refuse the change." },
- HOOK_PLAYER_JOINED = { Notes = "Called when the player entity has been created. It has not yet been fully initialized." },
- HOOK_PLAYER_LEFT_CLICK = { Notes = "Called when the client sends the LeftClick packet." },
- HOOK_PLAYER_MOVING = { Notes = "Called when the player has moved and the movement is now being applied." },
- HOOK_PLAYER_PLACED_BLOCK = { Notes = "Called when the player has just placed a block" },
- HOOK_PLAYER_PLACING_BLOCK = { Notes = "Called when the player is about to place a block. A plugin may cancel the event." },
- HOOK_PLAYER_RIGHT_CLICK = { Notes = "Called when the client sends the RightClick packet." },
- HOOK_PLAYER_RIGHT_CLICKING_ENTITY = { Notes = "Called when the client sends the UseEntity packet." },
- HOOK_PLAYER_SHOOTING = { Notes = "Called when the player releases the mouse button to fire their bow." },
- HOOK_PLAYER_SPAWNED = { Notes = "Called after the player entity has been created. The entity is fully initialized and is spawning in the {{cWorld|world}}." },
- HOOK_PLAYER_TOSSING_ITEM = { Notes = "Called when the player is tossing the held item (keypress Q)" },
- HOOK_PLAYER_USED_BLOCK = { Notes = "Called after the player has right-clicked a block" },
- HOOK_PLAYER_USED_ITEM = { Notes = "Called after the player has right-clicked with a usable item in their hand." },
- HOOK_PLAYER_USING_BLOCK = { Notes = "Called when the player is about to use (right-click) a block" },
- HOOK_PLAYER_USING_ITEM = { Notes = "Called when the player is about to right-click with a usable item in their hand." },
- HOOK_PLUGINS_LOADED = { Notes = "Called after all plugins have loaded." },
- HOOK_PLUGIN_MESSAGE = { Notes = "Called when a PluginMessage packet is received from a client." },
- HOOK_POST_CRAFTING = { Notes = "Called after a valid recipe has been chosen for the current contents of the crafting grid. Plugins may modify the recipe." },
- HOOK_PRE_CRAFTING = { Notes = "Called before a recipe is searched for the current contents of the crafting grid. Plugins may provide a recipe and cancel the built-in search." },
- HOOK_PROJECTILE_HIT_BLOCK = { Notes = "Called when a {{cProjectileEntity|projectile}} hits a block." },
- HOOK_PROJECTILE_HIT_ENTITY = { Notes = "Called when a {{cProjectileEntity|projectile}} hits an {{cEntity|entity}}." },
- HOOK_SERVER_PING = { Notes = "Called when a client pings the server from the server list. Plugins may change the favicon, server description, players online and maximum players values." },
- HOOK_SPAWNED_ENTITY = { Notes = "Called after an entity is spawned in a {{cWorld|world}}. The entity is already part of the world." },
- HOOK_SPAWNED_MONSTER = { Notes = "Called after a mob is spawned in a {{cWorld|world}}. The mob is already part of the world." },
- HOOK_SPAWNING_ENTITY = { Notes = "Called just before an entity is spawned in a {{cWorld|world}}." },
- HOOK_SPAWNING_MONSTER = { Notes = "Called just before a mob is spawned in a {{cWorld|world}}." },
- HOOK_TAKE_DAMAGE = { Notes = "Called when an entity is taking any kind of damage. Plugins may modify the damage value, effects, source or cancel the damage." },
- HOOK_TICK = { Notes = "Called when the main server thread ticks - 20 times a second." },
- HOOK_UPDATED_SIGN = { Notes = "Called after a {{cSignEntity|sign}} text has been updated, either by a player or by any external means." },
- HOOK_UPDATING_SIGN = { Notes = "Called before a {{cSignEntity|sign}} text is updated, either by a player or by any external means." },
- HOOK_WEATHER_CHANGED = { Notes = "Called after the weather has changed." },
- HOOK_WEATHER_CHANGING = { Notes = "Called just before the weather changes" },
- HOOK_WORLD_STARTED = { Notes = "Called when a world has been started." },
- HOOK_WORLD_TICK = { Notes = "Called in each world's tick thread when the game logic is about to tick (20 times a second)." },
-
- psDisabled = { Notes = "The plugin is not enabled in settings.ini" },
- psError = { Notes = "The plugin is enabled in settings.ini, but it has run into an error while loading. Use {{cPlugin}}:GetLoadError() to identify the error." },
- psLoaded = { Notes = "The plugin is enabled and loaded." },
- psNotFound = { Notes = "The plugin has been loaded, but is no longer present on disk." },
- psUnloaded = { Notes = "The plugin is enabled in settings.ini, but it has been unloaded (by a command)." },
- }, -- constants
-
- ConstantGroups =
- {
- Hooks =
- {
- Include = {"HOOK_.*"},
- TextBefore = [[
- These constants identify individual hooks. To register the plugin to receive notifications on hooks, use the
- cPluginManager:AddHook() function. For detailed description of each hook, see the <a href='index.html#hooks'>
- hooks reference</a>.]],
- },
- PluginStatus =
- {
- Include = {"ps.*"},
- TextBefore = [[
- These constants are used to report status of individual plugins. Use {{cPlugin}}:GetStatus() to query the
- status of a plugin; use cPluginManager::ForEachPlugin() to iterate over plugins.]],
- },
- CommandResult =
- {
- Include = {"cr.*"},
- TextBefore = [[
- These constants are returned by the ExecuteCommand() function to identify the exact outcome of the
- operation.]],
- },
- },
- }, -- cPluginManager
-}
diff --git a/MCServer/Plugins/APIDump/Classes/Projectiles.lua b/MCServer/Plugins/APIDump/Classes/Projectiles.lua
deleted file mode 100644
index 748f58b71..000000000
--- a/MCServer/Plugins/APIDump/Classes/Projectiles.lua
+++ /dev/null
@@ -1,174 +0,0 @@
-return
-{
- cArrowEntity =
- {
- Desc = [[
- Represents the arrow when it is shot from the bow. A subclass of the {{cProjectileEntity}}.
- ]],
- Functions =
- {
- CanPickup = { Params = "{{cPlayer|Player}}", Return = "bool", Notes = "Returns true if the specified player can pick the arrow when it's on the ground" },
- GetDamageCoeff = { Params = "", Return = "number", Notes = "Returns the damage coefficient stored within the arrow. The damage dealt by this arrow is multiplied by this coeff" },
- GetPickupState = { Params = "", Return = "PickupState", Notes = "Returns the pickup state (one of the psXXX constants, above)" },
- IsCritical = { Params = "", Return = "bool", Notes = "Returns true if the arrow should deal critical damage. Based on the bow charge when the arrow was shot." },
- SetDamageCoeff = { Params = "number", Return = "", Notes = "Sets the damage coefficient. The damage dealt by this arrow is multiplied by this coeff" },
- SetIsCritical = { Params = "bool", Return = "", Notes = "Sets the IsCritical flag on the arrow. Critical arrow deal additional damage" },
- SetPickupState = { Params = "PickupState", Return = "", Notes = "Sets the pickup state (one of the psXXX constants, above)" },
- },
- Constants =
- {
- psInCreative = { Notes = "The arrow can be picked up only by players in creative gamemode" },
- psInSurvivalOrCreative = { Notes = "The arrow can be picked up by players in survival or creative gamemode" },
- psNoPickup = { Notes = "The arrow cannot be picked up at all" },
- },
- ConstantGroups =
- {
- PickupState =
- {
- Include = "ps.*",
- TextBefore = [[
- The following constants are used to signalize whether the arrow, once it lands, can be picked by
- players:
- ]],
- },
- },
- Inherits = "cProjectileEntity",
- }, -- cArrowEntity
-
- cExpBottleEntity =
- {
- Desc = [[
- Represents a thrown ExpBottle. A subclass of the {{cProjectileEntity}}.
- ]],
- Functions =
- {
- },
- Inherits = "cProjectileEntity",
- }, -- cExpBottleEntity
-
- cFireChargeEntity =
- {
- Desc = [[
- Represents a fire charge that has been shot by a Blaze or a {{cDispenserEntity|Dispenser}}. A subclass
- of the {{cProjectileEntity}}.
- ]],
- Functions = {},
- Inherits = "cProjectileEntity",
- }, -- cFireChargeEntity
-
- cFireworkEntity =
- {
- Desc = [[
- Represents a firework rocket.
- ]],
- Functions =
- {
- GetItem = { Params = "", Return = "{{cItem}}", Notes = "Returns the item that has been used to create the firework rocket. The item's m_FireworkItem member contains all the firework-related data." },
- GetTicksToExplosion = { Params = "", Return = "number", Notes = "Returns the number of ticks left until the firework explodes." },
- SetItem = { Params = "{{cItem}}", Return = "", Notes = "Sets a new item to be used for the firework." },
- SetTicksToExplosion = { Params = "NumTicks", Return = "", Notes = "Sets the number of ticks left until the firework explodes." },
- },
-
- Inherits = "cProjectileEntity",
- }, -- cFireworkEntity
-
- cFloater =
- {
- Desc = "",
- Functions = {},
- Inherits = "cProjectileEntity",
- }, -- cFloater
-
- cGhastFireballEntity =
- {
- Desc = "",
- Functions = {},
- Inherits = "cProjectileEntity",
- }, -- cGhastFireballEntity
-
- cProjectileEntity =
- {
- Desc = "",
- Functions =
- {
- GetCreator = { Params = "", Return = "{{cEntity}} descendant", Notes = "Returns the entity who created this projectile. May return nil." },
- GetMCAClassName = { Params = "", Return = "string", Notes = "Returns the string that identifies the projectile type (class name) in MCA files" },
- GetProjectileKind = { Params = "", Return = "ProjectileKind", Notes = "Returns the kind of this projectile (pkXXX constant)" },
- IsInGround = { Params = "", Return = "bool", Notes = "Returns true if this projectile has hit the ground." },
- },
- Constants =
- {
- pkArrow = { Notes = "The projectile is an {{cArrowEntity|arrow}}" },
- pkEgg = { Notes = "The projectile is a {{cThrownEggEntity|thrown egg}}" },
- pkEnderPearl = { Notes = "The projectile is a {{cThrownEnderPearlEntity|thrown enderpearl}}" },
- pkExpBottle = { Notes = "The projectile is a {{cExpBottleEntity|thrown exp bottle}}" },
- pkFireCharge = { Notes = "The projectile is a {{cFireChargeEntity|fire charge}}" },
- pkFirework = { Notes = "The projectile is a (flying) {{cFireworkEntity|firework}}" },
- pkFishingFloat = { Notes = "The projectile is a {{cFloater|fishing float}}" },
- pkGhastFireball = { Notes = "The projectile is a {{cGhastFireballEntity|ghast fireball}}" },
- pkSnowball = { Notes = "The projectile is a {{cThrownSnowballEntity|thrown snowball}}" },
- pkSplashPotion = { Notes = "The projectile is a {{cSplashPotionEntity|thrown splash potion}}" },
- pkWitherSkull = { Notes = "The projectile is a {{cWitherSkullEntity|wither skull}}" },
- },
- ConstantGroups =
- {
- ProjectileKind =
- {
- Include = "pk.*",
- TextBefore = "The following constants are used to distinguish between the different projectile kinds:",
- },
- },
- Inherits = "cEntity",
- }, -- cProjectileEntity
-
- cSplashPotionEntity =
- {
- Desc = [[
- Represents a thrown splash potion.
- ]],
- Functions =
- {
- GetEntityEffect = { Params = "", Return = "{{cEntityEffect}}", Notes = "Returns the entity effect in this potion" },
- GetEntityEffectType = { Params = "", Return = "{{cEntityEffect|Entity effect type}}", Notes = "Returns the effect type of this potion" },
- GetPotionColor = { Params = "", Return = "number", Notes = "Returns the color index of the particles emitted by this potion" },
- SetEntityEffect = { Params = "{{cEntityEffect}}", Return = "", Notes = "Sets the entity effect for this potion" },
- SetEntityEffectType = { Params = "{{cEntityEffect|Entity effect type}}", Return = "", Notes = "Sets the effect type of this potion" },
- SetPotionColor = { Params = "number", Return = "", Notes = "Sets the color index of the particles for this potion" },
- },
- Inherits = "cProjectileEntity",
- }, -- cSplashPotionEntity
-
- cThrownEggEntity =
- {
- Desc = [[
- Represents a thrown egg.
- ]],
- Functions = {},
- Inherits = "cProjectileEntity",
- }, -- cThrownEggEntity
-
- cThrownEnderPearlEntity =
- {
- Desc = "Represents a thrown ender pearl.",
- Functions = {},
- Inherits = "cProjectileEntity",
- }, -- cThrownEnderPearlEntity
-
- cThrownSnowballEntity =
- {
- Desc = "Represents a thrown snowball.",
- Functions = {},
- Inherits = "cProjectileEntity",
- }, -- cThrownSnowballEntity
-
- cWitherSkullEntity =
- {
- Desc = "Represents a wither skull being shot.",
- Functions = {},
- Inherits = "cProjectileEntity",
- }, -- cWitherSkullEntity
-}
-
-
-
-
diff --git a/MCServer/Plugins/APIDump/Classes/WebAdmin.lua b/MCServer/Plugins/APIDump/Classes/WebAdmin.lua
deleted file mode 100644
index 808335aea..000000000
--- a/MCServer/Plugins/APIDump/Classes/WebAdmin.lua
+++ /dev/null
@@ -1,51 +0,0 @@
-return
-{
- cWebAdmin =
- {
- Desc = "",
- Functions =
- {
- GetHTMLEscapedString = { Params = "string", Return = "string", Notes = "(STATIC) Gets the HTML-escaped representation of a requested string. This is useful for user input and game data that is not guaranteed to be escaped already." },
- },
- }, -- cWebAdmin
-
-
- HTTPFormData =
- {
- Desc = "This class stores data for one form element for a {{HTTPRequest|HTTP request}}.",
- Variables =
- {
- Name = { Type = "string", Notes = "Name of the form element" },
- Type = { Type = "string", Notes = "Type of the data (usually empty)" },
- Value = { Type = "string", Notes = "Value of the form element. Contains the raw data as sent by the browser." },
- },
- }, -- HTTPFormData
-
-
- HTTPRequest =
- {
- Desc = [[
- This class encapsulates all the data that is sent to the WebAdmin through one HTTP request. Plugins
- receive this class as a parameter to the function handling the web requests, as registered in the
- {{cPluginLua}}:AddWebPage().
- ]],
- Constants =
- {
- FormData = { Notes = "Array-table of {{HTTPFormData}}, contains the values of individual form elements submitted by the client" },
- Params = { Notes = "Map-table of parameters given to the request in the URL (?param=value); if a form uses GET method, this is the same as FormData. For each parameter given as \"param=value\", there is an entry in the table with \"param\" as its key and \"value\" as its value." },
- PostParams = { Notes = "Map-table of data posted through a FORM - either a GET or POST method. Logically the same as FormData, but in a map-table format (for each parameter given as \"param=value\", there is an entry in the table with \"param\" as its key and \"value\" as its value)." },
- },
-
- Variables =
- {
- Method = { Type = "string", Notes = "The HTTP method used to make the request. Usually GET or POST." },
- Path = { Type = "string", Notes = "The Path part of the URL (excluding the parameters)" },
- URL = { Type = "string", Notes = "The entire URL used for the request." },
- Username = { Type = "string", Notes = "Name of the logged-in user." },
- },
- }, -- HTTPRequest
-}
-
-
-
-
diff --git a/MCServer/Plugins/APIDump/Hooks/OnBlockSpread.lua b/MCServer/Plugins/APIDump/Hooks/OnBlockSpread.lua
deleted file mode 100644
index 7da796d4d..000000000
--- a/MCServer/Plugins/APIDump/Hooks/OnBlockSpread.lua
+++ /dev/null
@@ -1,40 +0,0 @@
-return
-{
- HOOK_BLOCK_SPREAD =
- {
- CalledWhen = "Called when a block spreads based on world conditions",
- DefaultFnName = "OnBlockSpread", -- also used as pagename
- Desc = [[
- This hook is called when a block spreads.</p>
- <p>
- The spread carries with it the type of its source - whether it's a block spreads.
- It also carries the identification of the actual source. The exact type of the identification
- depends on the source kind:
- <table>
- <tr><th>Source</th><th>Notes</th></tr>
- <tr><td>ssFireSpread</td><td>Fire spreading</td></tr>
- <tr><td>ssGrassSpread</td><td>Grass spreading</td></tr>
- <tr><td>ssMushroomSpread</td><td>Mushroom spreading</td></tr>
- <tr><td>ssMycelSpread</td><td>Mycel spreading</td></tr>
- <tr><td>ssVineSpread</td><td>Vine spreading</td></tr>
- </table></p>
- ]],
- Params =
- {
- { Name = "World", Type = "{{cWorld}}", Notes = "The world in which the block resides" },
- { Name = "BlockX", Type = "number", Notes = "X-coord of the block" },
- { Name = "BlockY", Type = "number", Notes = "Y-coord of the block" },
- { Name = "BlockZ", Type = "number", Notes = "Z-coord of the block" },
- { Name = "Source", Type = "eSpreadSource", Notes = "Source of the spread. See the table above." },
- },
- Returns = [[
- If the function returns false or no value, the next plugin's callback is called, and finally
- Cuberite will process the spread. If the function
- returns true, no other callback is called for this event and the spread will not occur.
- ]],
- }, -- HOOK_BLOCK_SPREAD
-}
-
-
-
-
diff --git a/MCServer/Plugins/APIDump/Hooks/OnBlockToPickups.lua b/MCServer/Plugins/APIDump/Hooks/OnBlockToPickups.lua
deleted file mode 100644
index d404da073..000000000
--- a/MCServer/Plugins/APIDump/Hooks/OnBlockToPickups.lua
+++ /dev/null
@@ -1,62 +0,0 @@
-return
-{
- HOOK_BLOCK_TO_PICKUPS =
- {
- CalledWhen = "A block is about to be dug ({{cPlayer|player}}, {{cEntity|entity}} or natural reason), plugins may override what pickups that will produce.",
- DefaultFnName = "OnBlockToPickups", -- also used as pagename
- Desc = [[
- This callback gets called whenever a block is about to be dug. This includes {{cPlayer|players}}
- digging blocks, entities causing blocks to disappear ({{cTNTEntity|TNT}}, Endermen) and natural
- causes (water washing away a block). Plugins may override the amount and kinds of pickups this
- action produces.
- ]],
- Params =
- {
- { Name = "World", Type = "{{cWorld}}", Notes = "The world in which the block resides" },
- { Name = "Digger", Type = "{{cEntity}} descendant", Notes = "The entity causing the digging. May be a {{cPlayer}}, {{cTNTEntity}} or even nil (natural causes)" },
- { Name = "BlockX", Type = "number", Notes = "X-coord of the block" },
- { Name = "BlockY", Type = "number", Notes = "Y-coord of the block" },
- { Name = "BlockZ", Type = "number", Notes = "Z-coord of the block" },
- { Name = "BlockType", Type = "BLOCKTYPE", Notes = "Block type of the block" },
- { Name = "BlockMeta", Type = "NIBBLETYPE", Notes = "Block meta of the block" },
- { Name = "Pickups", Type = "{{cItems}}", Notes = "Items that will be spawned as pickups" },
- },
- Returns = [[
- If the function returns false or no value, the next callback in the hook chain will be called. If
- the function returns true, no other callbacks in the chain will be called.</p>
- <p>
- Either way, the server will then spawn pickups specified in the Pickups parameter, so to disable
- pickups, you need to Clear the object first, then return true.
- ]],
- CodeExamples =
- {
- {
- Title = "Modify pickups",
- Desc = "This example callback function makes tall grass drop diamonds when digged by natural causes (washed away by water).",
- Code = [[
-function OnBlockToPickups(a_World, a_Digger, a_BlockX, a_BlockY, a_BlockZ, a_BlockType, a_BlockMeta, a_Pickups)
- if (a_Digger ~= nil) then
- -- Not a natural cause
- return false;
- end
- if (a_BlockType ~= E_BLOCK_TALL_GRASS) then
- -- Not a tall grass being washed away
- return false;
- end
-
- -- Remove all pickups suggested by Cuberite:
- a_Pickups:Clear();
-
- -- Drop a diamond:
- a_Pickups:Add(cItem(E_ITEM_DIAMOND));
- return true;
-end;
- ]],
- },
- } , -- CodeExamples
- }, -- HOOK_BLOCK_TO_PICKUPS
-}
-
-
-
-
diff --git a/MCServer/Plugins/APIDump/Hooks/OnChat.lua b/MCServer/Plugins/APIDump/Hooks/OnChat.lua
deleted file mode 100644
index a15d09cc7..000000000
--- a/MCServer/Plugins/APIDump/Hooks/OnChat.lua
+++ /dev/null
@@ -1,30 +0,0 @@
-return
-{
- HOOK_CHAT =
- {
- CalledWhen = "Player sends a chat message",
- DefaultFnName = "OnChat", -- also used as pagename
- Desc = [[
- A plugin may implement an OnChat() function and register it as a Hook to process chat messages from
- the players. The function is then called for every in-game message sent from any player. Note that
- registered in-game commands are not sent through this hook. Use the
- {{OnExecuteCommand|HOOK_EXECUTE_COMMAND}} to intercept registered in-game commands.
- ]],
- Params = {
- { Name = "Player", Type = "{{cPlayer}}", Notes = "The player who sent the message" },
- { Name = "Message", Type = "string", Notes = "The message" },
- },
- Returns = [[
- The plugin may return 2 values. The first is a boolean specifying whether the hook handling is to be
- stopped or not. If it is false, the message is broadcast to all players in the world. If it is true,
- no message is broadcast and no further action is taken.</p>
- <p>
- The second value is specifies the message to broadcast. This way, plugins may modify the message. If
- the second value is not provided, the original message is used.
- ]],
- }, -- HOOK_CHAT
-}
-
-
-
-
diff --git a/MCServer/Plugins/APIDump/Hooks/OnChunkAvailable.lua b/MCServer/Plugins/APIDump/Hooks/OnChunkAvailable.lua
deleted file mode 100644
index 61c191c57..000000000
--- a/MCServer/Plugins/APIDump/Hooks/OnChunkAvailable.lua
+++ /dev/null
@@ -1,27 +0,0 @@
-return
-{
- HOOK_CHUNK_AVAILABLE =
- {
- CalledWhen = "A chunk has just been added to world, either generated or loaded. ",
- DefaultFnName = "OnChunkAvailable", -- also used as pagename
- Desc = [[
- This hook is called after a chunk is either generated or loaded from the disk. The chunk is
- already available for manipulation using the {{cWorld}} API. This is a notification-only callback,
- there is no behavior that plugins could override.
- ]],
- Params =
- {
- { Name = "World", Type = "{{cWorld}}", Notes = "The world to which the chunk belongs" },
- { Name = "ChunkX", Type = "number", Notes = "X-coord of the chunk" },
- { Name = "ChunkZ", Type = "number", Notes = "Z-coord of the chunk" },
- },
- Returns = [[
- If the function returns false or no value, the next plugin's callback is called. If the function
- returns true, no other callback is called for this event.
- ]],
- }, -- HOOK_CHUNK_AVAILABLE
-}
-
-
-
-
diff --git a/MCServer/Plugins/APIDump/Hooks/OnChunkGenerated.lua b/MCServer/Plugins/APIDump/Hooks/OnChunkGenerated.lua
deleted file mode 100644
index 64bfdad5c..000000000
--- a/MCServer/Plugins/APIDump/Hooks/OnChunkGenerated.lua
+++ /dev/null
@@ -1,67 +0,0 @@
-return
-{
- HOOK_CHUNK_GENERATED =
- {
- CalledWhen = "After a chunk was generated. Notification only.",
- DefaultFnName = "OnChunkGenerated", -- also used as pagename
- Desc = [[
- This hook is called when world generator finished its work on a chunk. The chunk data has already
- been generated and is about to be stored in the {{cWorld|world}}. A plugin may provide some
- last-minute finishing touches to the generated data. Note that the chunk is not yet stored in the
- world, so regular {{cWorld}} block API will not work! Instead, use the {{cChunkDesc}} object
- received as the parameter.</p>
- <p>
- See also the {{OnChunkGenerating|HOOK_CHUNK_GENERATING}} hook.
- ]],
- Params =
- {
- { Name = "World", Type = "{{cWorld}}", Notes = "The world to which the chunk will be added" },
- { Name = "ChunkX", Type = "number", Notes = "X-coord of the chunk" },
- { Name = "ChunkZ", Type = "number", Notes = "Z-coord of the chunk" },
- { Name = "ChunkDesc", Type = "{{cChunkDesc}}", Notes = "Generated chunk data. Plugins may still modify the chunk data contained." },
- },
- Returns = [[
- If the plugin returns false or no value, Cuberite will call other plugins' callbacks for this event.
- If a plugin returns true, no other callback is called for this event.</p>
- <p>
- In either case, Cuberite will then store the data from ChunkDesc as the chunk's contents in the world.
- ]],
- CodeExamples =
- {
- {
- Title = "Generate emerald ore",
- Desc = "This example callback function generates one block of emerald ore in each chunk, under the condition that the randomly chosen location is in an ExtremeHills biome.",
- Code = [[
-function OnChunkGenerated(a_World, a_ChunkX, a_ChunkZ, a_ChunkDesc)
- -- Generate a psaudorandom value that is always the same for the same X/Z pair, but is otherwise random enough:
- -- This is actually similar to how Cuberite does its noise functions
- local PseudoRandom = (a_ChunkX * 57 + a_ChunkZ) * 57 + 19785486
- PseudoRandom = PseudoRandom * 8192 + PseudoRandom;
- PseudoRandom = ((PseudoRandom * (PseudoRandom * PseudoRandom * 15731 + 789221) + 1376312589) % 0x7fffffff;
- PseudoRandom = PseudoRandom / 7;
-
- -- Based on the PseudoRandom value, choose a location for the ore:
- local OreX = PseudoRandom % 16;
- local OreY = 2 + ((PseudoRandom / 16) % 20);
- local OreZ = (PseudoRandom / 320) % 16;
-
- -- Check if the location is in ExtremeHills:
- if (a_ChunkDesc:GetBiome(OreX, OreZ) ~= biExtremeHills) then
- return false;
- end
-
- -- Only replace allowed blocks with the ore:
- local CurrBlock = a_ChunDesc:GetBlockType(OreX, OreY, OreZ);
- if (
- (CurrBlock == E_BLOCK_STONE) or
- (CurrBlock == E_BLOCK_DIRT) or
- (CurrBlock == E_BLOCK_GRAVEL)
- ) then
- a_ChunkDesc:SetBlockTypeMeta(OreX, OreY, OreZ, E_BLOCK_EMERALD_ORE, 0);
- end
-end;
- ]],
- },
- } , -- CodeExamples
- }, -- HOOK_CHUNK_GENERATED
-} \ No newline at end of file
diff --git a/MCServer/Plugins/APIDump/Hooks/OnChunkGenerating.lua b/MCServer/Plugins/APIDump/Hooks/OnChunkGenerating.lua
deleted file mode 100644
index 0db0e2727..000000000
--- a/MCServer/Plugins/APIDump/Hooks/OnChunkGenerating.lua
+++ /dev/null
@@ -1,35 +0,0 @@
-return
-{
- HOOK_CHUNK_GENERATING =
- {
- CalledWhen = "A chunk is about to be generated. Plugin can override the built-in generator.",
- DefaultFnName = "OnChunkGenerating", -- also used as pagename
- Desc = [[
- This hook is called before the world generator starts generating a chunk. The plugin may provide
- some or all parts of the generation, by-passing the built-in generator. The function is given access
- to the {{cChunkDesc|ChunkDesc}} object representing the contents of the chunk. It may override parts
- of the built-in generator by using the object's <i>SetUseDefaultXXX(false)</i> functions. After all
- the callbacks for a chunk have been processed, the server will generate the chunk based on the
- {{cChunkDesc|ChunkDesc}} description - those parts that are set for generating (by default
- everything) are generated, the rest are read from the ChunkDesc object.</p>
- <p>
- See also the {{OnChunkGenerated|HOOK_CHUNK_GENERATED}} hook.
- ]],
- Params =
- {
- { Name = "World", Type = "{{cWorld}}", Notes = "The world to which the chunk will be added" },
- { Name = "ChunkX", Type = "number", Notes = "X-coord of the chunk" },
- { Name = "ChunkZ", Type = "number", Notes = "Z-coord of the chunk" },
- { Name = "ChunkDesc", Type = "{{cChunkDesc}}", Notes = "Generated chunk data." },
- },
- Returns = [[
- If this function returns true, the server will not call any other plugin with the same chunk. If
- this function returns false, the server will call the rest of the plugins with the same chunk,
- possibly overwriting the ChunkDesc's contents.
- ]],
- }, -- HOOK_CHUNK_GENERATING
-}
-
-
-
-
diff --git a/MCServer/Plugins/APIDump/Hooks/OnChunkUnloaded.lua b/MCServer/Plugins/APIDump/Hooks/OnChunkUnloaded.lua
deleted file mode 100644
index a67d5d461..000000000
--- a/MCServer/Plugins/APIDump/Hooks/OnChunkUnloaded.lua
+++ /dev/null
@@ -1,28 +0,0 @@
-return
-{
- HOOK_CHUNK_UNLOADED =
- {
- CalledWhen = "A chunk has been unloaded from the memory.",
- DefaultFnName = "OnChunkUnloaded", -- also used as pagename
- Desc = [[
- This hook is called when a chunk is unloaded from the memory. Though technically still in memory,
- the plugin should behave as if the chunk was already not present. In particular, {{cWorld}} block
- API should not be used in the area of the specified chunk.
- ]],
- Params =
- {
- { Name = "World", Type = "{{cWorld}}", Notes = "The world from which the chunk is unloading" },
- { Name = "ChunkX", Type = "number", Notes = "X-coord of the chunk" },
- { Name = "ChunkZ", Type = "number", Notes = "Z-coord of the chunk" },
- },
- Returns = [[
- If the function returns false or no value, the next plugin's callback is called. If the function
- returns true, no other callback is called for this event. There is no behavior that plugins could
- override.
- ]],
- }, -- HOOK_CHUNK_UNLOADED
-}
-
-
-
-
diff --git a/MCServer/Plugins/APIDump/Hooks/OnChunkUnloading.lua b/MCServer/Plugins/APIDump/Hooks/OnChunkUnloading.lua
deleted file mode 100644
index 98e0a71fd..000000000
--- a/MCServer/Plugins/APIDump/Hooks/OnChunkUnloading.lua
+++ /dev/null
@@ -1,30 +0,0 @@
-return
-{
- HOOK_CHUNK_UNLOADING =
- {
- CalledWhen = " A chunk is about to be unloaded from the memory. Plugins may refuse the unload.",
- DefaultFnName = "OnChunkUnloading", -- also used as pagename
- Desc = [[
- Cuberite calls this function when a chunk is about to be unloaded from the memory. A plugin may
- force Cuberite to keep the chunk in memory by returning true.</p>
- <p>
- FIXME: The return value should be used only for event propagation stopping, not for the actual
- decision whether to unload.
- ]],
- Params =
- {
- { Name = "World", Type = "{{cWorld}}", Notes = "The world from which the chunk is unloading" },
- { Name = "ChunkX", Type = "number", Notes = "X-coord of the chunk" },
- { Name = "ChunkZ", Type = "number", Notes = "Z-coord of the chunk" },
- },
- Returns = [[
- If the function returns false or no value, the next plugin's callback is called and finally Cuberite
- unloads the chunk. If the function returns true, no other callback is called for this event and the
- chunk is left in the memory.
- ]],
- }, -- HOOK_CHUNK_UNLOADING
-}
-
-
-
-
diff --git a/MCServer/Plugins/APIDump/Hooks/OnCollectingPickup.lua b/MCServer/Plugins/APIDump/Hooks/OnCollectingPickup.lua
deleted file mode 100644
index 2a451da92..000000000
--- a/MCServer/Plugins/APIDump/Hooks/OnCollectingPickup.lua
+++ /dev/null
@@ -1,32 +0,0 @@
-return
-{
- HOOK_COLLECTING_PICKUP =
- {
- CalledWhen = "Player is about to collect a pickup. Plugin can refuse / override behavior. ",
- DefaultFnName = "OnCollectingPickup", -- also used as pagename
- Desc = [[
- This hook is called when a player is about to collect a pickup. Plugins may refuse the action.</p>
- <p>
- Pickup collection happens within the world tick, so if the collecting is refused, it will be tried
- again in the next world tick, as long as the player is within reach of the pickup.</p>
- <p>
- FIXME: There is no OnCollectedPickup() callback.</p>
- <p>
- FIXME: This callback is called even if the pickup doesn't fit into the player's inventory.</p>
- ]],
- Params =
- {
- { Name = "Player", Type = "{{cPlayer}}", Notes = "The player who's collecting the pickup" },
- { Name = "Pickup", Type = "{{cPickup}}", Notes = "The pickup being collected" },
- },
- Returns = [[
- If the function returns false or no value, Cuberite calls other plugins' callbacks and finally the
- pickup is collected. If the function returns true, no other plugins are called for this event and
- the pickup is not collected.
- ]],
- }, -- HOOK_COLLECTING_PICKUP
-}
-
-
-
-
diff --git a/MCServer/Plugins/APIDump/Hooks/OnCraftingNoRecipe.lua b/MCServer/Plugins/APIDump/Hooks/OnCraftingNoRecipe.lua
deleted file mode 100644
index 7cd86b8b8..000000000
--- a/MCServer/Plugins/APIDump/Hooks/OnCraftingNoRecipe.lua
+++ /dev/null
@@ -1,32 +0,0 @@
-return
-{
- HOOK_CRAFTING_NO_RECIPE =
- {
- CalledWhen = " No built-in crafting recipe is found. Plugin may provide a recipe.",
- DefaultFnName = "OnCraftingNoRecipe", -- also used as pagename
- Desc = [[
- This callback is called when a player places items in their {{cCraftingGrid|crafting grid}} and
- Cuberite cannot find a built-in {{cCraftingRecipe|recipe}} for the combination. Plugins may provide
- a recipe for the ingredients given.
- ]],
- Params =
- {
- { Name = "Player", Type = "{{cPlayer}}", Notes = "The player whose crafting is reported in this hook" },
- { Name = "Grid", Type = "{{cCraftingGrid}}", Notes = "Contents of the player's crafting grid" },
- { Name = "Recipe", Type = "{{cCraftingRecipe}}", Notes = "The recipe that will be used (can be filled by plugins)" },
- },
- Returns = [[
- If the function returns false or no value, no recipe will be used. If the function returns true, no
- other plugin will have their callback called for this event and Cuberite will use the crafting
- recipe in Recipe.</p>
- <p>
- FIXME: To allow plugins give suggestions and overwrite other plugins' suggestions, we should change
- the behavior with returning false, so that the recipe will still be used, but fill the recipe with
- empty values by default.
- ]],
- }, -- HOOK_CRAFTING_NO_RECIPE
-}
-
-
-
-
diff --git a/MCServer/Plugins/APIDump/Hooks/OnDisconnect.lua b/MCServer/Plugins/APIDump/Hooks/OnDisconnect.lua
deleted file mode 100644
index ae872a3ad..000000000
--- a/MCServer/Plugins/APIDump/Hooks/OnDisconnect.lua
+++ /dev/null
@@ -1,38 +0,0 @@
-return
-{
- HOOK_DISCONNECT =
- {
- CalledWhen = [[
- A client has disconnected, either by explicitly sending the disconnect packet (in older protocols) or
- their connection was terminated
- ]],
- DefaultFnName = "OnDisconnect", -- also used as pagename
- Desc = [[
- This hook is called when a client has disconnected from the server, for whatever reason. It is also
- called when the client sends the Disconnect packet (only in pre-1.7 protocols). This hook is not called
- for server ping connections.</p>
- <p>
- Note that the hook is called even for connections to players who failed to auth. In such a case there's
- no {{cPlayer}} object associated with the client.</p>
- <p>
- See also the {{OnHandshake|HOOK_HANDSHAKE}} hook which is called when the client connects (and presents
- a handshake message, so that they are not just status-pinging). If you need to store a per-player
- object, use the {{OnPlayerJoined|HOOK_PLAYER_JOINED}} and {{OnPlayerDestroyed|HOOK_PLAYER_DESTROYED}}
- hooks instead, those are guaranteed to have the {{cPlayer}} object associated.
- ]],
- Params =
- {
- { Name = "Client", Type = "{{cClientHandle}}", Notes = "The client who has disconnected" },
- { Name = "Reason", Type = "string", Notes = "The reason that the client has sent in the disconnect packet" },
- },
- Returns = [[
- If the function returns false or no value, Cuberite calls other plugins' callbacks for this event.
- If the function returns true, no other plugins are called for this event. In either case,
- the client is disconnected.
- ]],
- }, -- HOOK_DISCONNECT
-}
-
-
-
-
diff --git a/MCServer/Plugins/APIDump/Hooks/OnEntityAddEffect.lua b/MCServer/Plugins/APIDump/Hooks/OnEntityAddEffect.lua
deleted file mode 100644
index 155abc41b..000000000
--- a/MCServer/Plugins/APIDump/Hooks/OnEntityAddEffect.lua
+++ /dev/null
@@ -1,33 +0,0 @@
-return
-{
- HOOK_ENTITY_ADD_EFFECT =
- {
- CalledWhen = "An entity effect is about to get added to an entity.",
- DefaultFnName = "OnEntityAddEffect", -- also used as pagename
- Desc = [[
- This hook is called whenever an entity effect is about to be added to an entity. The plugin may
- disallow the addition by returning true.</p>
- <p>Note that this hook only fires for adding the effect, but not for the actual effect application. See
- also the {{OnEntityRemoveEffect|HOOK_ENTITY_REMOVE_EFFECT}} for notification about effects expiring /
- removing, and {{OnEntityApplyEffect|HOOK_ENTITY_APPLY_EFFECT}} for the actual effect application to the
- entity.
- ]],
- Params =
- {
- { Name = "Entity", Type = "{{cEntity}}", Notes = "The entity to which the effect is about to be added" },
- { Name = "EffectType", Type = "number", Notes = "The type of the effect to be added. One of the effXXX constants." },
- { Name = "EffectDuration", Type = "number", Notes = "The duration of the effect to be added, in ticks." },
- { Name = "EffectIntensity", Type = "number", Notes = "The intensity (level) of the effect to be added. " },
- { Name = "DistanceModifier", Type = "number", Notes = "The modifier for the effect intensity, based on distance. Used mainly for splash potions." },
- },
- Returns = [[
- If the plugin returns true, the effect will not be added and none of the remaining hook handlers will
- be called. If the plugin returns false, Cuberite calls all the remaining hook handlers and finally
- the effect is added to the entity.
- ]],
- }, -- HOOK_EXECUTE_COMMAND
-}
-
-
-
-
diff --git a/MCServer/Plugins/APIDump/Hooks/OnEntityChangedWorld.lua b/MCServer/Plugins/APIDump/Hooks/OnEntityChangedWorld.lua
deleted file mode 100644
index 6675fdbe0..000000000
--- a/MCServer/Plugins/APIDump/Hooks/OnEntityChangedWorld.lua
+++ /dev/null
@@ -1,28 +0,0 @@
-return
-{
- HOOK_ENTITY_CHANGED_WORLD =
- {
- CalledWhen = "After a entity has changed the world.",
- DefaultFnName = "OnEntityChangedWorld", -- also used as pagename
- Desc = [[
- This hook is called after the server has moved the {{cEntity|entity}} to the given world. This is an information-only
- callback, the entity is already in the new world.<p>
- See also the {{OnEntityChangingWorld|HOOK_ENTITY_CHANGING_WORLD}} hook for a similar hook called before the
- entity is moved to the new world.
- ]],
- Params =
- {
- { Name = "Entity", Type = "{{cEntity}}", Notes = "The entity that has changed the world" },
- { Name = "World", Type = "{{cWorld}}", Notes = "The world from which the entity has come" },
- },
- Returns = [[
- If the function returns false or no value, the next plugin's callback is called. If the function
- returns true, no other callback is called for this event.
- ]],
- }, -- HOOK_ENTITY_CHANGED_WORLD
-}
-
-
-
-
-
diff --git a/MCServer/Plugins/APIDump/Hooks/OnEntityChangingWorld.lua b/MCServer/Plugins/APIDump/Hooks/OnEntityChangingWorld.lua
deleted file mode 100644
index 521f829c7..000000000
--- a/MCServer/Plugins/APIDump/Hooks/OnEntityChangingWorld.lua
+++ /dev/null
@@ -1,29 +0,0 @@
-return
-{
- HOOK_ENTITY_CHANGING_WORLD =
- {
- CalledWhen = "Before a entity is changing the world.",
- DefaultFnName = "OnEntityChangingWorld", -- also used as pagename
- Desc = [[
- This hook is called before the server moves the {{cEntity|entity}} to the given world. Plugins may
- refuse the changing of the entity to the new world.<p>
- See also the {{OnEntityChangedWorld|HOOK_ENTITY_CHANGED_WORLD}} hook for a similar hook is called after the
- entity has been moved to the world.
- ]],
- Params =
- {
- { Name = "Entity", Type = "{{cEntity}}", Notes = "The entity that wants to change the world" },
- { Name = "World", Type = "{{cWorld}}", Notes = "The world to which the entity wants to change" },
- },
- Returns = [[
- If the function returns false or no value, the next plugin's callback is called. If the function
- returns true, no other callback is called for this event and the change of the entity to the world is
- cancelled.
- ]],
- }, -- HOOK_ENTITY_CHANGING_WORLD
-}
-
-
-
-
-
diff --git a/MCServer/Plugins/APIDump/Hooks/OnEntityTeleport.lua b/MCServer/Plugins/APIDump/Hooks/OnEntityTeleport.lua
deleted file mode 100644
index cdeb0947f..000000000
--- a/MCServer/Plugins/APIDump/Hooks/OnEntityTeleport.lua
+++ /dev/null
@@ -1,29 +0,0 @@
-return
-{
- HOOK_ENTITY_TELEPORT =
- {
- CalledWhen = "Any entity teleports. Plugin may refuse teleport.",
- DefaultFnName = "OnEntityTeleport", -- also used as pagename
- Desc = [[
- This function is called in each server tick for each {{cEntity|Entity}} that has
- teleported. Plugins may refuse the teleport.
- ]],
- Params =
- {
- { Name = "Entity", Type = "{{cEntity}}", Notes = "The entity who has teleported. New position is set in the object after successfull teleport" },
- { Name = "OldPosition", Type = "{{Vector3d}}", Notes = "The old position." },
- { Name = "NewPosition", Type = "{{Vector3d}}", Notes = "The new position." },
- },
- Returns = [[
- If the function returns true, teleport is prohibited.</p>
- <p>
- If the function returns false or no value, other plugins' callbacks are called and finally the new
- position is permanently stored in the cEntity object.</p>
- ]],
- }, -- HOOK_ENTITY_TELEPORT
-}
-
-
-
-
-
diff --git a/MCServer/Plugins/APIDump/Hooks/OnExecuteCommand.lua b/MCServer/Plugins/APIDump/Hooks/OnExecuteCommand.lua
deleted file mode 100644
index 4aa31bbd6..000000000
--- a/MCServer/Plugins/APIDump/Hooks/OnExecuteCommand.lua
+++ /dev/null
@@ -1,41 +0,0 @@
-return
-{
- HOOK_EXECUTE_COMMAND =
- {
- CalledWhen = [[
- 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.
- ]],
- DefaultFnName = "OnExecuteCommand", -- also used as pagename
- Desc = [[
- A plugin may implement a callback for this hook to intercept both in-game commands executed by the
- players and console commands executed by the server admin. The function is called for every in-game
- command sent from any player and for those server console commands that are not built in in the
- server.</p>
- <p>
- If the command is in-game, the first parameter to the hook function is the {{cPlayer|player}} who's
- executing the command. If the command comes from the server console, the first parameter is nil.</p>
- <p>
- The server calls this hook even for unregistered (unknown) console commands. It also calls the hook
- for unknown in-game commands, as long as they begin with a slash ('/'). If a plugin needs to intercept
- in-game chat messages not beginning with a slash, it should use the {{OnChat|HOOK_CHAT}} hook.
- ]],
- Params =
- {
- { Name = "Player", Type = "{{cPlayer}}", Notes = "For in-game commands, the player who has sent the message. For console commands, nil" },
- { Name = "CommandSplit", Type = "array-table of strings", Notes = "The command and its parameters, broken into a table by spaces" },
- { Name = "EntireCommand", Type = "string", Notes = "The entire command as a single string" },
- },
- Returns = [[
- If the plugin returns false, Cuberite calls all the remaining hook handlers and finally the command
- will be executed. If the plugin returns true, the none of the remaining hook handlers will be called.
- In this case the plugin can return a second value, specifying whether what the command result should
- be set to, one of the {{cPluginManager#CommandResult|CommandResult}} constants. If not
- provided, the value defaults to crBlocked.
- ]],
- }, -- HOOK_EXECUTE_COMMAND
-}
-
-
-
-
diff --git a/MCServer/Plugins/APIDump/Hooks/OnExploded.lua b/MCServer/Plugins/APIDump/Hooks/OnExploded.lua
deleted file mode 100644
index 6a01542ab..000000000
--- a/MCServer/Plugins/APIDump/Hooks/OnExploded.lua
+++ /dev/null
@@ -1,49 +0,0 @@
-return
-{
- HOOK_EXPLODED =
- {
- CalledWhen = "An explosion has happened",
- DefaultFnName = "OnExploded", -- also used as pagename
- Desc = [[
- This hook is called after an explosion has been processed in a world.</p>
- <p>
- See also {{OnExploding|HOOK_EXPLODING}} for a similar hook called before the explosion.</p>
- <p>
- The explosion carries with it the type of its source - whether it's a creeper exploding, or TNT,
- etc. It also carries the identification of the actual source. The exact type of the identification
- depends on the source kind:
- <table>
- <tr><th>Source</th><th>SourceData Type</th><th>Notes</th></tr>
- <tr><td>esPrimedTNT</td><td>{{cTNTEntity}}</td><td>An exploding primed TNT entity</td></tr>
- <tr><td>esCreeper</td><td>{{cCreeper}}</td><td>An exploding creeper or charged creeper</td></tr>
- <tr><td>esBed</td><td>{{Vector3i}}</td><td>A bed exploding in the Nether or in the End. The bed coords are given.</td></tr>
- <tr><td>esEnderCrystal</td><td>{{Vector3i}}</td><td>An ender crystal exploding upon hit. The block coords are given.</td></tr>
- <tr><td>esGhastFireball</td><td>{{cGhastFireballEntity}}</td><td>A ghast fireball hitting ground or an {{cEntity|entity}}.</td></tr>
- <tr><td>esWitherSkullBlack</td><td><i>TBD</i></td><td>A black wither skull hitting ground or an {{cEntity|entity}}.</td></tr>
- <tr><td>esWitherSkullBlue</td><td><i>TBD</i></td><td>A blue wither skull hitting ground or an {{cEntity|entity}}.</td></tr>
- <tr><td>esWitherBirth</td><td><i>TBD</i></td><td>A wither boss being created</td></tr>
- <tr><td>esOther</td><td><i>TBD</i></td><td>Any other previously unspecified type.</td></tr>
- <tr><td>esPlugin</td><td>object</td><td>An explosion created by a plugin. The plugin may specify any kind of data.</td></tr>
- </table></p>
- ]],
- Params =
- {
- { Name = "World", Type = "{{cWorld}}", Notes = "The world where the explosion happened" },
- { Name = "ExplosionSize", Type = "number", Notes = "The relative explosion size" },
- { Name = "CanCauseFire", Type = "bool", Notes = "True if the explosion has turned random air blocks to fire (such as a ghast fireball)" },
- { Name = "X", Type = "number", Notes = "X-coord of the explosion center" },
- { Name = "Y", Type = "number", Notes = "Y-coord of the explosion center" },
- { Name = "Z", Type = "number", Notes = "Z-coord of the explosion center" },
- { Name = "Source", Type = "eExplosionSource", Notes = "Source of the explosion. See the table above." },
- { Name = "SourceData", Type = "varies", Notes = "Additional data for the source. The exact type varies by the source. See the table above." },
- },
- Returns = [[
- If the function returns false or no value, the next plugin's callback is called. If the function
- returns true, no other callback is called for this event. There is no overridable behaviour.
- ]],
- }, -- HOOK_EXPLODED
-}
-
-
-
-
diff --git a/MCServer/Plugins/APIDump/Hooks/OnExploding.lua b/MCServer/Plugins/APIDump/Hooks/OnExploding.lua
deleted file mode 100644
index e21b41be0..000000000
--- a/MCServer/Plugins/APIDump/Hooks/OnExploding.lua
+++ /dev/null
@@ -1,50 +0,0 @@
-return
-{
- HOOK_EXPLODING =
- {
- CalledWhen = "An explosion is about to be processed",
- DefaultFnName = "OnExploding", -- also used as pagename
- Desc = [[
- This hook is called before an explosion has been processed in a world.</p>
- <p>
- See also {{OnExploded|HOOK_EXPLODED}} for a similar hook called after the explosion.</p>
- <p>
- The explosion carries with it the type of its source - whether it's a creeper exploding, or TNT,
- etc. It also carries the identification of the actual source. The exact type of the identification
- depends on the source kind:
- <table>
- <tr><th>Source</th><th>SourceData Type</th><th>Notes</th></tr>
- <tr><td>esPrimedTNT</td><td>{{cTNTEntity}}</td><td>An exploding primed TNT entity</td></tr>
- <tr><td>esCreeper</td><td>{{cCreeper}}</td><td>An exploding creeper or charged creeper</td></tr>
- <tr><td>esBed</td><td>{{Vector3i}}</td><td>A bed exploding in the Nether or in the End. The bed coords are given.</td></tr>
- <tr><td>esEnderCrystal</td><td>{{Vector3i}}</td><td>An ender crystal exploding upon hit. The block coords are given.</td></tr>
- <tr><td>esGhastFireball</td><td>{{cGhastFireballEntity}}</td><td>A ghast fireball hitting ground or an {{cEntity|entity}}.</td></tr>
- <tr><td>esWitherSkullBlack</td><td><i>TBD</i></td><td>A black wither skull hitting ground or an {{cEntity|entity}}.</td></tr>
- <tr><td>esWitherSkullBlue</td><td><i>TBD</i></td><td>A blue wither skull hitting ground or an {{cEntity|entity}}.</td></tr>
- <tr><td>esWitherBirth</td><td><i>TBD</i></td><td>A wither boss being created</td></tr>
- <tr><td>esOther</td><td><i>TBD</i></td><td>Any other previously unspecified type.</td></tr>
- <tr><td>esPlugin</td><td>object</td><td>An explosion created by a plugin. The plugin may specify any kind of data.</td></tr>
- </table></p>
- ]],
- Params =
- {
- { Name = "World", Type = "{{cWorld}}", Notes = "The world where the explosion happens" },
- { Name = "ExplosionSize", Type = "number", Notes = "The relative explosion size" },
- { Name = "CanCauseFire", Type = "bool", Notes = "True if the explosion will turn random air blocks to fire (such as a ghast fireball)" },
- { Name = "X", Type = "number", Notes = "X-coord of the explosion center" },
- { Name = "Y", Type = "number", Notes = "Y-coord of the explosion center" },
- { Name = "Z", Type = "number", Notes = "Z-coord of the explosion center" },
- { Name = "Source", Type = "eExplosionSource", Notes = "Source of the explosion. See the table above." },
- { Name = "SourceData", Type = "varies", Notes = "Additional data for the source. The exact type varies by the source. See the table above." },
- },
- Returns = [[
- If the function returns false or no value, the next plugin's callback is called, and finally
- Cuberite will process the explosion - destroy blocks and push + hurt entities. If the function
- returns true, no other callback is called for this event and the explosion will not occur.
- ]],
- }, -- HOOK_EXPLODING
-}
-
-
-
-
diff --git a/MCServer/Plugins/APIDump/Hooks/OnHandshake.lua b/MCServer/Plugins/APIDump/Hooks/OnHandshake.lua
deleted file mode 100644
index 6183cc506..000000000
--- a/MCServer/Plugins/APIDump/Hooks/OnHandshake.lua
+++ /dev/null
@@ -1,29 +0,0 @@
-return
-{
- HOOK_HANDSHAKE =
- {
- CalledWhen = "A client is connecting.",
- DefaultFnName = "OnHandshake", -- also used as pagename
- Desc = [[
- This hook is called when a client sends the Handshake packet. At this stage, only the client IP and
- (unverified) username are known. Plugins may refuse access to the server based on this
- information.</p>
- <p>
- Note that the username is not authenticated - the authentication takes place only after this hook is
- processed.
- ]],
- Params =
- {
- { Name = "Client", Type = "{{cClientHandle}}", Notes = "The client handle representing the connection. Note that there's no {{cPlayer}} object for this client yet." },
- { Name = "UserName", Type = "string", Notes = "The username presented in the packet. Note that this username is unverified." },
- },
- Returns = [[
- If the function returns false, the user is let in to the server. If the function returns true, no
- other plugin's callback is called, the user is kicked and the connection is closed.
- ]],
- }, -- HOOK_HANDSHAKE
-}
-
-
-
-
diff --git a/MCServer/Plugins/APIDump/Hooks/OnHopperPullingItem.lua b/MCServer/Plugins/APIDump/Hooks/OnHopperPullingItem.lua
deleted file mode 100644
index b268a76be..000000000
--- a/MCServer/Plugins/APIDump/Hooks/OnHopperPullingItem.lua
+++ /dev/null
@@ -1,30 +0,0 @@
-return
-{
- HOOK_HOPPER_PULLING_ITEM =
- {
- CalledWhen = "A hopper is pulling an item from another block entity.",
- DefaultFnName = "OnHopperPullingItem", -- also used as pagename
- Desc = [[
- This callback is called whenever a {{cHopperEntity|hopper}} transfers an {{cItem|item}} from another
- block entity into its own internal storage. A plugin may decide to disallow the move by returning
- true. Note that in such a case, the hook may be called again for the same hopper, with different
- slot numbers.
- ]],
- Params =
- {
- { Name = "World", Type = "{{cWorld}}", Notes = "World where the hopper resides" },
- { Name = "Hopper", Type = "{{cHopperEntity}}", Notes = "The hopper that is pulling the item" },
- { Name = "DstSlot", Type = "number", Notes = "The destination slot in the hopper's {{cItemGrid|internal storage}}" },
- { Name = "SrcBlockEntity", Type = "{{cBlockEntityWithItems}}", Notes = "The block entity that is losing the item" },
- { Name = "SrcSlot", Type = "number", Notes = "Slot in SrcBlockEntity from which the item will be pulled" },
- },
- Returns = [[
- If the function returns false or no value, the next plugin's callback is called. If the function
- returns true, no other callback is called for this event and the hopper will not pull the item.
- ]],
- }, -- HOOK_HOPPER_PULLING_ITEM
-}
-
-
-
-
diff --git a/MCServer/Plugins/APIDump/Hooks/OnHopperPushingItem.lua b/MCServer/Plugins/APIDump/Hooks/OnHopperPushingItem.lua
deleted file mode 100644
index bd5702518..000000000
--- a/MCServer/Plugins/APIDump/Hooks/OnHopperPushingItem.lua
+++ /dev/null
@@ -1,30 +0,0 @@
-return
-{
- HOOK_HOPPER_PUSHING_ITEM =
- {
- CalledWhen = "A hopper is pushing an item into another block entity. ",
- DefaultFnName = "OnHopperPushingItem", -- also used as pagename
- Desc = [[
- This hook is called whenever a {{cHopperEntity|hopper}} transfers an {{cItem|item}} from its own
- internal storage into another block entity. A plugin may decide to disallow the move by returning
- true. Note that in such a case, the hook may be called again for the same hopper and block, with
- different slot numbers.
- ]],
- Params =
- {
- { Name = "World", Type = "{{cWorld}}", Notes = "World where the hopper resides" },
- { Name = "Hopper", Type = "{{cHopperEntity}}", Notes = "The hopper that is pushing the item" },
- { Name = "SrcSlot", Type = "number", Notes = "Slot in the hopper that will lose the item" },
- { Name = "DstBlockEntity", Type = "{{cBlockEntityWithItems}}", Notes = " The block entity that will receive the item" },
- { Name = "DstSlot", Type = "number", Notes = " Slot in DstBlockEntity's internal storage where the item will be stored" },
- },
- Returns = [[
- If the function returns false or no value, the next plugin's callback is called. If the function
- returns true, no other callback is called for this event and the hopper will not push the item.
- ]],
- }, -- HOOK_HOPPER_PUSHING_ITEM
-}
-
-
-
-
diff --git a/MCServer/Plugins/APIDump/Hooks/OnKilled.lua b/MCServer/Plugins/APIDump/Hooks/OnKilled.lua
deleted file mode 100644
index 9289b8f35..000000000
--- a/MCServer/Plugins/APIDump/Hooks/OnKilled.lua
+++ /dev/null
@@ -1,22 +0,0 @@
-return
-{
- HOOK_KILLED =
- {
- CalledWhen = "A player or a mob died.",
- DefaultFnName = "OnKilled",
- Desc = [[
- This hook is called whenever player or a mob dies. It can be used to change the death message.
- ]],
- Params =
- {
- { Name = "Victim", Type = "{{cEntity}}", Notes = "The player or mob that died" },
- { Name = "TDI", Type = "{{TakeDamageInfo}}", Notes = "Informations about the death" },
- { Name = "DeathMessage", Type = "string", Notes = "The default death message. An empty string if the victim is not a player" },
- },
- Returns = [[
- The function may return two values. The first value is a boolean specifying whether other plugins should be called. If it is true, the other plugins won't get notified of the death. If it is false, the other plugins will get notified.</p>
- <p>The second value is a string containing the death message. If the victim is a player, this death message is broadcasted instead of the default death message. If it is empty, no death message is broadcasted. If it is nil, the message is left unchanged. If the victim is not a player, the death message is never broadcasted.</p>
- <p>In either case, the victim is dead.
- ]],
- }, -- HOOK_KILLED
-}
diff --git a/MCServer/Plugins/APIDump/Hooks/OnKilling.lua b/MCServer/Plugins/APIDump/Hooks/OnKilling.lua
deleted file mode 100644
index 6bfd75fb6..000000000
--- a/MCServer/Plugins/APIDump/Hooks/OnKilling.lua
+++ /dev/null
@@ -1,30 +0,0 @@
-return
-{
- HOOK_KILLING =
- {
- CalledWhen = "A player or a mob is dying.",
- DefaultFnName = "OnKilling", -- also used as pagename
- Desc = [[
- This hook is called whenever a {{cPawn|pawn}}'s (a player's or a mob's) health reaches zero. This
- means that the pawn is about to be killed, unless a plugin "revives" them by setting their health
- back to a positive value.
- ]],
- Params =
- {
- { Name = "Victim", Type = "{{cPawn}}", Notes = "The player or mob that is about to be killed" },
- { Name = "Killer", Type = "{{cEntity}}", Notes = "The entity that has caused the victim to lose the last point of health. May be nil for environment damage" },
- { Name = "TDI", Type = "{{TakeDamageInfo}}", Notes = "The damage type, cause and effects." },
- },
- Returns = [[
- If the function returns false or no value, Cuberite calls other plugins with this event. If the
- function returns true, no other plugin is called for this event.</p>
- <p>
- In either case, the victim's health is then re-checked and if it is greater than zero, the victim is
- "revived" with that health amount. If the health is less or equal to zero, the victim is killed.
- ]],
- }, -- HOOK_KILLING
-}
-
-
-
-
diff --git a/MCServer/Plugins/APIDump/Hooks/OnLogin.lua b/MCServer/Plugins/APIDump/Hooks/OnLogin.lua
deleted file mode 100644
index f71c3ade4..000000000
--- a/MCServer/Plugins/APIDump/Hooks/OnLogin.lua
+++ /dev/null
@@ -1,31 +0,0 @@
-return
-{
- HOOK_LOGIN =
- {
- CalledWhen = "Right before player authentication. If auth is disabled, right after the player sends their name.",
- DefaultFnName = "OnLogin", -- also used as pagename
- Desc = [[
- This hook is called whenever a client logs in. It is called right before the client's name is sent
- to be authenticated. Plugins may refuse the client from accessing the server. Note that when this
- callback is called, the {{cPlayer}} object for this client doesn't exist yet - the client has no
- representation in any world. To process new players when their world is known, use a later callback,
- such as {{OnPlayerJoined|HOOK_PLAYER_JOINED}} or {{OnPlayerSpawned|HOOK_PLAYER_SPAWNED}}.
- ]],
- Params =
- {
- { Name = "Client", Type = "{{cClientHandle}}", Notes = "The client handle representing the connection" },
- { Name = "ProtocolVersion", Type = "number", Notes = "Versio of the protocol that the client is talking" },
- { Name = "UserName", Type = "string", Notes = "The name that the client has presented for authentication. This name will be given to the {{cPlayer}} object when it is created for this client." },
- },
- Returns = [[
- If the function returns true, no other plugins are called for this event and the client is kicked.
- If the function returns false or no value, Cuberite calls other plugins' callbacks and finally
- sends an authentication request for the client's username to the auth server. If the auth server
- is disabled in the server settings, the player object is immediately created.
- ]],
- }, -- HOOK_LOGIN
-}
-
-
-
-
diff --git a/MCServer/Plugins/APIDump/Hooks/OnPlayerAnimation.lua b/MCServer/Plugins/APIDump/Hooks/OnPlayerAnimation.lua
deleted file mode 100644
index baf99834e..000000000
--- a/MCServer/Plugins/APIDump/Hooks/OnPlayerAnimation.lua
+++ /dev/null
@@ -1,28 +0,0 @@
-return
-{
- HOOK_PLAYER_ANIMATION =
- {
- CalledWhen = "A client has sent an Animation packet (0x12)",
- DefaultFnName = "OnPlayerAnimation", -- also used as pagename
- Desc = [[
- This hook is called when the server receives an Animation packet (0x12) from the client.</p>
- <p>
- For the list of animations that are sent by the client, see the
- <a href="http://wiki.vg/Protocol#0x12">Protocol wiki</a>.
- ]],
- Params =
- {
- { Name = "Player", Type = "{{cPlayer}}", Notes = "The player from whom the packet was received" },
- { Name = "Animation", Type = "number", Notes = "The kind of animation" },
- },
- Returns = [[
- If the function returns false or no value, the next plugin's callback is called. Afterwards, the
- server broadcasts the animation packet to all nearby clients. If the function returns true, no other
- callback is called for this event and the packet is not broadcasted.
- ]],
- }, -- HOOK_PLAYER_ANIMATION
-}
-
-
-
-
diff --git a/MCServer/Plugins/APIDump/Hooks/OnPlayerBreakingBlock.lua b/MCServer/Plugins/APIDump/Hooks/OnPlayerBreakingBlock.lua
deleted file mode 100644
index 18f19f247..000000000
--- a/MCServer/Plugins/APIDump/Hooks/OnPlayerBreakingBlock.lua
+++ /dev/null
@@ -1,36 +0,0 @@
-return
-{
- HOOK_PLAYER_BREAKING_BLOCK =
- {
- CalledWhen = "Just before a player breaks a block. Plugin may override / refuse. ",
- DefaultFnName = "OnPlayerBreakingBlock", -- also used as pagename
- Desc = [[
- This hook is called when a {{cPlayer|player}} breaks a block, before the block is actually broken in
- the {{cWorld|World}}. Plugins may refuse the breaking.</p>
- <p>
- See also the {{OnPlayerBrokenBlock|HOOK_PLAYER_BROKEN_BLOCK}} hook for a similar hook called after
- the block is broken.
- ]],
- Params =
- {
- { Name = "Player", Type = "{{cPlayer}}", Notes = "The player who is digging the block" },
- { Name = "BlockX", Type = "number", Notes = "X-coord of the block" },
- { Name = "BlockY", Type = "number", Notes = "Y-coord of the block" },
- { Name = "BlockZ", Type = "number", Notes = "Z-coord of the block" },
- { Name = "BlockFace", Type = "number", Notes = "Face of the block upon which the player is acting. One of the BLOCK_FACE_ constants" },
- { Name = "BlockType", Type = "BLOCKTYPE", Notes = "The block type of the block being broken" },
- { Name = "BlockMeta", Type = "NIBBLETYPE", Notes = "The block meta of the block being broken " },
- },
- Returns = [[
- If the function returns false or no value, other plugins' callbacks are called, and then the block
- is broken. If the function returns true, no other plugin's callback is called and the block breaking
- is cancelled. The server re-sends the block back to the player to replace it (the player's client
- already thinks the block was broken).
- ]],
- }, -- HOOK_PLAYER_BREAKING_BLOCK
-}
-
-
-
-
-
diff --git a/MCServer/Plugins/APIDump/Hooks/OnPlayerBrokenBlock.lua b/MCServer/Plugins/APIDump/Hooks/OnPlayerBrokenBlock.lua
deleted file mode 100644
index e718c5d97..000000000
--- a/MCServer/Plugins/APIDump/Hooks/OnPlayerBrokenBlock.lua
+++ /dev/null
@@ -1,36 +0,0 @@
-return
-{
- HOOK_PLAYER_BROKEN_BLOCK =
- {
- CalledWhen = "After a player has broken a block. Notification only.",
- DefaultFnName = "OnPlayerBrokenBlock", -- also used as pagename
- Desc = [[
- This function is called after a {{cPlayer|player}} breaks a block. The block is already removed
- from the {{cWorld|world}} and {{cPickup|pickups}} have been spawned. To get the world in which the
- block has been dug, use the {{cPlayer}}:GetWorld() function.</p>
- <p>
- See also the {{OnPlayerBreakingBlock|HOOK_PLAYER_BREAKING_BLOCK}} hook for a similar hook called
- before the block is broken. To intercept the creation of pickups, see the
- {{OnBlockToPickups|HOOK_BLOCK_TO_PICKUPS}} hook.
- ]],
- Params =
- {
- { Name = "Player", Type = "{{cPlayer}}", Notes = "The player who broke the block" },
- { Name = "BlockX", Type = "number", Notes = "X-coord of the block" },
- { Name = "BlockY", Type = "number", Notes = "Y-coord of the block" },
- { Name = "BlockZ", Type = "number", Notes = "Z-coord of the block" },
- { Name = "BlockFace", Type = "number", Notes = "Face of the block upon which the player interacted. One of the BLOCK_FACE_ constants" },
- { Name = "BlockType", Type = "BLOCKTYPE", Notes = "The block type of the block" },
- { Name = "BlockMeta", Type = "NIBBLETYPE", Notes = "The block meta of the block" },
- },
- Returns = [[
- If the function returns false or no value, the next plugin's callback is called. If the function
- returns true, no other callback is called for this event.
- ]],
- }, -- HOOK_PLAYER_BROKEN_BLOCK
-}
-
-
-
-
-
diff --git a/MCServer/Plugins/APIDump/Hooks/OnPlayerDestroyed.lua b/MCServer/Plugins/APIDump/Hooks/OnPlayerDestroyed.lua
deleted file mode 100644
index dc033197a..000000000
--- a/MCServer/Plugins/APIDump/Hooks/OnPlayerDestroyed.lua
+++ /dev/null
@@ -1,27 +0,0 @@
-return
-{
- HOOK_PLAYER_DESTROYED =
- {
- CalledWhen = "A player object is about to be destroyed.",
- DefaultFnName = "OnPlayerDestroyed", -- also used as pagename
- Desc = [[
- This function is called before a {{cPlayer|player}} is about to be destroyed.
- The player has disconnected for whatever reason and is no longer in the server.
- If a plugin returns true, a leave message is not broadcast, and vice versa.
- However, whatever the return value, the player object is removed from memory.
- ]],
- Params =
- {
- { Name = "Player", Type = "{{cPlayer}}", Notes = "The destroyed player" },
- },
- Returns = [[
- If the function returns false or no value, other plugins' callbacks are called and a leave message is broadcast.
- If the function returns true, no other callbacks are called for this event and no leave message appears. Either way the player is removed internally.
- ]],
- }, -- HOOK_PLAYER_DESTROYED
-}
-
-
-
-
-
diff --git a/MCServer/Plugins/APIDump/Hooks/OnPlayerEating.lua b/MCServer/Plugins/APIDump/Hooks/OnPlayerEating.lua
deleted file mode 100644
index e77d02a96..000000000
--- a/MCServer/Plugins/APIDump/Hooks/OnPlayerEating.lua
+++ /dev/null
@@ -1,27 +0,0 @@
-return
-{
- HOOK_PLAYER_EATING =
- {
- CalledWhen = "When the player starts eating",
- DefaultFnName = "OnPlayerEating", -- also used as pagename
- Desc = [[
- This hook gets called when the {{cPlayer|player}} starts eating, after the server checks that the
- player can indeed eat (is not satiated and is holding food). Plugins may still refuse the eating by
- returning true.
- ]],
- Params =
- {
- { Name = "Player", Type = "{{cPlayer}}", Notes = "The player who started eating" },
- },
- Returns = [[
- If the function returns false or no value, the server calls the next plugin handler, and finally
- lets the player eat. If the function returns true, the server doesn't call any more callbacks for
- this event and aborts the eating. A "disallow" packet is sent to the client.
- ]],
- }, -- HOOK_PLAYER_EATING
-}
-
-
-
-
-
diff --git a/MCServer/Plugins/APIDump/Hooks/OnPlayerFished.lua b/MCServer/Plugins/APIDump/Hooks/OnPlayerFished.lua
deleted file mode 100644
index 4e093f4ae..000000000
--- a/MCServer/Plugins/APIDump/Hooks/OnPlayerFished.lua
+++ /dev/null
@@ -1,20 +0,0 @@
-return
-{
- HOOK_PLAYER_FISHED =
- {
- CalledWhen = "A player gets a reward from fishing.",
- DefaultFnName = "OnPlayerFished", -- also used as pagename
- Desc = [[
- This hook gets called after a player reels in the fishing rod. This is a notification-only hook, the reward has already been decided. If a plugin needs to modify the reward, use the {{OnPlayerFishing|HOOK_PLAYER_FISHING}} hook.
- ]],
- Params =
- {
- { Name = "Player", Type = "{{cPlayer}}", Notes = "The player who pulled the fish in." },
- { Name = "Reward", Type = "{{cItems}}", Notes = "The reward the player gets. It can be a fish, treasure and junk." },
- },
- Returns = [[
- If the function returns false or no value, the next plugin's callback is called. If the function returns true, no other
- callback is called for this event.
- ]],
- }, -- HOOK_PLAYER_FISHED
-};
diff --git a/MCServer/Plugins/APIDump/Hooks/OnPlayerFishing.lua b/MCServer/Plugins/APIDump/Hooks/OnPlayerFishing.lua
deleted file mode 100644
index c5aaecd92..000000000
--- a/MCServer/Plugins/APIDump/Hooks/OnPlayerFishing.lua
+++ /dev/null
@@ -1,21 +0,0 @@
-return
-{
- HOOK_PLAYER_FISHING =
- {
- CalledWhen = "A player is about to get a reward from fishing.",
- DefaultFnName = "OnPlayerFishing", -- also used as pagename
- Desc = [[
- This hook gets called when a player right clicks with a fishing rod while the floater is under water. The reward is already descided, but the plugin may change it.
- ]],
- Params =
- {
- { Name = "Player", Type = "{{cPlayer}}", Notes = "The player who pulled the fish in." },
- { Name = "Reward", Type = "{{cItems}}", Notes = "The reward the player gets. It can be a fish, treasure and junk." },
- },
- Returns = [[
- If the function returns false or no value, the next plugin's callback is called. Afterwards, the
- server gives the player his reward. If the function returns true, no other
- callback is called for this event and the player doesn't get his reward.
- ]],
- }, -- HOOK_PLAYER_FISHING
-};
diff --git a/MCServer/Plugins/APIDump/Hooks/OnPlayerFoodLevelChange.lua b/MCServer/Plugins/APIDump/Hooks/OnPlayerFoodLevelChange.lua
deleted file mode 100644
index 53637d5f1..000000000
--- a/MCServer/Plugins/APIDump/Hooks/OnPlayerFoodLevelChange.lua
+++ /dev/null
@@ -1,27 +0,0 @@
-return
-{
- HOOK_PLAYER_FOOD_LEVEL_CHANGE =
- {
- CalledWhen = "Called before the player food level changed. Plugin may override",
- DefaultFnName = "OnPlayerFoodLevelChange", -- also used as pagename
- Desc = [[
- This hook is called before the food level changes.
- The food level is not changed yet, plugins may choose
- to refuse the change.
- ]],
- Params =
- {
- { Name = "Player", Type = "{{cPlayer}}", Notes = "The player who changes the food level." },
- { Name = "NewFoodLevel", Type = "number", Notes = "The new food level." },
- },
- Returns = [[
- If the function returns false or no value, the next plugin's callback is called. Afterwards, the
- server changes the food level of the player. If the function returns true, no
- other callback is called for this event and the player's food level doesn't change.
- ]],
- }, -- HOOK_PLAYER_FOOD_LEVEL_CHANGE
-};
-
-
-
-
diff --git a/MCServer/Plugins/APIDump/Hooks/OnPlayerJoined.lua b/MCServer/Plugins/APIDump/Hooks/OnPlayerJoined.lua
deleted file mode 100644
index dcd16ed00..000000000
--- a/MCServer/Plugins/APIDump/Hooks/OnPlayerJoined.lua
+++ /dev/null
@@ -1,29 +0,0 @@
-return
-{
- HOOK_PLAYER_JOINED =
- {
- CalledWhen = "After Login and before Spawned, before being added to world. ",
- DefaultFnName = "OnPlayerJoined", -- also used as pagename
- Desc = [[
- This hook is called whenever a {{cPlayer|player}} has completely logged in. If authentication is
- enabled, this function is called after their name has been authenticated. It is called after
- {{OnLogin|HOOK_LOGIN}} and before {{OnPlayerSpawned|HOOK_PLAYER_SPAWNED}}, right after the player's
- entity is created, but not added to the world yet. The player is not yet visible to other players.
- Returning true will block a join message from being broadcast, but otherwise, the player is still allowed to join.
- Plugins wishing to refuse player's entry should kick the player using the {{cPlayer}}:Kick() function.
- ]],
- Params =
- {
- { Name = "Player", Type = "{{cPlayer}}", Notes = "The player who has joined the game" },
- },
- Returns = [[
- If the function returns false or no value, other plugins' callbacks are called and a join message is broadcast. If the function
- returns true, no other callbacks are called for this event and a join message is not sent. Either way the player is let in.
- ]],
- }, -- HOOK_PLAYER_JOINED
-}
-
-
-
-
-
diff --git a/MCServer/Plugins/APIDump/Hooks/OnPlayerLeftClick.lua b/MCServer/Plugins/APIDump/Hooks/OnPlayerLeftClick.lua
deleted file mode 100644
index 3d4c07950..000000000
--- a/MCServer/Plugins/APIDump/Hooks/OnPlayerLeftClick.lua
+++ /dev/null
@@ -1,47 +0,0 @@
-return
-{
- HOOK_PLAYER_LEFT_CLICK =
- {
- CalledWhen = "A left-click packet is received from the client. Plugin may override / refuse.",
- DefaultFnName = "OnPlayerLeftClick", -- also used as pagename
- Desc = [[
- This hook is called when Cuberite receives a left-click packet from the {{cClientHandle|client}}. It
- is called before any processing whatsoever is performed on the packet, meaning that hacked /
- malicious clients may be trigerring this event very often and with unchecked parameters. Therefore
- plugin authors are advised to use extreme caution with this callback.</p>
- <p>
- Plugins may refuse the default processing for the packet, causing Cuberite to behave as if the
- packet has never arrived. This may, however, create inconsistencies in the client - the client may
- think that they broke a block, while the server didn't process the breaking, etc. For this reason,
- if a plugin refuses the processing, Cuberite sends the block specified in the packet back to the
- client (as if placed anew), if the status code specified a block-break action. For other actions,
- plugins must rectify the situation on their own.</p>
- <p>
- The client sends the left-click packet for several other occasions, such as dropping the held item
- (Q keypress) or shooting an arrow. This is reflected in the Status code. Consult the
- <a href="http://wiki.vg/Protocol#0x0E">protocol documentation</a> for details on the actions.
- ]],
- Params =
- {
- { Name = "Player", Type = "{{cPlayer}}", Notes = "The player whose client sent the packet" },
- { Name = "BlockX", Type = "number", Notes = "X-coord of the block" },
- { Name = "BlockY", Type = "number", Notes = "Y-coord of the block" },
- { Name = "BlockZ", Type = "number", Notes = "Z-coord of the block" },
- { Name = "BlockFace", Type = "number", Notes = "Face of the block upon which the player interacted. One of the BLOCK_FACE_ constants" },
- { Name = "Action", Type = "number", Notes = "Action to be performed on the block (\"status\" in the protocol docs)" },
- },
- Returns = [[
- If the function returns false or no value, Cuberite calls other plugins' callbacks and finally sends
- the packet for further processing.</p>
- <p>
- If the function returns true, no other plugins are called, processing is halted. If the action was a
- block dig, Cuberite sends the block specified in the coords back to the client. The packet is
- dropped.
- ]],
- }, -- HOOK_PLAYER_LEFT_CLICK
-}
-
-
-
-
-
diff --git a/MCServer/Plugins/APIDump/Hooks/OnPlayerMoving.lua b/MCServer/Plugins/APIDump/Hooks/OnPlayerMoving.lua
deleted file mode 100644
index 4385bf94d..000000000
--- a/MCServer/Plugins/APIDump/Hooks/OnPlayerMoving.lua
+++ /dev/null
@@ -1,29 +0,0 @@
-return
-{
- HOOK_PLAYER_MOVING =
- {
- CalledWhen = "Player tried to move in the tick being currently processed. Plugin may refuse movement.",
- DefaultFnName = "OnPlayerMoving", -- also used as pagename
- Desc = [[
- This function is called in each server tick for each {{cPlayer|player}} that has sent any of the
- player-move packets. Plugins may refuse the movement.
- ]],
- Params =
- {
- { Name = "Player", Type = "{{cPlayer}}", Notes = "The player who has moved. The object already has the new position stored in it." },
- { Name = "OldPosition", Type = "{{Vector3d}}", Notes = "The old position." },
- { Name = "NewPosition", Type = "{{Vector3d}}", Notes = "The new position." },
- },
- Returns = [[
- If the function returns true, movement is prohibited.</p>
- <p>
- If the function returns false or no value, other plugins' callbacks are called and finally the new
- position is permanently stored in the cPlayer object.</p>
- ]],
- }, -- HOOK_PLAYER_MOVING
-}
-
-
-
-
-
diff --git a/MCServer/Plugins/APIDump/Hooks/OnPlayerPlacedBlock.lua b/MCServer/Plugins/APIDump/Hooks/OnPlayerPlacedBlock.lua
deleted file mode 100644
index 74d4c19e3..000000000
--- a/MCServer/Plugins/APIDump/Hooks/OnPlayerPlacedBlock.lua
+++ /dev/null
@@ -1,40 +0,0 @@
-return
-{
- HOOK_PLAYER_PLACED_BLOCK =
- {
- CalledWhen = "After a player has placed a block. Notification only.",
- DefaultFnName = "OnPlayerPlacedBlock", -- also used as pagename
- Desc = [[
- This hook is called after a {{cPlayer|player}} has placed a block in the {{cWorld|world}}. The block
- is already added to the world and the corresponding item removed from player's
- {{cInventory|inventory}}.</p>
- <p>
- Use the {{cPlayer}}:GetWorld() function to get the world to which the block belongs.</p>
- <p>
- See also the {{OnPlayerPlacingBlock|HOOK_PLAYER_PLACING_BLOCK}} hook for a similar hook called
- before the placement.</p>
- <p>
- If the client action results in multiple blocks being placed (such as a bed or a door), each separate
- block is reported through this hook. All the blocks are already present in the world before the first
- instance of this hook is called.
- ]],
- Params =
- {
- { Name = "Player", Type = "{{cPlayer}}", Notes = "The player who placed the block" },
- { Name = "BlockX", Type = "number", Notes = "X-coord of the block" },
- { Name = "BlockY", Type = "number", Notes = "Y-coord of the block" },
- { Name = "BlockZ", Type = "number", Notes = "Z-coord of the block" },
- { Name = "BlockType", Type = "BLOCKTYPE", Notes = "The block type of the block" },
- { Name = "BlockMeta", Type = "NIBBLETYPE", Notes = "The block meta of the block" },
- },
- Returns = [[
- If this function returns false or no value, Cuberite calls other plugins with the same event. If
- this function returns true, no other plugin is called for this event.
- ]],
- }, -- HOOK_PLAYER_PLACED_BLOCK
-}
-
-
-
-
-
diff --git a/MCServer/Plugins/APIDump/Hooks/OnPlayerPlacingBlock.lua b/MCServer/Plugins/APIDump/Hooks/OnPlayerPlacingBlock.lua
deleted file mode 100644
index b78acc327..000000000
--- a/MCServer/Plugins/APIDump/Hooks/OnPlayerPlacingBlock.lua
+++ /dev/null
@@ -1,45 +0,0 @@
-return
-{
- HOOK_PLAYER_PLACING_BLOCK =
- {
- CalledWhen = "Just before a player places a block. Plugin may override / refuse.",
- DefaultFnName = "OnPlayerPlacingBlock", -- also used as pagename
- Desc = [[
- This hook is called just before a {{cPlayer|player}} places a block in the {{cWorld|world}}. The
- block is not yet placed, plugins may choose to override the default behavior or refuse the placement
- at all.</p>
- <p>
- Note that the client already expects that the block has been placed. For that reason, if a plugin
- refuses the placement, Cuberite sends the old block at the provided coords to the client.</p>
- <p>
- Use the {{cPlayer}}:GetWorld() function to get the world to which the block belongs.</p>
- <p>
- See also the {{OnPlayerPlacedBlock|HOOK_PLAYER_PLACED_BLOCK}} hook for a similar hook called after
- the placement.</p>
- <p>
- If the client action results in multiple blocks being placed (such as a bed or a door), each separate
- block is reported through this hook and only if all of them succeed, all the blocks are placed. If
- any one of the calls are refused by the plugin, all the blocks are refused and reverted on the client.
- ]],
- Params =
- {
- { Name = "Player", Type = "{{cPlayer}}", Notes = "The player who is placing the block" },
- { Name = "BlockX", Type = "number", Notes = "X-coord of the block" },
- { Name = "BlockY", Type = "number", Notes = "Y-coord of the block" },
- { Name = "BlockZ", Type = "number", Notes = "Z-coord of the block" },
- { Name = "BlockType", Type = "BLOCKTYPE", Notes = "The block type of the block" },
- { Name = "BlockMeta", Type = "NIBBLETYPE", Notes = "The block meta of the block" },
- },
- Returns = [[
- If this function returns false or no value, Cuberite calls other plugins with the same event and
- finally places the block and removes the corresponding item from player's inventory. If this
- function returns true, no other plugin is called for this event, Cuberite sends the old block at
- the specified coords to the client and drops the packet.
- ]],
- }, -- HOOK_PLAYER_PLACING_BLOCK
-}
-
-
-
-
-
diff --git a/MCServer/Plugins/APIDump/Hooks/OnPlayerRightClick.lua b/MCServer/Plugins/APIDump/Hooks/OnPlayerRightClick.lua
deleted file mode 100644
index e1b95197d..000000000
--- a/MCServer/Plugins/APIDump/Hooks/OnPlayerRightClick.lua
+++ /dev/null
@@ -1,40 +0,0 @@
-return
-{
- HOOK_PLAYER_RIGHT_CLICK =
- {
- CalledWhen = "A right-click packet is received from the client. Plugin may override / refuse.",
- DefaultFnName = "OnPlayerRightClick", -- also used as pagename
- Desc = [[
- This hook is called when Cuberite receives a right-click packet from the {{cClientHandle|client}}. It
- is called before any processing whatsoever is performed on the packet, meaning that hacked /
- malicious clients may be trigerring this event very often and with unchecked parameters. Therefore
- plugin authors are advised to use extreme caution with this callback.</p>
- <p>
- Plugins may refuse the default processing for the packet, causing Cuberite to behave as if the
- packet has never arrived. This may, however, create inconsistencies in the client - the client may
- think that they placed a block, while the server didn't process the placing, etc.
- ]],
- Params =
- {
- { Name = "Player", Type = "{{cPlayer}}", Notes = "The player whose client sent the packet" },
- { Name = "BlockX", Type = "number", Notes = "X-coord of the block" },
- { Name = "BlockY", Type = "number", Notes = "Y-coord of the block" },
- { Name = "BlockZ", Type = "number", Notes = "Z-coord of the block" },
- { Name = "BlockFace", Type = "number", Notes = "Face of the block upon which the player interacted. One of the BLOCK_FACE_ constants" },
- { Name = "CursorX", Type = "number", Notes = "X-coord of the mouse crosshair on the block" },
- { Name = "CursorY", Type = "number", Notes = "Y-coord of the mouse crosshair on the block" },
- { Name = "CursorZ", Type = "number", Notes = "Z-coord of the mouse crosshair on the block" },
- },
- Returns = [[
- If the function returns false or no value, Cuberite calls other plugins' callbacks and finally sends
- the packet for further processing.</p>
- <p>
- If the function returns true, no other plugins are called, processing is halted.
- ]],
- }, -- HOOK_PLAYER_RIGHT_CLICK
-}
-
-
-
-
-
diff --git a/MCServer/Plugins/APIDump/Hooks/OnPlayerRightClickingEntity.lua b/MCServer/Plugins/APIDump/Hooks/OnPlayerRightClickingEntity.lua
deleted file mode 100644
index b271cf058..000000000
--- a/MCServer/Plugins/APIDump/Hooks/OnPlayerRightClickingEntity.lua
+++ /dev/null
@@ -1,27 +0,0 @@
-return
-{
- HOOK_PLAYER_RIGHT_CLICKING_ENTITY =
- {
- CalledWhen = "A player has right-clicked an entity. Plugins may override / refuse.",
- DefaultFnName = "OnPlayerRightClickingEntity", -- also used as pagename
- Desc = [[
- This hook is called when the {{cPlayer|player}} right-clicks an {{cEntity|entity}}. Plugins may
- override the default behavior or even cancel the default processing.
- ]],
- Params =
- {
- { Name = "Player", Type = "{{cPlayer}}", Notes = "The player who has right-clicked the entity" },
- { Name = "Entity", Type = "{{cEntity}} descendant", Notes = "The entity that has been right-clicked" },
- },
- Returns = [[
- If the functino returns false or no value, Cuberite calls other plugins' callbacks and finally does
- the default processing for the right-click. If the function returns true, no other callbacks are
- called and the default processing is skipped.
- ]],
- }, -- HOOK_PLAYER_RIGHT_CLICKING_ENTITY
-}
-
-
-
-
-
diff --git a/MCServer/Plugins/APIDump/Hooks/OnPlayerShooting.lua b/MCServer/Plugins/APIDump/Hooks/OnPlayerShooting.lua
deleted file mode 100644
index 7315ede7a..000000000
--- a/MCServer/Plugins/APIDump/Hooks/OnPlayerShooting.lua
+++ /dev/null
@@ -1,32 +0,0 @@
-return
-{
- HOOK_PLAYER_SHOOTING =
- {
- CalledWhen = "When the player releases the bow, shooting an arrow (other projectiles: unknown)",
- DefaultFnName = "OnPlayerShooting", -- also used as pagename
- Desc = [[
- This hook is called when the {{cPlayer|player}} shoots their bow. It is called for the actual
- release of the {{cArrowEntity|arrow}}. FIXME: It is currently unknown whether other
- {{cProjectileEntity|projectiles}} (snowballs, eggs) trigger this hook.</p>
- <p>
- To get the player's position and direction, use the {{cPlayer}}:GetEyePosition() and
- cPlayer:GetLookVector() functions. Note that for shooting a bow, the position for the arrow creation
- is not at the eye pos, some adjustments are required. FIXME: Export the {{cPlayer}} function for
- this adjustment.
- ]],
- Params =
- {
- { Name = "Player", Type = "{{cPlayer}}", Notes = "The player shooting" },
- },
- Returns = [[
- If the function returns false or no value, the next plugin's callback is called, and finally
- Cuberite creates the projectile. If the functino returns true, no other callback is called and no
- projectile is created.
- ]],
- }, -- HOOK_PLAYER_SHOOTING
-}
-
-
-
-
-
diff --git a/MCServer/Plugins/APIDump/Hooks/OnPlayerSpawned.lua b/MCServer/Plugins/APIDump/Hooks/OnPlayerSpawned.lua
deleted file mode 100644
index 190909ee5..000000000
--- a/MCServer/Plugins/APIDump/Hooks/OnPlayerSpawned.lua
+++ /dev/null
@@ -1,32 +0,0 @@
-return
-{
- HOOK_PLAYER_SPAWNED =
- {
- CalledWhen = "After a player (re)spawns in the world to which they belong to.",
- DefaultFnName = "OnPlayerSpawned", -- also used as pagename
- Desc = [[
- This hook is called after a {{cPlayer|player}} has spawned in the world. It is called after
- {{OnLogin|HOOK_LOGIN}} and {{OnPlayerJoined|HOOK_PLAYER_JOINED}}, after the player name has been
- authenticated, the initial worldtime, inventory and health have been sent to the player and the
- player spawn packet has been broadcast to all players near enough to the player spawn place. This is
- a notification-only event, plugins wishing to refuse player's entry should kick the player using the
- {{cPlayer}}:Kick() function.</p>
- <p>
- This hook is also called when the player respawns after death (and a respawn packet is received from
- the client, meaning the player has already clicked the Respawn button).
- ]],
- Params =
- {
- { Name = "Player", Type = "{{cPlayer}}", Notes = "The player who has (re)spawned" },
- },
- Returns = [[
- If the function returns false or no value, other plugins' callbacks are called. If the function
- returns true, no other callbacks are called for this event. There is no overridable behavior.
- ]],
- }, -- HOOK_PLAYER_SPAWNED
-}
-
-
-
-
-
diff --git a/MCServer/Plugins/APIDump/Hooks/OnPlayerTossingItem.lua b/MCServer/Plugins/APIDump/Hooks/OnPlayerTossingItem.lua
deleted file mode 100644
index 880404bf8..000000000
--- a/MCServer/Plugins/APIDump/Hooks/OnPlayerTossingItem.lua
+++ /dev/null
@@ -1,31 +0,0 @@
-return
-{
- HOOK_PLAYER_TOSSING_ITEM =
- {
- CalledWhen = "A player is tossing an item. Plugin may override / refuse.",
- DefaultFnName = "OnPlayerTossingItem", -- also used as pagename
- Desc = [[
- This hook is called when a {{cPlayer|player}} has tossed an item. The
- {{cPickup|pickup}} has not been spawned yet. Plugins may disallow the tossing, but in that case they
- need to clean up - the player's client already thinks the item has been tossed so the
- {{cInventory|inventory}} needs to be re-sent to the player.</p>
- <p>
- To get the item that is about to be tossed, call the {{cPlayer}}:GetEquippedItem() function.
- ]],
- Params =
- {
- { Name = "Player", Type = "{{cPlayer}}", Notes = "The player tossing an item" },
- },
- Returns = [[
- If the function returns false or no value, other plugins' callbacks are called and finally Cuberite
- creates the pickup for the item and tosses it, using {{cPlayer}}:TossHeldItem, {{cPlayer}}:TossEquippedItem,
- or {{cPlayer}}:TossPickup. If the function returns true, no other callbacks are called for this event
- and Cuberite doesn't toss the item.
- ]],
- }, -- HOOK_PLAYER_TOSSING_ITEM
-}
-
-
-
-
-
diff --git a/MCServer/Plugins/APIDump/Hooks/OnPlayerUsedBlock.lua b/MCServer/Plugins/APIDump/Hooks/OnPlayerUsedBlock.lua
deleted file mode 100644
index babd70fcc..000000000
--- a/MCServer/Plugins/APIDump/Hooks/OnPlayerUsedBlock.lua
+++ /dev/null
@@ -1,46 +0,0 @@
-return
-{
- HOOK_PLAYER_USED_BLOCK =
- {
- CalledWhen = "A player has just used a block (chest, furnace...). Notification only.",
- DefaultFnName = "OnPlayerUsedBlock", -- also used as pagename
- Desc = [[
- This hook is called after a {{cPlayer|player}} has right-clicked a block that can be used, such as a
- {{cChestEntity|chest}} or a lever. It is called after Cuberite processes the usage (sends the UI
- handling packets / toggles redstone). Note that for UI-related blocks, the player is most likely
- still using the UI. This is a notification-only event.</p>
- <p>
- Note that the block coords given in this callback are for the (solid) block that is being clicked,
- not the air block between it and the player.</p>
- <p>
- To get the world at which the right-click occurred, use the {{cPlayer}}:GetWorld() function.</p>
- <p>
- See also the {{OnPlayerUsingBlock|HOOK_PLAYER_USING_BLOCK}} for a similar hook called before the
- use, the {{OnPlayerUsingItem|HOOK_PLAYER_USING_ITEM}} and {{OnPlayerUsedItem|HOOK_PLAYER_USED_ITEM}}
- for similar hooks called when a player interacts with any block with a usable item in hand, such as
- a bucket.
- ]],
- Params =
- {
- { Name = "Player", Type = "{{cPlayer}}", Notes = "The player who used the block" },
- { Name = "BlockX", Type = "number", Notes = "X-coord of the clicked block" },
- { Name = "BlockY", Type = "number", Notes = "Y-coord of the clicked block" },
- { Name = "BlockZ", Type = "number", Notes = "Z-coord of the clicked block" },
- { Name = "BlockFace", Type = "number", Notes = "Face of clicked block which has been clicked. One of the BLOCK_FACE_ constants" },
- { Name = "CursorX", Type = "number", Notes = "X-coord of the cursor crosshair on the block being clicked" },
- { Name = "CursorY", Type = "number", Notes = "Y-coord of the cursor crosshair on the block being clicked" },
- { Name = "CursorZ", Type = "number", Notes = "Z-coord of the cursor crosshair on the block being clicked" },
- { Name = "BlockType", Type = "number", Notes = "Block type of the clicked block" },
- { Name = "BlockMeta", Type = "number", Notes = "Block meta of the clicked block" },
- },
- Returns = [[
- If the function returns false or no value, other plugins' callbacks are called. If the function
- returns true, no other callbacks are called for this event.
- ]],
- }, -- HOOK_PLAYER_USED_BLOCK
-}
-
-
-
-
-
diff --git a/MCServer/Plugins/APIDump/Hooks/OnPlayerUsedItem.lua b/MCServer/Plugins/APIDump/Hooks/OnPlayerUsedItem.lua
deleted file mode 100644
index 6089928e2..000000000
--- a/MCServer/Plugins/APIDump/Hooks/OnPlayerUsedItem.lua
+++ /dev/null
@@ -1,46 +0,0 @@
-return
-{
- HOOK_PLAYER_USED_ITEM =
- {
- CalledWhen = "A player has used an item in hand (bucket...)",
- DefaultFnName = "OnPlayerUsedItem", -- also used as pagename
- Desc = [[
- This hook is called after a {{cPlayer|player}} has right-clicked a block with an {{cItem|item}} that
- can be used (is not placeable, is not food and clicked block is not use-able), such as a bucket or a
- hoe. It is called after Cuberite processes the usage (places fluid / turns dirt to farmland).
- This is an information-only hook, there is no way to cancel the event anymore.</p>
- <p>
- Note that the block coords given in this callback are for the (solid) block that is being clicked,
- not the air block between it and the player.</p>
- <p>
- To get the world at which the right-click occurred, use the {{cPlayer}}:GetWorld() function. To get
- the item that the player is using, use the {{cPlayer}}:GetEquippedItem() function.</p>
- <p>
- See also the {{OnPlayerUsingItem|HOOK_PLAYER_USING_ITEM}} for a similar hook called before the use,
- the {{OnPlayerUsingBlock|HOOK_PLAYER_USING_BLOCK}} and {{OnPlayerUsedBlock|HOOK_PLAYER_USED_BLOCK}}
- for similar hooks called when a player interacts with a block, such as a chest.
- ]],
- Params =
- {
- { Name = "Player", Type = "{{cPlayer}}", Notes = "The player who used the item" },
- { Name = "BlockX", Type = "number", Notes = "X-coord of the clicked block" },
- { Name = "BlockY", Type = "number", Notes = "Y-coord of the clicked block" },
- { Name = "BlockZ", Type = "number", Notes = "Z-coord of the clicked block" },
- { Name = "BlockFace", Type = "number", Notes = "Face of clicked block which has been clicked. One of the BLOCK_FACE_ constants" },
- { Name = "CursorX", Type = "number", Notes = "X-coord of the cursor crosshair on the block being clicked" },
- { Name = "CursorY", Type = "number", Notes = "Y-coord of the cursor crosshair on the block being clicked" },
- { Name = "CursorZ", Type = "number", Notes = "Z-coord of the cursor crosshair on the block being clicked" },
- { Name = "BlockType", Type = "number", Notes = "Block type of the clicked block" },
- { Name = "BlockMeta", Type = "number", Notes = "Block meta of the clicked block" },
- },
- Returns = [[
- If the function returns false or no value, other plugins' callbacks are called. If the function
- returns true, no other callbacks are called for this event.
- ]],
- }, -- HOOK_PLAYER_USED_ITEM
-}
-
-
-
-
-
diff --git a/MCServer/Plugins/APIDump/Hooks/OnPlayerUsingBlock.lua b/MCServer/Plugins/APIDump/Hooks/OnPlayerUsingBlock.lua
deleted file mode 100644
index b4ecb5ca1..000000000
--- a/MCServer/Plugins/APIDump/Hooks/OnPlayerUsingBlock.lua
+++ /dev/null
@@ -1,46 +0,0 @@
-return
-{
- HOOK_PLAYER_USING_BLOCK =
- {
- CalledWhen = "Just before a player uses a block (chest, furnace...). Plugin may override / refuse.",
- DefaultFnName = "OnPlayerUsingBlock", -- also used as pagename
- Desc = [[
- This hook is called when a {{cPlayer|player}} has right-clicked a block that can be used, such as a
- {{cChestEntity|chest}} or a lever. It is called before Cuberite processes the usage (sends the UI
- handling packets / toggles redstone). Plugins may refuse the interaction by returning true.</p>
- <p>
- Note that the block coords given in this callback are for the (solid) block that is being clicked,
- not the air block between it and the player.</p>
- <p>
- To get the world at which the right-click occurred, use the {{cPlayer}}:GetWorld() function.</p>
- <p>
- See also the {{OnPlayerUsedBlock|HOOK_PLAYER_USED_BLOCK}} for a similar hook called after the use, the
- {{OnPlayerUsingItem|HOOK_PLAYER_USING_ITEM}} and {{OnPlayerUsedItem|HOOK_PLAYER_USED_ITEM}} for
- similar hooks called when a player interacts with any block with a usable item in hand, such as a
- bucket.
- ]],
- Params =
- {
- { Name = "Player", Type = "{{cPlayer}}", Notes = "The player who is using the block" },
- { Name = "BlockX", Type = "number", Notes = "X-coord of the clicked block" },
- { Name = "BlockY", Type = "number", Notes = "Y-coord of the clicked block" },
- { Name = "BlockZ", Type = "number", Notes = "Z-coord of the clicked block" },
- { Name = "BlockFace", Type = "number", Notes = "Face of clicked block which has been clicked. One of the BLOCK_FACE_ constants" },
- { Name = "CursorX", Type = "number", Notes = "X-coord of the cursor crosshair on the block being clicked" },
- { Name = "CursorY", Type = "number", Notes = "Y-coord of the cursor crosshair on the block being clicked" },
- { Name = "CursorZ", Type = "number", Notes = "Z-coord of the cursor crosshair on the block being clicked" },
- { Name = "BlockType", Type = "number", Notes = "Block type of the clicked block" },
- { Name = "BlockMeta", Type = "number", Notes = "Block meta of the clicked block" },
- },
- Returns = [[
- If the function returns false or no value, other plugins' callbacks are called and then Cuberite
- processes the interaction. If the function returns true, no other callbacks are called for this
- event and the interaction is silently dropped.
- ]],
- }, -- HOOK_PLAYER_USING_BLOCK
-}
-
-
-
-
-
diff --git a/MCServer/Plugins/APIDump/Hooks/OnPlayerUsingItem.lua b/MCServer/Plugins/APIDump/Hooks/OnPlayerUsingItem.lua
deleted file mode 100644
index 9b2949f93..000000000
--- a/MCServer/Plugins/APIDump/Hooks/OnPlayerUsingItem.lua
+++ /dev/null
@@ -1,47 +0,0 @@
-return
-{
- HOOK_PLAYER_USING_ITEM =
- {
- CalledWhen = "Just before a player uses an item in hand (bucket...). Plugin may override / refuse.",
- DefaultFnName = "OnPlayerUsingItem", -- also used as pagename
- Desc = [[
- This hook is called when a {{cPlayer|player}} has right-clicked a block with an {{cItem|item}} that
- can be used (is not placeable, is not food and clicked block is not use-able), such as a bucket or a
- hoe. It is called before Cuberite processes the usage (places fluid / turns dirt to farmland).
- Plugins may refuse the interaction by returning true.</p>
- <p>
- Note that the block coords given in this callback are for the (solid) block that is being clicked,
- not the air block between it and the player.</p>
- <p>
- To get the world at which the right-click occurred, use the {{cPlayer}}:GetWorld() function. To get
- the item that the player is using, use the {{cPlayer}}:GetEquippedItem() function.</p>
- <p>
- See also the {{OnPlayerUsedItem|HOOK_PLAYER_USED_ITEM}} for a similar hook called after the use, the
- {{OnPlayerUsingBlock|HOOK_PLAYER_USING_BLOCK}} and {{OnPlayerUsedBlock|HOOK_PLAYER_USED_BLOCK}} for
- similar hooks called when a player interacts with a block, such as a chest.
- ]],
- Params =
- {
- { Name = "Player", Type = "{{cPlayer}}", Notes = "The player who is using the item" },
- { Name = "BlockX", Type = "number", Notes = "X-coord of the clicked block" },
- { Name = "BlockY", Type = "number", Notes = "Y-coord of the clicked block" },
- { Name = "BlockZ", Type = "number", Notes = "Z-coord of the clicked block" },
- { Name = "BlockFace", Type = "number", Notes = "Face of clicked block which has been clicked. One of the BLOCK_FACE_ constants" },
- { Name = "CursorX", Type = "number", Notes = "X-coord of the cursor crosshair on the block being clicked" },
- { Name = "CursorY", Type = "number", Notes = "Y-coord of the cursor crosshair on the block being clicked" },
- { Name = "CursorZ", Type = "number", Notes = "Z-coord of the cursor crosshair on the block being clicked" },
- { Name = "BlockType", Type = "number", Notes = "Block type of the clicked block" },
- { Name = "BlockMeta", Type = "number", Notes = "Block meta of the clicked block" },
- },
- Returns = [[
- If the function returns false or no value, other plugins' callbacks are called and then Cuberite
- processes the interaction. If the function returns true, no other callbacks are called for this
- event and the interaction is silently dropped.
- ]],
- }, -- HOOK_PLAYER_USING_ITEM
-}
-
-
-
-
-
diff --git a/MCServer/Plugins/APIDump/Hooks/OnPluginMessage.lua b/MCServer/Plugins/APIDump/Hooks/OnPluginMessage.lua
deleted file mode 100644
index 743d3bb5e..000000000
--- a/MCServer/Plugins/APIDump/Hooks/OnPluginMessage.lua
+++ /dev/null
@@ -1,25 +0,0 @@
-return
-{
- HOOK_PLUGIN_MESSAGE =
- {
- CalledWhen = "The server receives a plugin message from a client",
- DefaultFnName = "OnPluginMessage", -- also used as pagename
- Desc = [[
- A plugin may implement an OnPluginMessage() function and register it as a Hook to process plugin messages
- from the players. The function is then called for every plugin message sent from any player.
- ]],
- Params = {
- { Name = "Client", Type = "{{cClientHandle}}", Notes = "The client who sent the plugin message" },
- { Name = "Channel", Type = "string", Notes = "The channel on which the message was sent" },
- { Name = "Message", Type = "string", Notes = "The message's payload" },
- },
- Returns = [[
- If the function returns false or no value, other plugins' callbacks are called. If the function
- returns true, no other callbacks are called for this event.
- ]],
- }, -- HOOK_CHAT
-}
-
-
-
-
diff --git a/MCServer/Plugins/APIDump/Hooks/OnPluginsLoaded.lua b/MCServer/Plugins/APIDump/Hooks/OnPluginsLoaded.lua
deleted file mode 100644
index 2c8a5a2c9..000000000
--- a/MCServer/Plugins/APIDump/Hooks/OnPluginsLoaded.lua
+++ /dev/null
@@ -1,84 +0,0 @@
-return
-{
- HOOK_PLUGINS_LOADED =
- {
- CalledWhen = "All the enabled plugins have been loaded",
- DefaultFnName = "OnPluginsLoaded", -- also used as pagename
- Desc = [[
- This callback gets called when the server finishes loading and initializing plugins. This is the
- perfect occasion for a plugin to query other plugins through {{cPluginManager}}:GetPlugin() and
- possibly start communicating with them using the {{cPlugin}}:Call() function.
- ]],
- Params = {},
- Returns = [[
- The return value is ignored, all registered callbacks are called.
- ]],
- CodeExamples =
- {
- {
- Title = "CoreMessaging",
- Desc = [[
- This example shows how to implement the CoreMessaging functionality - messages to players will be
- sent through the Core plugin, formatted by that plugin. As a fallback for when the Core plugin is
- not present, the messages are sent directly by this code, unformatted.
- ]],
- Code = [[
--- These are the fallback functions used when the Core is not present:
-local function SendMessageFallback(a_Player, a_Message)
- a_Player:SendMessage(a_Message);
-end
-
-local function SendMessageSuccessFallback(a_Player, a_Message)
- a_Player:SendMessage(a_Message);
-end
-
-local function SendMessageFailureFallback(a_Player, a_Message)
- a_Player:SendMessage(a_Message);
-end
-
--- These three "variables" will hold the actual functions to call.
--- By default they are initialized to the Fallback variants,
--- but will be redirected to Core when all plugins load
-SendMessage = SendMessageFallback;
-SendMessageSuccess = SendMessageSuccessFallback;
-SendMessageFailure = SendMessageFailureFallback;
-
--- The callback tries to connect to the Core
--- If successful, overwrites the three functions with Core ones
-local function OnPluginsLoaded()
- local CorePlugin = cPluginManager:Get():GetPlugin("Core");
- if (CorePlugin == nil) then
- -- The Core is not loaded, keep the Fallback functions
- return;
- end
-
- -- Overwrite the three functions with Core functionality:
- SendMessage = function(a_Player, a_Message)
- CorePlugin:Call("SendMessage", a_Player, a_Message);
- end
- SendMessageSuccess = function(a_Player, a_Message)
- CorePlugin:Call("SendMessageSuccess", a_Player, a_Message);
- end
- SendMessageFailure = function(a_Player, a_Message)
- CorePlugin:Call("SendMessageFailure", a_Player, a_Message);
- end
-end
-
--- Global scope, register the callback:
-cPluginManager.AddHook(cPluginManager.HOOK_PLUGINS_LOADED, CoreMessagingPluginsLoaded);
-
-
--- Usage, anywhere else in the plugin:
-SendMessageFailure(
- a_Player,
- "Cannot teleport to player, the destination player " .. PlayerName .. " was not found"
-);
- ]],
- },
- } , -- CodeExamples
- }, -- HOOK_PLUGINS_LOADED
-}
-
-
-
-
diff --git a/MCServer/Plugins/APIDump/Hooks/OnPostCrafting.lua b/MCServer/Plugins/APIDump/Hooks/OnPostCrafting.lua
deleted file mode 100644
index 0dc9d4c73..000000000
--- a/MCServer/Plugins/APIDump/Hooks/OnPostCrafting.lua
+++ /dev/null
@@ -1,36 +0,0 @@
-return
-{
- HOOK_POST_CRAFTING =
- {
- CalledWhen = "After the built-in recipes are checked and a recipe was found.",
- DefaultFnName = "OnPostCrafting", -- also used as pagename
- Desc = [[
- This hook is called when a {{cPlayer|player}} changes contents of their
- {{cCraftingGrid|crafting grid}}, after the recipe has been established by Cuberite. Plugins may use
- this to modify the resulting recipe or provide an alternate recipe.</p>
- <p>
- If a plugin implements custom recipes, it should do so using the {{OnPreCrafting|HOOK_PRE_CRAFTING}}
- hook, because that will save the server from going through the built-in recipes. The
- HOOK_POST_CRAFTING hook is intended as a notification, with a chance to tweak the result.</p>
- <p>
- Note that this hook is not called if a built-in recipe is not found;
- {{OnCraftingNoRecipe|HOOK_CRAFTING_NO_RECIPE}} is called instead in such a case.
- ]],
- Params =
- {
- { Name = "Player", Type = "{{cPlayer}}", Notes = "The player who has changed their crafting grid contents" },
- { Name = "Grid", Type = "{{cCraftingGrid}}", Notes = "The new crafting grid contents" },
- { Name = "Recipe", Type = "{{cCraftingRecipe}}", Notes = "The recipe that Cuberite has decided to use (can be tweaked by plugins)" },
- },
- Returns = [[
- If the function returns false or no value, other plugins' callbacks are called. If the function
- returns true, no other callbacks are called for this event. In either case, Cuberite uses the value
- of Recipe as the recipe to be presented to the player.
- ]],
- }, -- HOOK_POST_CRAFTING
-}
-
-
-
-
-
diff --git a/MCServer/Plugins/APIDump/Hooks/OnPreCrafting.lua b/MCServer/Plugins/APIDump/Hooks/OnPreCrafting.lua
deleted file mode 100644
index 8f24fc881..000000000
--- a/MCServer/Plugins/APIDump/Hooks/OnPreCrafting.lua
+++ /dev/null
@@ -1,37 +0,0 @@
-return
-{
- HOOK_PRE_CRAFTING =
- {
- CalledWhen = "Before the built-in recipes are checked.",
- DefaultFnName = "OnPreCrafting", -- also used as pagename
- Desc = [[
- This hook is called when a {{cPlayer|player}} changes contents of their
- {{cCraftingGrid|crafting grid}}, before the built-in recipes are searched for a match by Cuberite.
- Plugins may use this hook to provide a custom recipe.</p>
- <p>
- If you intend to tweak built-in recipes, use the {{OnPostCrafting|HOOK_POST_CRAFTING}} hook, because
- that will be called once the built-in recipe is matched.</p>
- <p>
- Also note a third hook, {{OnCraftingNoRecipe|HOOK_CRAFTING_NO_RECIPE}}, that is called when Cuberite
- cannot find any built-in recipe for the given ingredients.
- ]],
- Params =
- {
- { Name = "Player", Type = "{{cPlayer}}", Notes = "The player who has changed their crafting grid contents" },
- { Name = "Grid", Type = "{{cCraftingGrid}}", Notes = "The new crafting grid contents" },
- { Name = "Recipe", Type = "{{cCraftingRecipe}}", Notes = "The recipe that Cuberite will use. Modify this object to change the recipe" },
- },
- Returns = [[
- If the function returns false or no value, other plugins' callbacks are called and then Cuberite
- searches the built-in recipes. The Recipe output parameter is ignored in this case.</p>
- <p>
- If the function returns true, no other callbacks are called for this event and Cuberite uses the
- recipe stored in the Recipe output parameter.
- ]],
- }, -- HOOK_PRE_CRAFTING
-}
-
-
-
-
-
diff --git a/MCServer/Plugins/APIDump/Hooks/OnProjectileHitBlock.lua b/MCServer/Plugins/APIDump/Hooks/OnProjectileHitBlock.lua
deleted file mode 100644
index 72cf85821..000000000
--- a/MCServer/Plugins/APIDump/Hooks/OnProjectileHitBlock.lua
+++ /dev/null
@@ -1,29 +0,0 @@
-return
-{
- HOOK_PROJECTILE_HIT_BLOCK =
- {
- CalledWhen = "A projectile hits a solid block.",
- DefaultFnName = "OnProjectileHitBlock", -- also used as pagename
- Desc = [[
- This hook is called when a {{cProjectileEntity|projectile}} hits a solid block..
- ]],
- Params =
- {
- { Name = "ProjectileEntity", Type = "{{cProjectileEntity}}", Notes = "The projectile that hit an entity." },
- { Name = "BlockX", Type = "number", Notes = "The X-coord where the projectile hit." },
- { Name = "BlockY", Type = "number", Notes = "The Y-coord where the projectile hit." },
- { Name = "BlockZ", Type = "number", Notes = "The Z-coord where the projectile hit." },
- { Name = "BlockFace", Type = "number", Notes = "The side of the block where the projectile hit." },
- { Name = "BlockHitPos", Type = "Vector3d", Notes = "The exact position where the projectile hit." },
- },
- Returns = [[
- If the function returns false or no value, the next plugin's callback is called. If the function
- returns true, no other callback is called for this event and the projectile flies through block..
- ]],
- }, -- HOOK_PROJECTILE_HIT_BLOCK
-}
-
-
-
-
-
diff --git a/MCServer/Plugins/APIDump/Hooks/OnProjectileHitEntity.lua b/MCServer/Plugins/APIDump/Hooks/OnProjectileHitEntity.lua
deleted file mode 100644
index dd949fb46..000000000
--- a/MCServer/Plugins/APIDump/Hooks/OnProjectileHitEntity.lua
+++ /dev/null
@@ -1,25 +0,0 @@
-return
-{
- HOOK_PROJECTILE_HIT_ENTITY =
- {
- CalledWhen = "A projectile hits another entity.",
- DefaultFnName = "OnProjectileHitEntity", -- also used as pagename
- Desc = [[
- This hook is called when a {{cProjectileEntity|projectile}} hits another entity.
- ]],
- Params =
- {
- { Name = "ProjectileEntity", Type = "{{cProjectileEntity}}", Notes = "The projectile that hit an entity." },
- { Name = "Entity", Type = "{{cEntity}}", Notes = "The entity wich was hit." },
- },
- Returns = [[
- If the function returns false or no value, the next plugin's callback is called. If the function
- returns true, no other callback is called for this event and the projectile flies through the entity.
- ]],
- }, -- HOOK_PROJECTILE_HIT_ENTITY
-}
-
-
-
-
-
diff --git a/MCServer/Plugins/APIDump/Hooks/OnServerPing.lua b/MCServer/Plugins/APIDump/Hooks/OnServerPing.lua
deleted file mode 100644
index 430465786..000000000
--- a/MCServer/Plugins/APIDump/Hooks/OnServerPing.lua
+++ /dev/null
@@ -1,53 +0,0 @@
-return
-{
- HOOK_SERVER_PING =
- {
- CalledWhen = "Client pings the server from the server list.",
- DefaultFnName = "OnServerPing", -- also used as pagename
- Desc = [[
- A plugin may implement an OnServerPing() function and register it as a Hook to process pings from
- clients in the server server list. It can change the logged in players and player capacity, as well
- as the server description and the favicon, that are displayed to the client in the server list.</p>
- <p>
- The client handle already has its protocol version assigned to it, so the plugin can check that; however,
- there's no username associated with the client yet, and no player object.
- ]],
- Params = {
- { Name = "ClientHandle", Type = "{{cClientHandle}}", Notes = "The client handle that pinged the server" },
- { Name = "ServerDescription", Type = "string", Notes = "The server description" },
- { Name = "OnlinePlayersCount", Type = "number", Notes = "The number of players currently on the server" },
- { Name = "MaxPlayersCount", Type = "number", Notes = "The current player cap for the server" },
- { Name = "Favicon", Type = "string", Notes = "The base64 encoded favicon to be displayed in the server list for compatible clients" },
- },
- Returns = [[
- The plugin can return whether to continue processing of the hook with other plugins, the server description to
- be displayed to the client, the currently online players, the player cap and the base64/png favicon data, in that order.
- ]],
- CodeExamples = {
- {
- Title = "Change information returned to the player",
- Desc = "Tells the client that the server description is 'test', there are one more players online than there actually are, and that the player cap is zero. It also changes the favicon data.",
- Code = [[
-function OnServerPing(ClientHandle, ServerDescription, OnlinePlayers, MaxPlayers, Favicon)
- -- Change Server Description
- ServerDescription = "Test"
-
- -- Change online / max players
- OnlinePlayers = OnlinePlayers + 1
- MaxPlayers = 0
-
- -- Change favicon
- if cFile:IsFile("my-favicon.png") then
- local FaviconData = cFile:ReadWholeFile("my-favicon.png")
- if (FaviconData ~= "") and (FaviconData ~= nil) then
- Favicon = Base64Encode(FaviconData)
- end
- end
-
- return false, ServerDescription, OnlinePlayers, MaxPlayers, Favicon
-end
- ]],
- },
- },
- }, -- HOOK_SERVER_PING
-}
diff --git a/MCServer/Plugins/APIDump/Hooks/OnSpawnedEntity.lua b/MCServer/Plugins/APIDump/Hooks/OnSpawnedEntity.lua
deleted file mode 100644
index 037a90f1c..000000000
--- a/MCServer/Plugins/APIDump/Hooks/OnSpawnedEntity.lua
+++ /dev/null
@@ -1,31 +0,0 @@
-return
-{
- HOOK_SPAWNED_ENTITY =
- {
- CalledWhen = "After an entity is spawned in the world.",
- DefaultFnName = "OnSpawnedEntity", -- also used as pagename
- Desc = [[
- This hook is called after the server spawns an {{cEntity|entity}}. This is an information-only
- callback, the entity is already spawned by the time it is called. If the entity spawned is a
- {{cMonster|monster}}, the {{OnSpawnedMonster|HOOK_SPAWNED_MONSTER}} hook is called before this
- hook.</p>
- <p>
- See also the {{OnSpawningEntity|HOOK_SPAWNING_ENTITY}} hook for a similar hook called before the
- entity is spawned.
- ]],
- Params =
- {
- { Name = "World", Type = "{{cWorld}}", Notes = "The world in which the entity has spawned" },
- { Name = "Entity", Type = "{{cEntity}} descentant", Notes = "The entity that has spawned" },
- },
- Returns = [[
- If the function returns false or no value, the next plugin's callback is called. If the function
- returns true, no other callback is called for this event.
- ]],
- }, -- HOOK_SPAWNED_ENTITY
-}
-
-
-
-
-
diff --git a/MCServer/Plugins/APIDump/Hooks/OnSpawnedMonster.lua b/MCServer/Plugins/APIDump/Hooks/OnSpawnedMonster.lua
deleted file mode 100644
index c319a77ea..000000000
--- a/MCServer/Plugins/APIDump/Hooks/OnSpawnedMonster.lua
+++ /dev/null
@@ -1,30 +0,0 @@
-return
-{
- HOOK_SPAWNED_MONSTER =
- {
- CalledWhen = "After a monster is spawned in the world",
- DefaultFnName = "OnSpawnedMonster", -- also used as pagename
- Desc = [[
- This hook is called after the server spawns a {{cMonster|monster}}. This is an information-only
- callback, the monster is already spawned by the time it is called. After this hook is called, the
- {{OnSpawnedEntity|HOOK_SPAWNED_ENTITY}} is called for the monster entity.</p>
- <p>
- See also the {{OnSpawningMonster|HOOK_SPAWNING_MONSTER}} hook for a similar hook called before the
- monster is spawned.
- ]],
- Params =
- {
- { Name = "World", Type = "{{cWorld}}", Notes = "The world in which the monster has spawned" },
- { Name = "Monster", Type = "{{cMonster}} descendant", Notes = "The monster that has spawned" },
- },
- Returns = [[
- If the function returns false or no value, the next plugin's callback is called. If the function
- returns true, no other callback is called for this event.
- ]],
- }, -- HOOK_SPAWNED_MONSTER
-}
-
-
-
-
-
diff --git a/MCServer/Plugins/APIDump/Hooks/OnSpawningEntity.lua b/MCServer/Plugins/APIDump/Hooks/OnSpawningEntity.lua
deleted file mode 100644
index e2bd1c940..000000000
--- a/MCServer/Plugins/APIDump/Hooks/OnSpawningEntity.lua
+++ /dev/null
@@ -1,33 +0,0 @@
-return
-{
- HOOK_SPAWNING_ENTITY =
- {
- CalledWhen = "Before an entity is spawned in the world.",
- DefaultFnName = "OnSpawningEntity", -- also used as pagename
- Desc = [[
- This hook is called before the server spawns an {{cEntity|entity}}. The plugin can either modify the
- entity before it is spawned, or disable the spawning altogether. You can't disable the spawning if the
- entity is a player. If the entity spawning is a monster, the {{OnSpawningMonster|HOOK_SPAWNING_MONSTER}}
- hook is called before this hook.</p>
- <p>
- See also the {{OnSpawnedEntity|HOOK_SPAWNED_ENTITY}} hook for a similar hook called after the
- entity is spawned.
- ]],
- Params =
- {
- { Name = "World", Type = "{{cWorld}}", Notes = "The world in which the entity will spawn" },
- { Name = "Entity", Type = "{{cEntity}} descentant", Notes = "The entity that will spawn" },
- },
- Returns = [[
- If the function returns false or no value, the next plugin's callback is called. Finally, the server
- spawns the entity with whatever parameters have been set on the {{cEntity}} object by the callbacks.
- If the function returns true, no other callback is called for this event and the entity is not
- spawned.
- ]],
- }, -- HOOK_SPAWNING_ENTITY
-}
-
-
-
-
-
diff --git a/MCServer/Plugins/APIDump/Hooks/OnSpawningMonster.lua b/MCServer/Plugins/APIDump/Hooks/OnSpawningMonster.lua
deleted file mode 100644
index 4c0519e27..000000000
--- a/MCServer/Plugins/APIDump/Hooks/OnSpawningMonster.lua
+++ /dev/null
@@ -1,33 +0,0 @@
-return
-{
- HOOK_SPAWNING_MONSTER =
- {
- CalledWhen = "Before a monster is spawned in the world.",
- DefaultFnName = "OnSpawningMonster", -- also used as pagename
- Desc = [[
- This hook is called before the server spawns a {{cMonster|monster}}. The plugins may modify the
- monster's parameters in the {{cMonster}} class, or disallow the spawning altogether. This hook is
- called before the {{OnSpawningEntity|HOOK_SPAWNING_ENTITY}} is called for the monster entity.</p>
- <p>
- See also the {{OnSpawnedMonster|HOOK_SPAWNED_MONSTER}} hook for a similar hook called after the
- monster is spawned.
- ]],
- Params =
- {
- { Name = "World", Type = "{{cWorld}}", Notes = "The world in which the entity will spawn" },
- { Name = "Monster", Type = "{{cMonster}} descentant", Notes = "The monster that will spawn" },
- },
- Returns = [[
- If the function returns false or no value, the next plugin's callback is called. Finally, the server
- spawns the monster with whatever parameters the plugins set in the cMonster parameter.</p>
- <p>
- If the function returns true, no other callback is called for this event and the monster won't
- spawn.
- ]],
- }, -- HOOK_SPAWNING_MONSTER
-}
-
-
-
-
-
diff --git a/MCServer/Plugins/APIDump/Hooks/OnTakeDamage.lua b/MCServer/Plugins/APIDump/Hooks/OnTakeDamage.lua
deleted file mode 100644
index 608126f2b..000000000
--- a/MCServer/Plugins/APIDump/Hooks/OnTakeDamage.lua
+++ /dev/null
@@ -1,31 +0,0 @@
-return
-{
- HOOK_TAKE_DAMAGE =
- {
- CalledWhen = "An {{cEntity|entity}} is taking any kind of damage",
- DefaultFnName = "OnTakeDamage", -- also used as pagename
- Desc = [[
- This hook is called when any {{cEntity}} descendant, such as a {{cPlayer|player}} or a
- {{cMonster|mob}}, takes any kind of damage. The plugins may modify the amount of damage or effects
- with this hook by editting the {{TakeDamageInfo}} object passed.</p>
- <p>
- This hook is called after the final damage is calculated, including all the possible weapon
- {{cEnchantments|enchantments}}, armor protection and potion effects.
- ]],
- Params =
- {
- { Name = "Receiver", Type = "{{cEntity}} descendant", Notes = "The entity taking damage" },
- { Name = "TDI", Type = "{{TakeDamageInfo}}", Notes = "The damage type, cause and effects. Plugins may modify this object to alter the final damage applied." },
- },
- Returns = [[
- If the function returns false or no value, other plugins' callbacks are called and then the server
- applies the final values from the TDI object to Receiver. If the function returns true, no other
- callbacks are called, and no damage nor effects are applied.
- ]],
- }, -- HOOK_TAKE_DAMAGE
-}
-
-
-
-
-
diff --git a/MCServer/Plugins/APIDump/Hooks/OnTick.lua b/MCServer/Plugins/APIDump/Hooks/OnTick.lua
deleted file mode 100644
index d8c329253..000000000
--- a/MCServer/Plugins/APIDump/Hooks/OnTick.lua
+++ /dev/null
@@ -1,29 +0,0 @@
-return
-{
- HOOK_TICK =
- {
- CalledWhen = "Every server tick (approximately 20 times per second)",
- DefaultFnName = "OnTick", -- also used as pagename
- Desc = [[
- This hook is called every game tick (50 msec, or 20 times a second). If the server is overloaded,
- the interval is larger, which is indicated by the TimeDelta parameter.</p>
- <p>
- This hook is called in the context of the server-tick thread, that is, the thread that takes care of
- {{cClientHandle|client connections}} before they're assigned to {{cPlayer|player entities}}, and
- processing console commands.
- ]],
- Params =
- {
- { Name = "TimeDelta", Type = "number", Notes = "The number of milliseconds elapsed since the last server tick. Will not be less than 50 msec." },
- },
- Returns = [[
- If the function returns false or no value, other plugins' callbacks are called. If the function
- returns true, no other callbacks are called. There is no overridable behavior.
- ]],
- }, -- HOOK_TICK
-}
-
-
-
-
-
diff --git a/MCServer/Plugins/APIDump/Hooks/OnUpdatedSign.lua b/MCServer/Plugins/APIDump/Hooks/OnUpdatedSign.lua
deleted file mode 100644
index 937e6b981..000000000
--- a/MCServer/Plugins/APIDump/Hooks/OnUpdatedSign.lua
+++ /dev/null
@@ -1,38 +0,0 @@
-return
-{
- HOOK_UPDATED_SIGN =
- {
- CalledWhen = "After the sign text is updated. Notification only.",
- DefaultFnName = "OnUpdatedSign", -- also used as pagename
- Desc = [[
- This hook is called after a sign has had its text updated. The text is already updated at this
- point.</p>
- <p>The update may have been caused either by a {{cPlayer|player}} directly updating the sign, or by
- a plugin changing the sign text using the API.</p>
- <p>
- See also the {{OnUpdatingSign|HOOK_UPDATING_SIGN}} hook for a similar hook called before the update,
- with a chance to modify the text.
- ]],
- Params =
- {
- { Name = "World", Type = "{{cWorld}}", Notes = "The world in which the sign resides" },
- { Name = "BlockX", Type = "number", Notes = "X-coord of the sign" },
- { Name = "BlockY", Type = "number", Notes = "Y-coord of the sign" },
- { Name = "BlockZ", Type = "number", Notes = "Z-coord of the sign" },
- { Name = "Line1", Type = "string", Notes = "1st line of the new text" },
- { Name = "Line2", Type = "string", Notes = "2nd line of the new text" },
- { Name = "Line3", Type = "string", Notes = "3rd line of the new text" },
- { Name = "Line4", Type = "string", Notes = "4th line of the new text" },
- { Name = "Player", Type = "{{cPlayer}}", Notes = "The player who is changing the text. May be nil for non-player updates." }
- },
- Returns = [[
- If the function returns false or no value, other plugins' callbacks are called. If the function
- returns true, no other callbacks are called. There is no overridable behavior.
- ]],
- }, -- HOOK_UPDATED_SIGN
-}
-
-
-
-
-
diff --git a/MCServer/Plugins/APIDump/Hooks/OnUpdatingSign.lua b/MCServer/Plugins/APIDump/Hooks/OnUpdatingSign.lua
deleted file mode 100644
index d74458182..000000000
--- a/MCServer/Plugins/APIDump/Hooks/OnUpdatingSign.lua
+++ /dev/null
@@ -1,58 +0,0 @@
-return
-{
- HOOK_UPDATING_SIGN =
- {
- CalledWhen = "Before the sign text is updated. Plugin may modify the text / refuse.",
- DefaultFnName = "OnUpdatingSign", -- also used as pagename
- Desc = [[
- This hook is called when a sign text is about to be updated, either as a result of player's
- manipulation or any other event, such as a plugin setting the sign text. Plugins may modify the text
- or refuse the update altogether.</p>
- <p>
- See also the {{OnUpdatedSign|HOOK_UPDATED_SIGN}} hook for a similar hook called after the update.
- ]],
- Params =
- {
- { Name = "World", Type = "{{cWorld}}", Notes = "The world in which the sign resides" },
- { Name = "BlockX", Type = "number", Notes = "X-coord of the sign" },
- { Name = "BlockY", Type = "number", Notes = "Y-coord of the sign" },
- { Name = "BlockZ", Type = "number", Notes = "Z-coord of the sign" },
- { Name = "Line1", Type = "string", Notes = "1st line of the new text" },
- { Name = "Line2", Type = "string", Notes = "2nd line of the new text" },
- { Name = "Line3", Type = "string", Notes = "3rd line of the new text" },
- { Name = "Line4", Type = "string", Notes = "4th line of the new text" },
- { Name = "Player", Type = "{{cPlayer}}", Notes = "The player who is changing the text. May be nil for non-player updates." }
- },
- Returns = [[
- The function may return up to five values. If the function returns true as the first value, no other
- callbacks are called for this event and the sign is not updated. If the function returns no value or
- false as its first value, other plugins' callbacks are called.</p>
- <p>
- The other up to four values returned are used to update the sign text, line by line, respectively.
- Note that other plugins may again update the texts (if the first value returned is false).
- ]],
- CodeExamples =
- {
- {
- Title = "Add player signature",
- Desc = "The following example appends a player signature to the last line, if the sign is updated by a player:",
- Code = [[
-function OnUpdatingSign(World, BlockX, BlockY, BlockZ, Line1, Line2, Line3, Line4, Player)
- if (Player == nil) then
- -- Not changed by a player
- return false;
- end
-
- -- Sign with playername, allow other plugins to interfere:
- return false, Line1, Line2, Line3, Line4 .. Player:GetName();
-end
- ]],
- }
- } ,
- }, -- HOOK_UPDATING_SIGN
-}
-
-
-
-
-
diff --git a/MCServer/Plugins/APIDump/Hooks/OnWeatherChanged.lua b/MCServer/Plugins/APIDump/Hooks/OnWeatherChanged.lua
deleted file mode 100644
index 2a3bbe92b..000000000
--- a/MCServer/Plugins/APIDump/Hooks/OnWeatherChanged.lua
+++ /dev/null
@@ -1,28 +0,0 @@
-return
-{
- HOOK_WEATHER_CHANGED =
- {
- CalledWhen = "The weather has changed",
- DefaultFnName = "OnWeatherChanged", -- also used as pagename
- Desc = [[
- This hook is called after the weather has changed in a {{cWorld|world}}. The new weather has already
- been sent to the clients.</p>
- <p>
- See also the {{OnWeatherChanging|HOOK_WEATHER_CHANGING}} hook for a similar hook called before the
- change.
- ]],
- Params =
- {
- { Name = "World", Type = "{{cWorld}}", Notes = "World for which the weather has changed" },
- },
- Returns = [[
- If the function returns false or no value, the next plugin's callback is called. If the function
- returns true, no other callback is called for this event. There is no overridable behavior.
- ]],
- }, -- HOOK_WEATHER_CHANGED
-}
-
-
-
-
-
diff --git a/MCServer/Plugins/APIDump/Hooks/OnWeatherChanging.lua b/MCServer/Plugins/APIDump/Hooks/OnWeatherChanging.lua
deleted file mode 100644
index bb809af11..000000000
--- a/MCServer/Plugins/APIDump/Hooks/OnWeatherChanging.lua
+++ /dev/null
@@ -1,35 +0,0 @@
-return
-{
- HOOK_WEATHER_CHANGING =
- {
- CalledWhen = "The weather is about to change",
- DefaultFnName = "OnWeatherChanging", -- also used as pagename
- Desc = [[
- This hook is called when the current weather has expired and a new weather is selected. Plugins may
- override the new weather being set.</p>
- <p>
- The new weather setting is sent to the clients only after this hook has been processed.</p>
- <p>
- See also the {{OnWeatherChanged|HOOK_WEATHER_CHANGED}} hook for a similar hook called after the
- change.
- ]],
- Params =
- {
- { Name = "World", Type = "{{cWorld}}", Notes = "World for which the weather is changing" },
- { Name = "Weather", Type = "number", Notes = "The newly selected weather. One of wSunny, wRain, wStorm" },
- },
- Returns = [[
- The hook handler can return up to two values. If the first value is false or not present, the server
- calls other plugins' callbacks and finally sets the weather. If it is true, the server doesn't call any
- more callbacks for this hook. The second value returned is used as the new weather. If no value is
- given, the weather from the parameters is used as the weather. Returning false as the first value and a
- specific weather constant as the second value makes the server call the rest of the hook handlers with
- the new weather value.
- ]],
- }, -- HOOK_WEATHER_CHANGING
-}
-
-
-
-
-
diff --git a/MCServer/Plugins/APIDump/Hooks/OnWorldStarted.lua b/MCServer/Plugins/APIDump/Hooks/OnWorldStarted.lua
deleted file mode 100644
index 61e3de86e..000000000
--- a/MCServer/Plugins/APIDump/Hooks/OnWorldStarted.lua
+++ /dev/null
@@ -1,24 +0,0 @@
-return
-{
- HOOK_WORLD_STARTED =
- {
- CalledWhen = "A {{cWorld|world}} is initialized",
- DefaultFnName = "OnWorldStarted", -- also used as pagename
- Desc = [[
- This hook is called whenever a {{cWorld|world}} is initialized.
- ]],
- Params =
- {
- { Name = "World", Type = "{{cWorld}}", Notes = "World that is started" },
- },
- Returns = [[
- If the function returns false or no value, the next plugin's callback is called. If the function
- returns true, no other callback is called for this event. There is no overridable behavior.
- ]],
- }, -- HOOK_WORLD_STARTED
-}
-
-
-
-
-
diff --git a/MCServer/Plugins/APIDump/Hooks/OnWorldTick.lua b/MCServer/Plugins/APIDump/Hooks/OnWorldTick.lua
deleted file mode 100644
index 657716d9e..000000000
--- a/MCServer/Plugins/APIDump/Hooks/OnWorldTick.lua
+++ /dev/null
@@ -1,29 +0,0 @@
-return
-{
- HOOK_WORLD_TICK =
- {
- CalledWhen = "Every world tick (about 20 times per second), separately for each world",
- DefaultFnName = "OnWorldTick", -- also used as pagename
- Desc = [[
- This hook is called for each {{cWorld|world}} every tick (50 msec, or 20 times a second). If the
- world is overloaded, the interval is larger, which is indicated by the TimeDelta parameter.</p>
- <p>
- This hook is called in the world's tick thread context and thus has access to all world data
- guaranteed without blocking.
- ]],
- Params =
- {
- { Name = "World", Type = "{{cWorld}}", Notes = "World that is ticking" },
- { Name = "TimeDelta", Type = "number", Notes = "The number of milliseconds since the previous game tick. Will not be less than 50 msec" },
- },
- Returns = [[
- If the function returns false or no value, the next plugin's callback is called. If the function
- returns true, no other callback is called for this event. There is no overridable behavior.
- ]],
- }, -- HOOK_WORLD_TICK
-}
-
-
-
-
-
diff --git a/MCServer/Plugins/APIDump/InfoFile.html b/MCServer/Plugins/APIDump/InfoFile.html
deleted file mode 100644
index 99910f5ae..000000000
--- a/MCServer/Plugins/APIDump/InfoFile.html
+++ /dev/null
@@ -1,246 +0,0 @@
-<!DOCTYPE html>
-<html>
- <head>
- <title>Cuberite - Info.lua file</title>
- <link rel="stylesheet" type="text/css" href="main.css" />
- <link rel="stylesheet" type="text/css" href="prettify.css" />
- <script src="prettify.js"></script>
- <script src="lang-lua.js"></script>
- <meta charset="UTF-8">
- </head>
- <body>
- <div id="content">
- <h1>Info.lua file</h1>
- <h2>Contents</h2>
- <ul>
- <li><a href="#Introduction">Introduction</a></li>
- <li><a href="#Overall">The overall structure</a></li>
- <li><a href="#AdditionalInfo">AdditionalInfo table</a></li>
- <li><a href="#Commands">Commands table</a></li>
- <li><a href="#ConsoleCommands">ConsoleCommands table</a></li>
- <li><a href="#Permissions">Permissions table</a></li>
- <li><a href="#Using">Using the file in code</a></li>
- <li><a href="#Examples">Examples</a></li>
- </ul>
-
-
- <hr />
- <a name="Introduction"><h2>Introduction</h2></a>
-
- <p>For a long time Cuberite plugins were plagued by poor documentation. The plugins worked, people who wrote them knew how to use them, but for anyone new to the plugin it was a terrible ordeal learning how to use it. Most of the times, the plugin authors only wrote what commands the plugin supported, sometimes not even that. Then, there was a call to action to put an end to this, to make documenting the plugins easy and at the same time centralized. Thus, the Info.lua file was born.</p>
-
- <p>Most plugins have some parts that are the same across all the plugins. These are commands, console commands and their permissions. If a plugin implemented a command, it would practically copy &amp; paste the same code over and over again. So it makes sense to extract only unique information, centralize it and automate all the parts around it. This was another reason for the Info.lua file - it is a central hub of commands, console commands and their permissions.</p>
-
- <p>Last, but not least, we want to make a plugin repository on the web in the future, a repository that would store plugins, their descriptions, comments. It makes sense that the centralized information can be parsed by the repository automatically, so that advanced things, such as searching for a plugin based on a command, or determining whether two plugins collide command-wise, are possible.</p>
-
- <p>After this file format has been devised, a tool has been written that allows for an easy generation of the documentation for the plugin in various formats. It outputs the documentation in a format that is perfect for pasting into the forum. It generates documentation in a Markup format to use in README.md on GitHub and similar sites. The clever thing is that you don't need to keep all those formats in sync manually - you edit the Info.lua file and this tool will re-generate the documentation for you.</p>
-
- <p>So to sum up, the Info.lua file contains the plugins' commands, console commands, their permissions and possibly the overall plugin documentation, in a structured manner that can be parsed by a program, yet is human readable and editable.</p>
-
-
- <hr />
- <a name="Overall"><h2>The overall structure</h2></a>
-
- <p>The file consist of a declaration of a single Lua table, g_PluginInfo. This table contains all the information, structured, as its members. Each member can be a structure by itself. The entire file is a valid Lua source file, so any tool that syntax-checks Lua source can syntax-check this file. The file is somewhat forward- and backward- compatible, in the sense that it can be extended in any way without breaking.</p>
- <p>Here's a skeleton of the file:</p>
-<pre class="prettyprint lang-lua">
-g_PluginInfo =
-{
- Name = "Example Plugin",
- Date = "2014-06-12",
- Description = "This is an example plugin that shows how to use the Info.lua file",
-
- -- The following members will be documented in greater detail later:
- AdditionalInfo = {},
- Commands = {},
- ConsoleCommands = {},
- Permissions = {},
-}
-</pre>
- <p>As you can see, the structure is pretty straightforward. Note that the order of the elements inside the table is not important (Lua property).</p>
-
- <p>The first few elements are for book-keeping. They declare the plugin's name, the date in ISO-format, representing the version of the plugin, and the description. The idea is that the description sums up what the plugin is all about, within some two or three sentences.</p>
-
-
- <hr />
- <a name="AdditionalInfo"><h2>AdditionalInfo table</h2></a>
-
- <p>This table is used for more detailed description of the plugin. If there is any non-trivial setup process, dependencies, describe them here. This is where the description should get detailed. Don't worry about using several paragraphs of text here, if it makes the plugin easier to understand.</p>
-
- <p>The table should have the following layout:</p>
-<pre class="prettyprint lang-lua">
-AdditionalInfo =
-{
- {
- Title = "Chapter 1",
- Contents = "Describe one big aspect of the plugin here",
- },
- {
- Title = "Chapter 2",
- Contents = "Describe another big topic",
- },
-}
-</pre>
- <p>The idea here is that the tool that is used to generate the documentation from the Info.lua file will create a linkified table of contents and then each of the information elements' contents. This information should be all that is needed to successfully configure, run and manage the plugin.</p>
-
-
- <hr />
- <a name="Commands"><h2>Commands table</h2></a>
-
- <p>The commands table lists all the commands that the plugin implements, together with their handler functions, required permissions, help strings and further information. The table supports recursion, which allows plugins to create multi-word commands easily (such as "//schematic load" and "//schematic save"), each having its own separate handler.</p>
-
- <p>The table uses structure similar to the following:</p>
-<pre class="prettyprint lang-lua">
-Commands =
-{
- ["/cmd1"] =
- {
- HelpString = "Performs the first action",
- Permission = "firstplugin.cmds.1",
- Alias = "/c1",
- Handler = HandleCmd1,
- ParameterCombinations =
- {
- {
- Params = "x y z",
- Help = "Performs the first action at the specified coordinates",
- },
- {
- Params = "-p",
- Help = "Performs the first action at the player's coordinates",
- }
- },
- },
- ["/cmd2"] =
- {
- Alias = {"/c2", "//c2" },
- Subcommands =
- {
- sub1 = -- This declares a "/cmd2 sub1" command
- {
- HelpString = "Performs the second action's first subcommand",
- Permission = "firstplugin.cmds.2.1",
- Alias = "1",
- Handler = HandleCmd2Sub1,
- ParameterCombinations =
- {
- {
- Params = "x y z",
- Help = "Performs the second action's first subcommand at the specified coordinates",
- },
- {
- Params = "-p",
- Help = "Performs the second action's first subcommand at the player's coordinates",
- }
- },
- },
- sub2 = -- Declares a "/cmd2 sub2" command
- {
- HelpString = "Performs the second action's second subcommand",
- Permission = "firstplugin.cmds.2.2",
- Handler = HandleCmd2Sub2,
- },
- },
- },
-}
-</pre>
-
- <p>Although it may seem overwhelming at first, there is a "method to this madness". Each element of the Commands table defines one command. Most commands start with a slash, so the special Lua syntax for table elements with non-standard names needs to be applied (<code>["/cmd1"] =</code>). The command can either specify subcommands, or a handler function (specifying both is UndefinedBehavior). Subcommands uses the same structure as the entire Commands table, recursively.</p>
-
- <p>The permission element specifies that the command is only available with the specified permission. Note that the permission for subcommand's parent isn't checked when the subcommand is called. This means that specifying the permission for a command that has subcommands has no effect whatsoever, but is discouraged because we may add processing for that in the future.</p>
-
- <p>The ParameterCombinations table is used only for generating the documentation, it lists the various combinations of parameters that the command supports. It's worth specifying even if the command supports only one combination, because that combination will get documented this way.</p>
-
- <p>The Alias member specifies any possible aliases for the command. Each alias is registered separately and if there is a subcommand table, it is applied to all aliases, just as one would expect. You can specify either a single string as the value (if there's only one alias), or a table of strings for multiple aliases. Commands with no aliases do not need to specify this member at all.</p>
-
-
- <hr />
- <a name="ConsoleCommands"><h2>ConsoleCommands table</h2>
-
- <p>This table serves a purpose similar to that of the Commands table, only these commands are provided for the server console. Therefore, there are no permissions specified for these commands. Since most console commands don't use a leading slash, the command names don't need the special syntax. Also, the handler function doesn't receive the Player parameter.</p>
-
- <p>Here's an example of a ConsoleCommands table:</p>
-<pre class="prettyprint lang-lua">
-ConsoleCommands =
-{
- concmd =
- {
- HelpString = "Performs the console action",
- Subcommands =
- {
- sub1 =
- {
- HelpString = "Performs the console action's first subcommand",
- Handler = HandleConCmdSub1,
- ParameterCombinations =
- {
- {
- Params = "x y z",
- Help = "Performs the console action's first subcommand at the specified coordinates",
- },
- },
- },
- sub2 =
- {
- HelpString = "Performs the console action's second subcommand",
- Handler = HandleConCmdSub2,
- },
- },
- },
-}
-</pre>
-
-
- <hr />
- <a name="Permissions"><h2>Permissions table</h2></a>
-
- <p>The purpose of this table is to document permissions that the plugin uses. The documentation generator automatically collects the permissions specified in the Command table; the Permissions table adds a description for these permissions and may declare other permissions that aren't specifically included in the Command table.</p>
-
-<pre class="prettyprint lang-lua">
-Permissions =
-{
- ["firstplugin.cmd.1.1"] =
- {
- Description = "Allows the players to build high towers using the first action.",
- RecommendedGroups = "players",
- },
- ["firstplugin.cmd.2.1"] =
- {
- Description = "Allows the players to kill entities using the second action. Note that this may be misused to kill other players, too.",
- RecommendedGroups = "admins, mods",
- },
-}
-</pre>
-
- <p>The RecommendedGroup element lists, in plain English, the intended groups for which the permission should be enabled on a typical server. Plugin authors are advised to create reasonable defaults, prefering security to openness, so that admins using these settings blindly don't expose their servers to malicious users.</p>
-
-
- <hr />
- <a name="Using"><h2>Using the file in code</h2></a>
-
- <p>Just writing the Info.lua file and saving it to the plugin folder is not enough for it to actually be used. Your plugin needs to include the following boilerplate code, preferably in its Initialize() function:</p>
-<pre class="prettyprint lang-lua">
--- Use the InfoReg shared library to process the Info.lua file:
-dofile(cPluginManager:GetPluginsPath() .. "/InfoReg.lua")
-RegisterPluginInfoCommands()
-RegisterPluginInfoConsoleCommands()
-</pre>
-
- <p>Of course, if your plugin doesn't have any console commands, it doesn't need to call the RegisterPluginInfoConsoleCommands() function, and similarly if it doesn't have any in-game commands, it doesn't need to call the RegisterPluginInfoCommands() function.</p>
-
-
- <hr />
- <a name="Examples"><h2>Examples</h2></a>
-
- <p>There are several plugins that already implement this approach. You can visit them for inspiration and to see what the generated documentation looks like:</p>
- <ul>
- <li>Gallery plugin: <a href="https://github.com/mc-server/Gallery/blob/master/Info.lua">Info.lua</a>, <a href="http://forum.mc-server.org/showthread.php?tid=1306">Forum</a> documentation</li>
- <li>WorldEdit plugin: <a href="https://github.com/mc-server/WorldEdit/blob/master/Info.lua">Info.lua</a>, <a href="http://forum.mc-server.org/showthread.php?tid=870">Forum</a> and <a href="https://github.com/mc-server/WorldEdit">MarkDown</a> documentation</li>
- </ul>
-
- <script>
- prettyPrint();
- </script>
- </div>
- </body>
-</html>
diff --git a/MCServer/Plugins/APIDump/LICENSE-prettify.txt b/MCServer/Plugins/APIDump/LICENSE-prettify.txt
deleted file mode 100644
index b7f86df20..000000000
--- a/MCServer/Plugins/APIDump/LICENSE-prettify.txt
+++ /dev/null
@@ -1,191 +0,0 @@
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- Copyright 2011 Mike Samuel et al
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
diff --git a/MCServer/Plugins/APIDump/SettingUpDecoda.html b/MCServer/Plugins/APIDump/SettingUpDecoda.html
deleted file mode 100644
index 8a74f0240..000000000
--- a/MCServer/Plugins/APIDump/SettingUpDecoda.html
+++ /dev/null
@@ -1,49 +0,0 @@
-<!DOCTYPE html>
-
-<html>
- <head>
- <title>Cuberite - Setting up Decoda</title>
- <link rel="stylesheet" type="text/css" href="main.css" />
- <link rel="stylesheet" type="text/css" href="prettify.css" />
- <script src="prettify.js"></script>
- <script src="lang-lua.js"></script>
- <meta charset="UTF-8">
- </head>
- <body>
- <div id="content">
- <h1>Setting up the Decoda IDE</h1>
- <p>
- This article will explain how to set up Decoda, an IDE for writing Lua code, so that you can develop Cuberite plugins with the comfort of an IDE.</p>
-
- <h2><img src="Static/decoda_logo.png" /> About Decoda</h2>
-
- <p>To quickly introduce Decoda, it is an IDE for writing Lua code. It has the basic features expected of an IDE - you can group files into project, you can edit multiple files in a tabbed editor, the code is syntax-highlighted. Code completion, symbol browsing, and more. It also features a Lua debugger that allows you to debug your Lua code within any application that embeds the Lua runtime or uses Lua as a dynamic-link library (DLL). Although it is written using the multiplatform WxWidgets toolkit, it hasn't yet been ported to any platform other than 32-bit Windows. This unfortunately means that Linux users will not be able to use it. It can be used on 64-bit Windows, but the debugger only works for 32-bit programs.</p>
- <p>Here's a screenshot of a default Decoda window with the debugger stepping through the code (scaled down):<br />
- <img src="Static/decoda_workspace.png" /></p>
- <p>As you can see, you can set breakpoints in the code, inspect variables' values, view both the Lua and native (C++) call-stacks. Decoda also breaks program execution when a faulty Lua script is executed, providing a detailed error message and pointing you directly to the faulting code. It is even possible to attach a C++ debugger to a process that is being debugged by Decoda, this way you can trap both C++ and Lua errors.</p>
- <p>Decoda is open-source, the sources are on GitHub: <a href="https://github.com/unknownworlds/decoda">https://github.com/unknownworlds/decoda</a>. You can download a compiled binary from the creators' site, <a href="http://unknownworlds.com/decoda/">http://unknownworlds.com/decoda/</a>.
-
- <h2><img src="Static/decoda_logo.png" /> Project management</h2>
- <p>To begin using Decoda, you need to create a project, or load an existing one. Decoda projects have a .deproj extension, and are simply a list of Lua files that are to be opened. You can create a project through menu Project -> New Project. Save your project first, so that Decoda knows what relative paths to use for the files. Then either add existing Lua files or create new one, through menu Project -> Add Add New File / Add Existing File.</p>
- <p>Next you need to set up the executable that Decoda will run when debugging your files. Select menu Project -> Settings. A new dialog will open:<br />
- <img src="Static/decoda_debug_settings.png" /></p>
- <p>In the debugging section, fill in the full path to Cuberite.exe, or click the triple-dot button to browse for the file. Note that the Working directory will be automatically filled in for you with the folder where the executable is (until the last backslash). This is how it's supposed to work, don't change it; if it for some reason doesn't update, copy and paste the folder name from the Command edit box. All done, you can close this dialog now.</p>
-
- <h2><img src="Static/decoda_logo.png" /> Debugging</h2>
- <p>You are now ready to debug your code. Before doing that, though, don't forget to save your project file. If you haven't done so already, enable your plugin in the settings.ini file. If you want the program to break at a certain line, it is best to set the breakpoint before starting the program. Set the cursor on the line and hit F9 (or use menu Debug -> Toggle Breakpoint) to toggle a breakpoint on that line. Finally, hit F5, or select menu Debug -> Start to launch Cuberite under the debugger. The Cuberite window comes up and loads your plugin. If Decoda displays the Project Settings dialog instead, you haven't set up the executable to run, see the Project management section for instructions.</p>
- <p>At this point you will see that Decoda starts adding new items to your project. All the files for all plugins are added temporarily. Don't worry, they are only temporary, they will be removed again once the debugging session finishes. You can tell the temporary files from the regular files by their icon, it's faded out. Decoda handles all the files that Cuberite loads, so you can actually debug any of those faded files, too.</p>
- <p>If there's an error in the code, the Decoda window will flash and a dialog box will come up, describing the error and taking you to the line where it occured. Note that the execution is paused in the thread executing the plugin, so until you select Debug -> Continue from the menu (F5), Cuberite won't be fully running. You can fix the error and issue a "reload" command in Cuberite console to reload the plugin code anew (Cuberite doesn't detect changes in plugin code automatically).</p>
- <p>If the execution hits a breakpoint, the Decoda window will flash and a yellow arrow is displayed next to the line. You can step through the code using F10 and F11, just like in MSVS. You can also use the Watch window to inspect variable values, or simply hover your mouse over a variable to display its value in the tooltip.</p>
-
- <h2><img src="Static/decoda_logo.png" /> Limitations</h2>
- <p>So far everything seems wonderful. Unfortunately, it doesn't always go as easy. There are several limits to what Decoda can do:</p>
- <ul>
- <li>When the program encounters a logical bug (using a nil value, calling a non-existent function etc.), Decoda will break, but usually the Watch window and the tooltips are showing nonsense values. You shouldn't trust them in such a case, if you kep running into such a problem regularly, put console logging functions (LOG) in the code to print out any info you need prior to the failure.</li>
- <li>Sometimes breakpoints just don't work. This is especially true if there are multiple plugins that have files of the same name. Breakpoints will never work after changing the code and reloading the plugin in Cuberite; you need to stop the server and start again to reenable breakpoints.</li>
- <li>Most weirdly, sometimes Decoda reports an error, but instead of opening the current version of the file, opens up another window with old contents of the file. Watch for this, because you could overwrite your new code if you saved this file over your newer file. Fortunately enough, Decoda will always ask you for a filename before saving such a file.</li>
- <li>Decoda stores the project in two files. The .deproj file has the file list, and should be put into version control systems. The .deuser file has the settings (debugged application etc.) and is per-user specific. This file shouldn't go to version control systems, because each user may have different paths for the debuggee.</li>
- <li>Unfortunately for us Windows users, the Decoda project file uses Unix-lineends (CR only). This makes it problematic when checking the file into a version control system, since those usually expect windows (CRLF) lineends; I personally convert the lineends each time I edit the project file using <a href="http://jsimlo.sk/notepad/">TED Notepad</a>.</li>
- </ul>
- </div>
- </body>
-</html>
diff --git a/MCServer/Plugins/APIDump/SettingUpZeroBrane.html b/MCServer/Plugins/APIDump/SettingUpZeroBrane.html
deleted file mode 100644
index d2f5bb483..000000000
--- a/MCServer/Plugins/APIDump/SettingUpZeroBrane.html
+++ /dev/null
@@ -1,46 +0,0 @@
-<!DOCTYPE html>
-
-<html>
- <head>
- <title>Cuberite - Setting up ZeroBrane Studio</title>
- <link rel="stylesheet" type="text/css" href="main.css" />
- <link rel="stylesheet" type="text/css" href="prettify.css" />
- <script src="prettify.js"></script>
- <script src="lang-lua.js"></script>
- <meta charset="UTF-8">
- </head>
- <body>
- <div id="content">
- <h1>Setting up the ZeroBrane Studio IDE</h1>
- <p>
- This article will explain how to set up ZeroBrane Studio, an IDE for writing Lua code, so that you can develop Cuberite plugins with the comfort of an IDE.</p>
-
- <h2><img src="Static/zbs_logo.png" /> About ZeroBrane Studio</h2>
-
- <p>To quickly introduce ZeroBrane Studio, it is an IDE for writing Lua code. It has the basic features expected of an IDE - it allows you to manage groups of files as a project, you can edit multiple files in a tabbed editor, the code is syntax-highlighted. Code completion, symbol browsing, and more. It also features a Lua debugger that allows you to debug your Lua code within any application that uses Lua and can load Lua packages. It is written using the multiplatform WxWidgets toolkit, and runs on multiple platforms, including Windows, Linux and MacOS.</p>
- <p>Here's a screenshot of a default ZBS window with the debugger stepping through the code (scaled down):<br />
- <img src="Static/zbs_workspace.png" /></p>
- <p>As you can see, you can set breakpoints in the code, inspect variables' values, view the Lua call-stacks.</p>
- <p>ZBS is open-source, the sources are on GitHub: <a href="https://github.com/pkulchenko/ZeroBraneStudio">https://github.com/pkulchenko/ZeroBraneStudio</a>. The project's homepage is at <a href="http://studio.zerobrane.com/">http://studio.zerobrane.com/</a>.
-
- <h2><img src="Static/zbs_logo.png" /> First-time setup</h2>
- <p>Since ZBS is a universal Lua IDE, you need to first set it up so that it is ready for Cuberite plugin development. For that, you need to download one file, <a href="https://raw.githubusercontent.com/pkulchenko/ZeroBranePackage/master/mcserver.lua">mcserver.lua</a> from the <a href="https://github.com/pkulchenko/ZeroBranePackage">ZBS's plugin repository</a>. Place that file in the "packages" folder inside your ZBS's folder. Note that there are other useful plugins in the repository and you may want to have a look there later on to further customize your ZBS. To install them, simply save them into the same folder.</p>
- <p>Next you should install the code-completion support specific for Cuberite. You should repeat this step from time to time, because the API evolves in time so new functions and classes are added to it quite often. You should have an APIDump plugin in your Cuberite installation. Enable the APIDump plugin in the server settings, it's very cheap to keep it enabled and it doesn't cost any performance during normal gameplay. To generate the code-completion support file, enter the <code style="background: #ddd; border: 1px solid #aaa">api</code> command into the server console. This will create a new file, "mcserver_api.lua", next to the Cuberite executable. Move that file into the "api/lua" subfolder inside your ZBS's folder.</p>
- <p>After you download the mcserver.lua file and install the completion support, you need to restart ZBS in order for the plugin to load. If there are no errors, you should see two new items in the Project -> Lua Interpreter submenu: "Cuberite - debug mode" and "Cuberite - release mode". The only difference between the two is which filename they use to launch Cuberite - mcserver_debug(.exe) for the debug option and "mcserver(.exe)" for the release option. If you built your own Cuberite executable and you built it in debug mode, you should select the debug mode option. In all other cases, including if you downloaded the already-compiled Cuberite executable from the internet, you should select the release mode option.</p>
- <p>For a first time user, it might be a bit overwhelming that there are no GUI settings in the ZBS, yet the IDE is very configurable. There are two files that you edit in order to change settings, either system-wide (all users of the computer share those settings) or user-wide (the settings are only for a specific user of the computer). Those files are regular Lua sources and you can quickly locate them and edit them from within the IDE itself, select Edit -> Preferences -> Settings: XYZ from the menu, with XYZ being either System or User.</p>
- <p>There is a documentation on most of the settings on ZBS's webpage, have a look at <a href="http://studio.zerobrane.com/documentation.html">http://studio.zerobrane.com/documentation.html</a>, especially the Preferences section. Personally I recommend setting editor.usetabs to true and possibly adjusting the editor.tabwidth, turn off the editor.smartindent feature and for debugging the option debugger.alloweditting should be set to true unless you feel like punishing yourself.</p>
-
- <h2><img src="Static/zbs_logo.png" /> Project management</h2>
- <p>ZBS works with projects, it considers all files and subfolder in a specific folder to be a project. There's no need for a special project file nor for adding individual files to the workspace, all files are added automatically. To open a Cuberite plugin as the project, click the triple-dot button in the Project pane, or select Project -> Project directory -> Choose... from the menu. Browse and select the Cuberite plugin's folder. ZBS will load all the files in the plugin's folder and you can start editting code.</p>
- <p>Note that although ZBS allows you to work with subfolders in your plugins (and you should, especially with larger plugins), the current Cuberite ZBS plugin will not be able to start debugging unless you have a file open in the editor that is at the root level of the Cuberite plugin's folder.</p>
-
- <h2><img src="Static/zbs_logo.png" /> Debugging</h2>
- <p>You are now ready to debug your code. Before doing that, though, don't forget to save your project files. If you haven't done so already, enable your plugin in the settings.ini file. If you want the program to break at a certain line, it is best to set the breakpoint before starting the program. Set the cursor on the line and hit F9 (or use menu Project -> Toggle Breakpoint) to toggle a breakpoint on that line. Finally, hit F5, or select menu Project -> Start Debugging to launch Cuberite under the debugger. The Cuberite window comes up and loads your plugin. If the window doesn't come up, inspect the Output pane in ZBS, there are usually two reasons for failure:<ul>
- <li>Your code in the currently open file has a hard syntax error. These are reported as "Compilation error" in the Output pane, double-click the line to go to the error</li>
- <li>ZBS cannot find the Cuberite executable. Make sure you are editting a file two levels down the folder hierarchy from the Cuberite executable and that the Cuberite executable is named properly (mcserver[.exe] or mcserver_debug[.exe]). Also make sure you have selected the right Interpreter (menu Project -> Lua Interpreter).</li>
- </ul></p>
- <p>Once running, if the execution hits a breakpoint, the ZBS window will come up and a green arrow is displayed next to the breakpoint line. You can step through the code using F10 (Step Into) and Shift+F10 (Step Over). You can also use the Watch window to inspect variable values, or simply hover your mouse over a variable to display its value in the tooltip. Use the Remote console pane to execute commands directly *inside* the Cuberite's plugin context.</p>
- <p>You can also use the Project -> Break menu item to break into the debugger as soon as possible. You can also set breakpoints while the Cuberite plugin is running. Note that due to the way in which the debugger is implemented, Cuberite may execute some more Lua code before the break / breakpoint comes into effect. If Cuberite is not executing any Lua code in your plugin, it will not break until the plugin code kicks in again. This may result in missed breakpoints and delays before the Break command becomes effective. Therefore it's best to set breakpoints before running the program, or while the program is waiting in another breakpoint.</p>
- </div>
- </body>
-</html>
diff --git a/MCServer/Plugins/APIDump/Static/.gitignore b/MCServer/Plugins/APIDump/Static/.gitignore
deleted file mode 100644
index 8d1c8b69c..000000000
--- a/MCServer/Plugins/APIDump/Static/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/MCServer/Plugins/APIDump/Static/decoda_debug_settings.png b/MCServer/Plugins/APIDump/Static/decoda_debug_settings.png
deleted file mode 100644
index 462d517b4..000000000
--- a/MCServer/Plugins/APIDump/Static/decoda_debug_settings.png
+++ /dev/null
Binary files differ
diff --git a/MCServer/Plugins/APIDump/Static/decoda_logo.png b/MCServer/Plugins/APIDump/Static/decoda_logo.png
deleted file mode 100644
index fb446b62c..000000000
--- a/MCServer/Plugins/APIDump/Static/decoda_logo.png
+++ /dev/null
Binary files differ
diff --git a/MCServer/Plugins/APIDump/Static/decoda_workspace.png b/MCServer/Plugins/APIDump/Static/decoda_workspace.png
deleted file mode 100644
index 7e626dae9..000000000
--- a/MCServer/Plugins/APIDump/Static/decoda_workspace.png
+++ /dev/null
Binary files differ
diff --git a/MCServer/Plugins/APIDump/Static/zbs_logo.png b/MCServer/Plugins/APIDump/Static/zbs_logo.png
deleted file mode 100644
index c8d6d6278..000000000
--- a/MCServer/Plugins/APIDump/Static/zbs_logo.png
+++ /dev/null
Binary files differ
diff --git a/MCServer/Plugins/APIDump/Static/zbs_workspace.png b/MCServer/Plugins/APIDump/Static/zbs_workspace.png
deleted file mode 100644
index 9ce17e35a..000000000
--- a/MCServer/Plugins/APIDump/Static/zbs_workspace.png
+++ /dev/null
Binary files differ
diff --git a/MCServer/Plugins/APIDump/UsingChunkStays.html b/MCServer/Plugins/APIDump/UsingChunkStays.html
deleted file mode 100644
index a7cb5302a..000000000
--- a/MCServer/Plugins/APIDump/UsingChunkStays.html
+++ /dev/null
@@ -1,167 +0,0 @@
-<!DOCTYPE html>
-<html>
- <head>
- <title>Cuberite - Using ChunkStays</title>
- <link rel="stylesheet" type="text/css" href="main.css" />
- <link rel="stylesheet" type="text/css" href="prettify.css" />
- <script src="prettify.js"></script>
- <script src="lang-lua.js"></script>
- <meta charset="UTF-8">
- </head>
- <body>
- <div id="content">
- <h1>Using ChunkStays</h1>
- <p>
- A plugin may need to manipulate data in arbitrary chunks, and it needs a way to make the server
- guarantee that the chunks are available in memory.</p>
-
- <h2>The problem</h2>
- <p>
- Usually when plugins want to manipulate larger areas of world data, they need to make sure that the
- server has the appropriate chunks loaded in the memory. When the data being manipulated can be further
- away from the connected players, or the data is being manipulated from a console handler, there is a
- real chance that the chunks are not loaded.</p>
- <p>
- This gets even more important when using the <a href="cBlockArea.html">cBlockArea</a> class for reading
- and writing. Those functions will fail when any of the required chunks aren't valid. This means that
- either the block area has incomplete data (Read() failed) or incomplete data has been written to the
- world (Write() failed). Recovery from this is near impossible - you can't simply read or write again
- later, because the world may have changed in the meantime.</p>
-
- <h2>The solution</h2>
- <p>
- The naive solution would be to monitor chunk loads and unloads, and postpone the operations until all
- the chunks are available. This would be quite ineffective and also very soon it would become very
- difficult to maintain, if there were multiple code paths requiring this handling.</p>
- <p>
- An alternate approach has been implemented, accessible through a single (somewhat hidden) function
- call: <a href="cWorld.html">cWorld:ChunkStay()</a>. All that this call basically does is, it tells the
- server "Load these chunks for me, and call this callback function once you have them all." And the
- server does exactly that - it remembers the callback and asks the world loader / generator to provide
- the chunks. Once the chunks become available, it calls the callback function for the plugin.</p>
- <p>
- There are a few gotcha-s, though. If the code that was requesting the read or write had access to some
- of the volatile objects, such as <a href="cPlayer.html">cPlayer</a> or
- <a href="cEntity.html">cEntity</a> objects, those cannot be accessed by the callback anymore, because
- they may have become invalid in the meantime - the player may have disconnected, the entity may have
- despawned. So the callback must use the longer way to access such objects, such as calling
- <a href="cWorld.html">cWorld:DoWithEntityByID()</a> or
- <a href="cWorld.html">cWorld:DoWithPlayer()</a>.</p>
-
- <h2>The example</h2>
- <p>
- As a simple example, consider a theoretical plugin that allows a player to save the immediate
- surroundings of the spawn into a schematic file. The player issues a command to initiate the save, and
- the plugin reads a 50 x 50 x 50 block area around the spawn into a cBlockArea and saves it on the disk
- as "<PlayerName>_spawn.schematic". When it's done with the saving, it wants to send a message to the
- player to let them know the command has succeeded.</p>
- <p>
- The first attempt shows the naive approach. It simply reads the block area and saves it, then sends the
- message. I'll repeat once more, this code is <b>the wrong way</b> to do it!</p>
-<pre class="prettyprint lang-lua">
-function HandleCommandSaveSpawn(a_Split, a_Player)
- -- Get the coords for the spawn:
- local SpawnX = a_Player:GetWorld():GetSpawnX()
- local SpawnY = a_Player:GetWorld():GetSpawnY()
- local SpawnZ = a_Player:GetWorld():GetSpawnZ()
- local Bounds = cCuboid(SpawnX - 25, SpawnY - 25, SpawnZ - 25, SpawnX + 25, SpawnY + 25, SpawnZ + 25)
- Bounds:ClampY(0, 255)
-
- -- Read the area around spawn into a cBlockArea, save to file:
- local Area = cBlockArea()
- local FileName = a_Player:GetName() .. "_spawn.schematic"
- Area:Read(a_Player:GetWorld(), Bounds, cBlockArea.baTypes + cBlockArea.baMetas)
- Area:SaveToSchematicFile(FileName)
-
- -- Notify the player:
- a_Player:SendMessage(cCompositeChat("The spawn has been saved", mtInfo))
- return true
-end
-</pre>
- <p>
- Now if the player goes exploring far and uses the command to save their spawn, the chunks aren't
- loaded, so the BlockArea reading fails, the BlockArea contains bad data. Note that the plugin fails to
- do any error checking and if the area isn't read from the world, it happily saves the incomplete data
- and says "hey, everything's right", althought it has just trashed any previous backup of the spawn
- schematic with nonsense data.</p>
- <hr/>
- <p>
- The following script uses the ChunkStay method to alleviate chunk-related problems. This is <b>the
- right way</b> of doing it:</p>
-<pre class="prettyprint lang-lua">
-function HandleCommandSaveSpawn(a_Split, a_Player)
- -- Get the coords for the spawn:
- local SpawnX = a_Player:GetWorld():GetSpawnX()
- local SpawnY = a_Player:GetWorld():GetSpawnY()
- local SpawnZ = a_Player:GetWorld():GetSpawnZ()
- local Bounds = cCuboid(SpawnX - 25, SpawnY - 25, SpawnZ - 25, SpawnX + 25, SpawnY + 25, SpawnZ + 25)
- Bounds:ClampY(0, 255)
-
- -- Get a list of chunks that we need loaded:
- local MinChunkX = math.floor((SpawnX - 25) / 16)
- local MaxChunkX = math.ceil ((SpawnX + 25) / 16)
- local MinChunkZ = math.floor((SpawnZ - 25) / 16)
- local MaxChunkZ = math.ceil ((SpawnZ + 25) / 16)
- local Chunks = {}
- for x = MinChunkX, MaxChunkX do
- for z = MinChunkZ, MaxChunkZ do
- table.insert(Chunks, {x, z})
- end
- end -- for x
-
- -- Store the player's name and world to use in the callback, because the a_Player object may no longer be valid:
- local PlayerName = a_Player:GetName()
- local World = a_Player:GetWorld()
-
- -- This is the callback that is executed once all the chunks are loaded:
- local OnAllChunksAvailable = function()
- -- Read the area around spawn into a cBlockArea, save to file:
- local Area = cBlockArea()
- local FileName = PlayerName .. "_spawn.schematic"
- if (Area:Read(World, Bounds, cBlockArea.baTypes + cBlockArea.baMetas)) then
- Area:SaveToSchematicFile(FileName)
- Msg = cCompositeChat("The spawn has been saved", mtInfo)
- else
- Msg = cCompositeChat("Cannot save the spawn", mtFailure)
- end
-
- -- Notify the player:
- -- Note that we cannot use a_Player here, because it may no longer be valid (if the player disconnected before the command completes)
- World:DoWithPlayer(PlayerName,
- function (a_CBPlayer)
- a_CBPlayer:SendMessage(Msg)
- end
- )
- end
-
- -- Ask the server to load our chunks and notify us once it's done:
- World:ChunkStay(Chunks, nil, OnAllChunksAvailable)
-
- -- Note that code here may get executed before the callback is called!
- -- The ChunkStay says "once you have the chunks", not "wait until you have the chunks"
- -- So you can't notify the player here, because the saving needn't have occurred yet.
-
- return true
-end
-</pre>
- <p>
- Note that this code does its error checking of the Area:Read() function, and it will not overwrite the
- previous file unless it actually has the correct data. If you're wondering how the reading could fail
- when we've got the chunks loaded, there's still the issue of free RAM - if the memory for the area
- cannot be allocated, it cannot be read even with all the chunks present. So we still do need that
- check.</p>
-
- <h2>The conclusion</h2>
- <p>
- Although it makes the code a little bit longer and is a bit more difficult to grasp at first, the
- ChunkStay is a useful technique to add to your repertoire. It is to be used whenever you need access to
- chunks that may potentially be inaccessible, and you really need the data.</p>
- <p>Possibly the biggest hurdle in using the ChunkStay is the fact that it does its work in the
- background, thus invalidating all cPlayer and cEntity objects your function may hold, so you need to
- re-acquire them from their IDs and names. This is the penalty for using multi-threaded code.</p>
- <script>
- prettyPrint();
- </script>
- </div>
- </body>
-</html>
diff --git a/MCServer/Plugins/APIDump/WebWorldThreads.html b/MCServer/Plugins/APIDump/WebWorldThreads.html
deleted file mode 100644
index b6c5c34ca..000000000
--- a/MCServer/Plugins/APIDump/WebWorldThreads.html
+++ /dev/null
@@ -1,72 +0,0 @@
-<!DOCTYPE html>
-<html>
- <head>
- <title>Cuberite - Webserver vs World threads</title>
- <link rel="stylesheet" type="text/css" href="main.css" />
- <link rel="stylesheet" type="text/css" href="prettify.css" />
- <script src="prettify.js"></script>
- <script src="lang-lua.js"></script>
- <meta charset="UTF-8">
- </head>
- <body>
- <div id="content">
- <h1>Webserver vs World threads</h1>
- <p>
- This article will explain the threading issues that arise between the webserver and world threads are of concern to plugin authors.</p>
- <p>
- Generally, plugins that provide webadmin pages should be quite careful about their interactions. Most operations on Cuberite objects requires synchronization, that Cuberite provides automatically and transparently to plugins - when a block is written, the chunkmap is locked, or when an entity is being manipulated, the entity list is locked. Each plugin also has a mutex lock, so that only one thread at a time may be executing plugin code.</p>
- <p>
- This locking can be a source of deadlocks for plugins that are not written carefully.</p>
-
- <h2>Example scenario</h2>
- <p>Consider the following example. A plugin provides a webadmin page that allows the admin to kick players off the server. When the admin presses the "Kick" button, the plugin calls cWorld:DoWithPlayer() with a callback to kick the player. Everything seems to be working fine now.</p>
- <p>
- A new feature is developed in the plugin, now the plugin adds a new in-game command so that the admins can kick players while they're playing the game. The plugin registers a command callback with cPluginManager.AddCommand(). Now there are problems bound to happen.</p>
- <p>
- Suppose that two admins are in, one is using the webadmin and the other is in-game. Both try to kick a player at the same time. The webadmin locks the plugin, so that it can execute the plugin code, but right at this moment the OS switches threads. The world thread locks the world so that it can access the list of in-game commands, receives the in-game command, it tries to lock the plugin. The plugin is already locked, so the world thread is put on hold. After a while, the webadmin thread is woken up again and continues processing. It tries to lock the world so that it can traverse the playerlist, but the lock is already held by the world thread. Now both threads are holding one lock each and trying to grab the other lock, and are therefore deadlocked.</p>
-
- <h2>How to avoid the deadlock</h2>
- <p>
- There are two main ways to avoid such a deadlock. The first approach is using tasks: Everytime you need to execute a task inside a world, instead of executing it, queue it, using <a href="cWorld.html">cWorld</a>:QueueTask(). This handy utility can will call the given function inside the world's TickThread, thus eliminating the deadlock, because now there's only one thread. However, this approach will not let you get data back. You cannot query the player list, or the entities, or anything - because when the task runs, the webadmin page has already been served to the browser.</p>
- <p>
- To accommodate this, you'll need to use the second approach - preparing and caching data in the tick thread, possibly using callbacks. This means that the plugin will have global variables that will store the data, and update those variables when the data changes; then the webserver thread will only read those variables, instead of calling the world functions. For example, if a webpage was to display the list of currently connected players, the plugin should maintain a global variable, g_WorldPlayers, which would be a table of worlds, each item being a list of currently connected players. The webadmin handler would read this variable and create the page from it; the plugin would use HOOK_PLAYER_JOINED and HOOK_DISCONNECT to update the variable.</p>
-
- <h2>What to avoid</h2>
- <p>
- Now that we know what the danger is and how to avoid it, how do we know if our code is susceptible?</p>
- <p>
- The general rule of thumb is to avoid calling any functions that read or write lists of things in the webserver thread. This means most ForEach() and DoWith() functions. Only <a href="cRoot.html">cRoot</a>:ForEachWorld() is safe - because the list of worlds is not expected to change, so it is not guarded by a mutex. Getting and setting world's blocks is, naturally, unsafe, as is calling other plugins, or creating entities.</p>
-
- <h2>Example</h2>
- The Core has the facility to kick players using the web interface. It used the following code for the kicking (inside the webadmin handler):
-<pre class="prettyprint lang-lua">
-local KickPlayerName = Request.Params["players-kick"]
-local FoundPlayerCallback = function(Player)
- if (Player:GetName() == KickPlayerName) then
- Player:GetClientHandle():Kick("You were kicked from the game!")
- end
-end
-cRoot:Get():FindAndDoWithPlayer(KickPlayerName, FoundPlayerCallback)
-</pre>
-The cRoot:FindAndDoWithPlayer() is unsafe and could have caused a deadlock. The new solution is queue a task; but since we don't know in which world the player is, we need to queue the task to all worlds:
-<pre class="prettyprint lang-lua">
-cRoot:Get():ForEachWorld( -- For each world...
- function(World)
- World:QueueTask( -- ... queue a task...
- function(a_World)
- a_World:DoWithPlayer(KickPlayerName, -- ... to walk the playerlist...
- function (a_Player)
- a_Player:GetClientHandle():Kick("You were kicked from the game!") -- ... and kick the player
- end
- )
- end
- )
- end
-)
-</pre>
- <script>
- prettyPrint();
- </script>
- </div>
- </body>
-</html> \ No newline at end of file
diff --git a/MCServer/Plugins/APIDump/Writing-a-Cuberite-plugin.html b/MCServer/Plugins/APIDump/Writing-a-Cuberite-plugin.html
deleted file mode 100644
index 2b6af0d82..000000000
--- a/MCServer/Plugins/APIDump/Writing-a-Cuberite-plugin.html
+++ /dev/null
@@ -1,255 +0,0 @@
-<!DOCTYPE html>
-
-<html>
- <head>
- <title>Cuberite Plugin Tutorial</title>
- <link rel="stylesheet" type="text/css" href="main.css" />
- <link rel="stylesheet" type="text/css" href="prettify.css" />
- <script src="prettify.js"></script>
- <script src="lang-lua.js"></script>
- <meta charset="UTF-8">
- </head>
- <body>
- <div id="content">
- <h1>Writing a Cuberite plugin</h1>
- <p>
- This article will explain how to write a basic plugin. It details basic requirements
- for a plugin, explains how to register a hook and bind a command, and gives plugin
- standards details.
- </p>
- <p>
- Let us begin. In order to begin development, we must firstly obtain a compiled copy
- of Cuberite, and make sure that the Core plugin is within the Plugins folder, and activated.
- Core handles much of the Cuberite end-user experience and gameplay will be very bland without it.
- </p>
- <h2>Creating the basic template</h2>
- <p>
- Plugins are written in Lua. Therefore, create a new Lua file. You can create as many files as you wish, with
- any filename - Cuberite bungs them all together at runtime, however, let us create a file called main.lua for now.
- Format it like so:
- </p>
- <pre class="prettyprint lang-lua">
-PLUGIN = nil
-
-function Initialize(Plugin)
- Plugin:SetName("NewPlugin")
- Plugin:SetVersion(1)
-
- -- Hooks
-
- PLUGIN = Plugin -- NOTE: only needed if you want OnDisable() to use GetName() or something like that
-
- -- Command Bindings
-
- LOG("Initialised " .. Plugin:GetName() .. " v." .. Plugin:GetVersion())
- return true
-end
-
-function OnDisable()
- LOG(PLUGIN:GetName() .. " is shutting down...")
-end
- </pre>
- <p>
- Now for an explanation of the basics.
- <ul>
- <li><b>function Initialize</b> is called on plugin startup. It is the place where the plugin is set up.</li>
- <li><b>Plugin:SetName</b> sets the name of the plugin.</li>
- <li><b>Plugin:SetVersion</b> sets the revision number of the plugin. This must be an integer.</li>
- <li><b>LOG</b> logs to console a message, in this case, it prints that the plugin was initialised.</li>
- <li>The <b>PLUGIN</b> variable just stores this plugin's object, so GetName() can be called in OnDisable (as no Plugin parameter is passed there, contrary to Initialize).
- This global variable is only needed if you want to know the plugin details (name, etc.) when shutting down.</li>
- <li><b>function OnDisable</b> is called when the plugin is disabled, commonly when the server is shutting down. Perform cleanup and logging here.</li>
- </ul>
- Be sure to return true for this function, else Cuberite thinks you plugin had failed to initialise and prints a stacktrace with an error message.
- </p>
-
- <h2>Registering hooks</h2>
- <p>
- Hooks are things that Cuberite calls when an internal event occurs. For example, a hook is fired when a player places a block, moves,
- logs on, eats, and many other things. For a full list, see <a href="index.html">the API documentation</a>.
- </p>
- <p>
- A hook can be either informative or overridable. In any case, returning false will not trigger a response, but returning true will cancel
- the hook and prevent it from being propagated further to other plugins. An overridable hook simply means that there is visible behaviour
- to a hook's cancellation, such as a chest being prevented from being opened. There are some exceptions to this where only changing the value the
- hook passes has an effect, and not the actual return value, an example being the HOOK_KILLING hook. See the API docs for details.
- </p>
- <p>
- To register a hook, insert the following code template into the "-- Hooks" area in the previous code example.
- </p>
- <pre class="prettyprint lang-lua">
-cPluginManager.AddHook(cPluginManager.HOOK_NAME_HERE, FunctionNameToBeCalled)
- </pre>
- <p>
- What does this code do?
- <ul>
- <li><b>cPluginManager.AddHook</b> registers the hook. The hook name is the second parameter. See the previous API documentation link for a list of all hooks.</li>
- </ul>
- What about the third parameter, you ask? Well, it is the name of the function that Cuberite calls when the hook fires. It is in this
- function that you should handle or cancel the hook.
- </p>
- <p>
- So in total, this is a working representation of what we have so far covered.
- </p>
- <pre class="prettyprint lang-lua">
-function Initialize(Plugin)
- Plugin:SetName("DerpyPlugin")
- Plugin:SetVersion(1)
-
- cPluginManager.AddHook(cPluginManager.HOOK_PLAYER_MOVING, OnPlayerMoving)
-
- LOG("Initialised " .. Plugin:GetName() .. " v." .. Plugin:GetVersion())
- return true
-end
-
-function OnPlayerMoving(Player) -- See API docs for parameters of all hooks
- return true -- Prohibit player movement, see docs for whether a hook is cancellable
-end
- </pre>
- <p>
- So, that code stops the player from moving. Not particularly helpful, but yes :P. Note that ALL documentation is available
- on the main API docs page, so if ever in doubt, go there.
- </p>
- <h2>Binding a command</h2>
- <h3>Format</h3>
- <p>
- So now we know how to hook into Cuberite, how do we bind a command, such as /explode, for a player to type? That is more complicated.
- We firstly add this template to the "-- Command bindings" section of the initial example:
- </p>
- <pre class="prettyprint lang-lua">
--- ADD THIS IF COMMAND DOES NOT REQUIRE A PARAMETER (/explode)
-cPluginManager.BindCommand("/commandname", "permissionnode", FunctionToCall, " - Description of command")
-
--- ADD THIS IF COMMAND DOES REQUIRE A PARAMETER (/explode Notch)
-cPluginManager.BindCommand("/commandname", "permissionnode", FunctionToCall, " ~ Description of command and parameter(s)")
- </pre>
- <p>
- What does it do, and why are there two?
- <ul>
- <li><b>PluginManager:BindCommand</b> binds a command. It takes the command name (with a slash), the permission a player needs to execute the command, the function
- to call when the command is executed, and a description of the command.</li>
- </ul>
- The command name is pretty self explanatory. The permission node is basically just a <b>string</b> that the player's group needs to have, so you can have anything in there,
- though we recommend a style such as "derpyplugin.explode". The function to call is like the ones with Hooks, but with some fixed parameters which we will come on to later,
- and the description is a description of the command which is shown when "/help" is typed.
- </p>
- <p>
- So why are there two? Standards. A plugin that accepts a parameter MUST use a format for the description of " ~ Description of command and parms"
- whereas a command that doesn't accept parameters MUST use " - Description of command" instead. Be sure to put a space before the tildes or dashes.
- Additionally, try to keep the description brief and on one line on the client.
- </p>
- <h3>Parameters</h3>
- <p>
- What parameters are in the function Cuberite calls when the command is executed? A 'Split' array and a 'Player' object.
- </p>
- <h4>The Split Array</h4>
- <p>
- The Split array is an array of all text submitted to the server, including the actual command. Cuberite automatically splits the text into the array,
- so plugin authors do not need to worry about that. An example of a Split array passed for the command, "/derp zubby explode" would be:<br /><br />
- &nbsp&nbsp /derp (Split[1])<br />
- &nbsp&nbsp zubby (Split[2])<br />
- &nbsp&nbsp explode (Split[3])<br />
- <br />
- &nbsp&nbsp The total amount of parameters passed were: 3 (#Split)
- </p>
- <h4>The Player Object and sending them messages</h4>
- <p>
- The Player object is basically a pointer to the player that has executed the command. You can do things with them, but most common is sending
- a message. Again, see the API documentation for fuller details. But, you ask, how <i>do</i> we send a message to the client?
- </p>
- <p>
- There are dedicated functions used for sending a player formatted messages. By format, I refer to coloured prefixes/coloured text (depending on configuration)
- that clearly categorise what type of message a player is being sent. For example, an informational message has a yellow coloured [INFO] prefix, and a warning message
- has a rose coloured [WARNING] prefix. A few of the most used functions are listed here, but see the API docs for more details. Look in the cRoot, cWorld, and cPlayer sections
- for functions that broadcast to the entire server, the whole world, and a single player, respectively.
- </p>
- <pre class="prettyprint lang-lua">
--- Format: §yellow[INFO] §white%text% (yellow [INFO], white text following it)
--- Use: Informational message, such as instructions for usage of a command
-Player:SendMessageInfo("Usage: /explode [player]")
-
--- Format: §green[INFO] §white%text% (green [INFO] etc.)
--- Use: Success message, like when a command executes successfully
-Player:SendMessageSuccess("Notch was blown up!")
-
--- Format: §rose[INFO] §white%text% (rose coloured [INFO] etc.)
--- Use: Failure message, like when a command was entered correctly but failed to run, such as when the destination player wasn't found in a /tp command
-Player:SendMessageFailure("Player Salted was not found")
- </pre>
- <p>
- Those are the basics. If you want to output text to the player for a reason other than the three listed above, and you want to colour the text, simply concatenate
- "cChatColor.*colorhere*" with your desired text, concatenate being "..". See the API docs for more details of all colours, as well as details on logging to console with
- LOG("Text").
- </p>
- <h2>Final example and conclusion</h2>
- <p>
- So, a working example that checks the validity of a command, and blows up a player, and also refuses pickup collection to players with >100ms ping.
- </p>
- <pre class="prettyprint lang-lua">
-function Initialize(Plugin)
- Plugin:SetName("DerpyPluginThatBlowsPeopleUp")
- Plugin:SetVersion(9001)
-
- cPluginManager.BindCommand("/explode", "derpyplugin.explode", Explode, " ~ Explode a player");
-
- cPluginManager:AddHook(cPluginManager.HOOK_COLLECTING_PICKUP, OnCollectingPickup)
-
- LOG("Initialised " .. Plugin:GetName() .. " v." .. Plugin:GetVersion())
- return true
-end
-
-function Explode(Split, Player)
- if (#Split ~= 2) then
- -- There was more or less than one argument (excluding the "/explode" bit)
- -- Send the proper usage to the player and exit
- Player:SendMessage("Usage: /explode [playername]")
- return true
- end
-
- -- Create a callback ExplodePlayer with parameter Explodee, which Cuberite calls for every player on the server
- local HasExploded = false
- local ExplodePlayer = function(Explodee)
- -- If the player we are currently at is the one we specified as the parameter
- if (Explodee:GetName() == Split[2]) then
- -- Create an explosion at the same position as they are; see <a href="cWorld.html">API docs</a> for further details of this function
- Player:GetWorld():DoExplosionAt(Explodee:GetPosX(), Explodee:GetPosY(), Explodee:GetPosZ(), false, esPlugin)
- Player:SendMessageSuccess(Split[2] .. " was successfully exploded")
- HasExploded = true;
- return true -- Signalize to Cuberite that we do not need to call this callback for any more players
- end
- end
-
- -- Tell Cuberite to loop through all players and call the callback above with the Player object it has found
- cRoot:Get():FindAndDoWithPlayer(Split[2], ExplodePlayer)
-
- if not(HasExploded) then
- -- We have not broken out so far, therefore, the player must not exist, send failure
- Player:SendMessageFailure(Split[2] .. " was not found")
- end
-
- return true
-end
-
-function OnCollectingPickup(Player, Pickup) -- Again, see the API docs for parameters of all hooks. In this case, it is a Player and Pickup object
- if (Player:GetClientHandle():GetPing() > 100) then -- Get ping of player, in milliseconds
- return true -- Discriminate against high latency - you don't get drops :D
- else
- return false -- You do get the drops! Yay~
- end
-end
- </pre>
- <p>
- Make sure to read the comments for a description of what everything does. Also be sure to return true for all <b>command</b> handlers, unless you want Cuberite to print out an "Unknown command" message
- when the command gets executed :P. Make sure to follow standards - use CoreMessaging.lua functions for messaging, dashes for no parameter commands and tildes for vice versa,
- and finally, <a href="index.html">the API documentation</a> is your friend!
- </p>
- <p>
- Happy coding ;)
- </p>
-
- <script>
- prettyPrint();
- </script>
- </div>
- </body>
-</html>
diff --git a/MCServer/Plugins/APIDump/lang-lua.js b/MCServer/Plugins/APIDump/lang-lua.js
deleted file mode 100644
index 7e44cca0a..000000000
--- a/MCServer/Plugins/APIDump/lang-lua.js
+++ /dev/null
@@ -1,2 +0,0 @@
-PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\r \xa0]+/,null,"\t\n\r \u00a0"],["str",/^(?:"(?:[^"\\]|\\[\S\s])*(?:"|$)|'(?:[^'\\]|\\[\S\s])*(?:'|$))/,null,"\"'"]],[["com",/^--(?:\[(=*)\[[\S\s]*?(?:]\1]|$)|[^\n\r]*)/],["str",/^\[(=*)\[[\S\s]*?(?:]\1]|$)/],["kwd",/^(?:and|break|do|else|elseif|end|false|for|function|if|in|local|nil|not|or|repeat|return|then|true|until|while)\b/,null],["lit",/^[+-]?(?:0x[\da-f]+|(?:\.\d+|\d+(?:\.\d*)?)(?:e[+-]?\d+)?)/i],
-["pln",/^[_a-z]\w*/i],["pun",/^[^\w\t\n\r \xa0][^\w\t\n\r "'+=\xa0-]*/]]),["lua"]);
diff --git a/MCServer/Plugins/APIDump/main.css b/MCServer/Plugins/APIDump/main.css
deleted file mode 100644
index e5685caab..000000000
--- a/MCServer/Plugins/APIDump/main.css
+++ /dev/null
@@ -1,68 +0,0 @@
-html
-{
- background-color: #C0C0C0;
-}
-
-table
-{
- background-color: #fff;
- border-spacing: 0px;
- border-collapse: collapse;
- border-color: gray;
-}
-
-tr
-{
- display: table-row;
- vertical-align: inherit;
- border-color: inherit;
-}
-
-td, th
-{
- display: table-cell;
- vertical-align: inherit;
- padding: 3px;
- border: 1px solid #ccc;
-}
-
-pre
-{
- border: 1px solid #ccc;
- background-color: #eee;
- -moz-tab-size: 2;
- -o-tab-size: 2;
- -webkit-tab-size: 2;
- -ms-tab-size: 2;
- tab-size: 2;
-}
-
-body
-{
- min-width: 400px;
- max-width: 1200px;
- width: 95%;
- margin: 10px auto;
- background-color: white;
- border: 4px #FF8C00 solid;
- border-radius: 20px;
- font-family: Calibri, Trebuchet MS;
-}
-
-header
-{
- text-align: center;
- font-family: Segoe UI Light, Helvetica;
-}
-
-footer
-{
- text-align: center;
- font-family: Segoe UI Light, Helvetica;
-}
-
-#content, #timestamp
-{
- padding: 0px 25px 25px 25px;
-}
-
diff --git a/MCServer/Plugins/APIDump/main_APIDump.lua b/MCServer/Plugins/APIDump/main_APIDump.lua
deleted file mode 100644
index 4892d477d..000000000
--- a/MCServer/Plugins/APIDump/main_APIDump.lua
+++ /dev/null
@@ -1,1685 +0,0 @@
--- main.lua
-
--- Implements the plugin entrypoint (in this case the entire plugin)
-
-
-
-
-
--- Global variables:
-local g_Plugin = nil
-local g_PluginFolder = ""
-local g_Stats = {}
-local g_TrackedPages = {}
-
-
-
-
-
-
-local function LoadAPIFiles(a_Folder, a_DstTable)
- assert(type(a_Folder) == "string")
- assert(type(a_DstTable) == "table")
-
- local Folder = g_PluginFolder .. a_Folder;
- for _, fnam in ipairs(cFile:GetFolderContents(Folder)) do
- local FileName = Folder .. fnam;
- -- We only want .lua files from the folder:
- if (cFile:IsFile(FileName) and fnam:match(".*%.lua$")) then
- local TablesFn, Err = loadfile(FileName);
- if (type(TablesFn) ~= "function") then
- LOGWARNING("Cannot load API descriptions from " .. FileName .. ", Lua error '" .. Err .. "'.");
- else
- local Tables = TablesFn();
- if (type(Tables) ~= "table") then
- LOGWARNING("Cannot load API descriptions from " .. FileName .. ", returned object is not a table (" .. type(Tables) .. ").");
- break
- end
- for k, cls in pairs(Tables) do
- a_DstTable[k] = cls;
- end
- end -- if (TablesFn)
- end -- if (is lua file)
- end -- for fnam - Folder[]
-end
-
-
-
-
-
-local function CreateAPITables()
- --[[
- We want an API table of the following shape:
- local API = {
- {
- Name = "cCuboid",
- Functions = {
- {Name = "Sort"},
- {Name = "IsInside"}
- },
- Constants = {
- },
- Variables = {
- },
- Descendants = {}, -- Will be filled by ReadDescriptions(), array of class APIs (references to other member in the tree)
- },
- {
- Name = "cBlockArea",
- Functions = {
- {Name = "Clear"},
- {Name = "CopyFrom"},
- ...
- },
- Constants = {
- {Name = "baTypes", Value = 0},
- {Name = "baMetas", Value = 1},
- ...
- },
- Variables = {
- },
- ...
- },
-
- cCuboid = {} -- Each array item also has the map item by its name
- };
- local Globals = {
- Functions = {
- ...
- },
- Constants = {
- ...
- }
- };
- --]]
-
- local Globals = {Functions = {}, Constants = {}, Variables = {}, Descendants = {}};
- local API = {};
-
- local function Add(a_APIContainer, a_ObjName, a_ObjValue)
- if (type(a_ObjValue) == "function") then
- table.insert(a_APIContainer.Functions, {Name = a_ObjName});
- elseif (
- (type(a_ObjValue) == "number") or
- (type(a_ObjValue) == "string")
- ) then
- table.insert(a_APIContainer.Constants, {Name = a_ObjName, Value = a_ObjValue});
- end
- end
-
- local function ParseClass(a_ClassName, a_ClassObj)
- local res = {Name = a_ClassName, Functions = {}, Constants = {}, Variables = {}, Descendants = {}};
- -- Add functions and constants:
- for i, v in pairs(a_ClassObj) do
- Add(res, i, v);
- end
-
- -- Member variables:
- local SetField = a_ClassObj[".set"] or {};
- if ((a_ClassObj[".get"] ~= nil) and (type(a_ClassObj[".get"]) == "table")) then
- for k in pairs(a_ClassObj[".get"]) do
- if (SetField[k] == nil) then
- -- It is a read-only variable, add it as a constant:
- table.insert(res.Constants, {Name = k, Value = ""});
- else
- -- It is a read-write variable, add it as a variable:
- table.insert(res.Variables, { Name = k });
- end
- end
- end
- return res;
- end
-
- for i, v in pairs(_G) do
- if (
- (v ~= _G) and -- don't want the global namespace
- (v ~= _G.packages) and -- don't want any packages
- (v ~= _G[".get"]) and
- (v ~= g_APIDesc)
- ) then
- if (type(v) == "table") then
- local cls = ParseClass(i, v)
- table.insert(API, cls);
- API[cls.Name] = cls
- else
- Add(Globals, i, v);
- end
- end
- end
-
- return API, Globals;
-end
-
-
-
-
-
---- Returns the timestamp in HTML format
--- The timestamp will be inserted to all generated HTML files
-local function GetHtmlTimestamp()
- return string.format("<div id='timestamp'>Generated on %s, Build ID %s, Commit %s</div>",
- os.date("%Y-%m-%d %H:%M:%S"),
- cRoot:GetBuildID(), cRoot:GetBuildCommitID()
- )
-end
-
-
-
-
-
-local function WriteArticles(f)
- f:write([[
- <a name="articles"><h2>Articles</h2></a>
- <p>The following articles provide various extra information on plugin development</p>
- <ul>
- ]]);
- for _, extra in ipairs(g_APIDesc.ExtraPages) do
- local SrcFileName = g_PluginFolder .. "/" .. extra.FileName;
- if (cFile:Exists(SrcFileName)) then
- local DstFileName = "API/" .. extra.FileName;
- if (cFile:Exists(DstFileName)) then
- cFile:Delete(DstFileName);
- end
- cFile:Copy(SrcFileName, DstFileName);
- f:write("<li><a href=\"" .. extra.FileName .. "\">" .. extra.Title .. "</a></li>\n");
- else
- f:write("<li>" .. extra.Title .. " <i>(file is missing)</i></li>\n");
- end
- end
- f:write("</ul><hr />");
-end
-
-
-
-
-
--- Make a link out of anything with the special linkifying syntax {{link|title}}
-local function LinkifyString(a_String, a_Referrer)
- assert(a_Referrer ~= nil);
- assert(a_Referrer ~= "");
-
- --- Adds a page to the list of tracked pages (to be checked for existence at the end)
- local function AddTrackedPage(a_PageName)
- local Pg = (g_TrackedPages[a_PageName] or {});
- table.insert(Pg, a_Referrer);
- g_TrackedPages[a_PageName] = Pg;
- end
-
- --- Creates the HTML for the specified link and title
- local function CreateLink(Link, Title)
- if (Link:sub(1, 7) == "http://") then
- -- The link is a full absolute URL, do not modify, do not track:
- return "<a href=\"" .. Link .. "\">" .. Title .. "</a>";
- end
- local idxHash = Link:find("#");
- if (idxHash ~= nil) then
- -- The link contains an anchor:
- if (idxHash == 1) then
- -- Anchor in the current page, no need to track:
- return "<a href=\"" .. Link .. "\">" .. Title .. "</a>";
- end
- -- Anchor in another page:
- local PageName = Link:sub(1, idxHash - 1);
- AddTrackedPage(PageName);
- return "<a href=\"" .. PageName .. ".html#" .. Link:sub(idxHash + 1) .. "\">" .. Title .. "</a>";
- end
- -- Link without anchor:
- AddTrackedPage(Link);
- return "<a href=\"" .. Link .. ".html\">" .. Title .. "</a>";
- end
-
- -- Linkify the strings using the CreateLink() function:
- local txt = a_String:gsub("{{([^|}]*)|([^}]*)}}", CreateLink) -- {{link|title}}
- txt = txt:gsub("{{([^|}]*)}}", -- {{LinkAndTitle}}
- function(LinkAndTitle)
- local idxHash = LinkAndTitle:find("#");
- if (idxHash ~= nil) then
- -- The LinkAndTitle contains a hash, remove the hashed part from the title:
- return CreateLink(LinkAndTitle, LinkAndTitle:sub(1, idxHash - 1));
- end
- return CreateLink(LinkAndTitle, LinkAndTitle);
- end
- );
- return txt;
-end
-
-
-
-
-
-local function WriteHtmlHook(a_Hook, a_HookNav)
- local fnam = "API/" .. a_Hook.DefaultFnName .. ".html";
- local f, error = io.open(fnam, "w");
- if (f == nil) then
- LOG("Cannot write \"" .. fnam .. "\": \"" .. error .. "\".");
- return;
- end
- local HookName = a_Hook.DefaultFnName;
-
- f:write([[<!DOCTYPE html><html>
- <head>
- <title>Cuberite API - ]], HookName, [[ Hook</title>
- <link rel="stylesheet" type="text/css" href="main.css" />
- <link rel="stylesheet" type="text/css" href="prettify.css" />
- <script src="prettify.js"></script>
- <script src="lang-lua.js"></script>
- </head>
- <body>
- <div id="content">
- <header>
- <h1>]], a_Hook.Name, [[</h1>
- <hr />
- </header>
- <table><tr><td style="vertical-align: top;">
- Index:<br />
- <a href='index.html#articles'>Articles</a><br />
- <a href='index.html#classes'>Classes</a><br />
- <a href='index.html#hooks'>Hooks</a><br />
- <br />
- Quick navigation:<br />
- ]]);
- f:write(a_HookNav);
- f:write([[
- </td><td style="vertical-align: top;"><p>
- ]]);
- f:write(LinkifyString(a_Hook.Desc, HookName));
- f:write("</p>\n<hr /><h1>Callback function</h1>\n<p>The default name for the callback function is ");
- f:write(a_Hook.DefaultFnName, ". It has the following signature:\n");
- f:write("<pre class=\"prettyprint lang-lua\">function ", HookName, "(");
- if (a_Hook.Params == nil) then
- a_Hook.Params = {};
- end
- for i, param in ipairs(a_Hook.Params) do
- if (i > 1) then
- f:write(", ");
- end
- f:write(param.Name);
- end
- f:write(")</pre>\n<hr /><h1>Parameters:</h1>\n<table><tr><th>Name</th><th>Type</th><th>Notes</th></tr>\n");
- for _, param in ipairs(a_Hook.Params) do
- f:write("<tr><td>", param.Name, "</td><td>", LinkifyString(param.Type, HookName), "</td><td>", LinkifyString(param.Notes, HookName), "</td></tr>\n");
- end
- f:write("</table>\n<p>" .. LinkifyString(a_Hook.Returns or "", HookName) .. "</p>\n\n");
- f:write([[<hr /><h1>Code examples</h1><h2>Registering the callback</h2>]]);
- f:write("<pre class=\"prettyprint lang-lua\">\n");
- f:write([[cPluginManager:AddHook(cPluginManager.]] .. a_Hook.Name .. ", My" .. a_Hook.DefaultFnName .. [[);]]);
- f:write("</pre>\n\n");
- local Examples = a_Hook.CodeExamples or {};
- for _, example in ipairs(Examples) do
- f:write("<h2>", (example.Title or "<i>missing Title</i>"), "</h2>\n");
- f:write("<p>", (example.Desc or "<i>missing Desc</i>"), "</p>\n");
- f:write("<pre class=\"prettyprint lang-lua\">", (example.Code or "<i>missing Code</i>"), "\n</pre>\n\n");
- end
- f:write([[</td></tr></table></div><script>prettyPrint();</script>]])
- f:write(GetHtmlTimestamp())
- f:write([[</body></html>]])
- f:close();
-end
-
-
-
-
-
-local function WriteHooks(f, a_Hooks, a_UndocumentedHooks, a_HookNav)
- f:write([[
- <a name="hooks"><h2>Hooks</h2></a>
- <p>
- A plugin can register to be called whenever an "interesting event" occurs. It does so by calling
- <a href="cPluginManager.html">cPluginManager</a>'s AddHook() function and implementing a callback
- function to handle the event.</p>
- <p>
- 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.</p>
- <table>
- <tr>
- <th>Hook name</th>
- <th>Called when</th>
- </tr>
- ]]);
- for _, hook in ipairs(a_Hooks) do
- if (hook.DefaultFnName == nil) then
- -- The hook is not documented yet
- f:write(" <tr>\n <td>" .. hook.Name .. "</td>\n <td><i>(No documentation yet)</i></td>\n </tr>\n");
- table.insert(a_UndocumentedHooks, hook.Name);
- else
- f:write(" <tr>\n <td><a href=\"" .. hook.DefaultFnName .. ".html\">" .. hook.Name .. "</a></td>\n <td>" .. LinkifyString(hook.CalledWhen, hook.Name) .. "</td>\n </tr>\n");
- WriteHtmlHook(hook, a_HookNav);
- end
- end
- f:write([[
- </table>
- <hr />
- ]]);
-end
-
-
-
-
-
-local function ReadDescriptions(a_API)
- -- Returns true if the class of the specified name is to be ignored
- local function IsClassIgnored(a_ClsName)
- if (g_APIDesc.IgnoreClasses == nil) then
- return false;
- end
- for _, name in ipairs(g_APIDesc.IgnoreClasses) do
- if (a_ClsName:match(name)) then
- return true;
- end
- end
- return false;
- end
-
- -- Returns true if the function is to be ignored
- local function IsFunctionIgnored(a_ClassName, a_FnName)
- if (g_APIDesc.IgnoreFunctions == nil) then
- return false;
- end
- if (((g_APIDesc.Classes[a_ClassName] or {}).Functions or {})[a_FnName] ~= nil) then
- -- The function is documented, don't ignore
- return false;
- end
- local FnName = a_ClassName .. "." .. a_FnName;
- for _, name in ipairs(g_APIDesc.IgnoreFunctions) do
- if (FnName:match(name)) then
- return true;
- end
- end
- return false;
- end
-
- -- Returns true if the constant (specified by its fully qualified name) is to be ignored
- local function IsConstantIgnored(a_CnName)
- if (g_APIDesc.IgnoreConstants == nil) then
- return false;
- end;
- for _, name in ipairs(g_APIDesc.IgnoreConstants) do
- if (a_CnName:match(name)) then
- return true;
- end
- end
- return false;
- end
-
- -- Returns true if the member variable (specified by its fully qualified name) is to be ignored
- local function IsVariableIgnored(a_VarName)
- if (g_APIDesc.IgnoreVariables == nil) then
- return false;
- end;
- for _, name in ipairs(g_APIDesc.IgnoreVariables) do
- if (a_VarName:match(name)) then
- return true;
- end
- end
- return false;
- end
-
- -- Remove ignored classes from a_API:
- local APICopy = {};
- for _, cls in ipairs(a_API) do
- if not(IsClassIgnored(cls.Name)) then
- table.insert(APICopy, cls);
- end
- end
- for i = 1, #a_API do
- a_API[i] = APICopy[i];
- end;
-
- -- Process the documentation for each class:
- for _, cls in ipairs(a_API) do
- -- Initialize default values for each class:
- cls.ConstantGroups = {};
- cls.NumConstantsInGroups = 0;
- cls.NumConstantsInGroupsForDescendants = 0;
-
- -- Rename special functions:
- for _, fn in ipairs(cls.Functions) do
- if (fn.Name == ".call") then
- fn.DocID = "constructor";
- fn.Name = "() <i>(constructor)</i>";
- elseif (fn.Name == ".add") then
- fn.DocID = "operator_plus";
- fn.Name = "<i>operator +</i>";
- elseif (fn.Name == ".div") then
- fn.DocID = "operator_div";
- fn.Name = "<i>operator /</i>";
- elseif (fn.Name == ".mul") then
- fn.DocID = "operator_mul";
- fn.Name = "<i>operator *</i>";
- elseif (fn.Name == ".sub") then
- fn.DocID = "operator_sub";
- fn.Name = "<i>operator -</i>";
- elseif (fn.Name == ".eq") then
- fn.DocID = "operator_eq";
- fn.Name = "<i>operator ==</i>";
- end
- end
-
- local APIDesc = g_APIDesc.Classes[cls.Name];
- if (APIDesc ~= nil) then
- APIDesc.IsExported = true;
- cls.Desc = APIDesc.Desc;
- cls.AdditionalInfo = APIDesc.AdditionalInfo;
-
- -- Process inheritance:
- if (APIDesc.Inherits ~= nil) then
- for _, icls in ipairs(a_API) do
- if (icls.Name == APIDesc.Inherits) then
- table.insert(icls.Descendants, cls);
- cls.Inherits = icls;
- end
- end
- end
-
- cls.UndocumentedFunctions = {}; -- This will contain names of all the functions that are not documented
- cls.UndocumentedConstants = {}; -- This will contain names of all the constants that are not documented
- cls.UndocumentedVariables = {}; -- This will contain names of all the variables that are not documented
-
- local DoxyFunctions = {}; -- This will contain all the API functions together with their documentation
-
- local function AddFunction(a_Name, a_Params, a_Return, a_Notes)
- table.insert(DoxyFunctions, {Name = a_Name, Params = a_Params, Return = a_Return, Notes = a_Notes});
- end
-
- if (APIDesc.Functions ~= nil) then
- -- Assign function descriptions:
- for _, func in ipairs(cls.Functions) do
- local FnName = func.DocID or func.Name;
- local FnDesc = APIDesc.Functions[FnName];
- if (FnDesc == nil) then
- -- No description for this API function
- AddFunction(func.Name);
- if not(IsFunctionIgnored(cls.Name, FnName)) then
- table.insert(cls.UndocumentedFunctions, FnName);
- end
- else
- -- Description is available
- if (FnDesc[1] == nil) then
- -- Single function definition
- AddFunction(func.Name, FnDesc.Params, FnDesc.Return, FnDesc.Notes);
- else
- -- Multiple function overloads
- for _, desc in ipairs(FnDesc) do
- AddFunction(func.Name, desc.Params, desc.Return, desc.Notes);
- end -- for k, desc - FnDesc[]
- end
- FnDesc.IsExported = true;
- end
- end -- for j, func
-
- -- Replace functions with their described and overload-expanded versions:
- cls.Functions = DoxyFunctions;
- else -- if (APIDesc.Functions ~= nil)
- for _, func in ipairs(cls.Functions) do
- local FnName = func.DocID or func.Name;
- if not(IsFunctionIgnored(cls.Name, FnName)) then
- table.insert(cls.UndocumentedFunctions, FnName);
- end
- end
- end -- if (APIDesc.Functions ~= nil)
-
- if (APIDesc.Constants ~= nil) then
- -- Assign constant descriptions:
- for _, cons in ipairs(cls.Constants) do
- local CnDesc = APIDesc.Constants[cons.Name];
- if (CnDesc == nil) then
- -- Not documented
- if not(IsConstantIgnored(cls.Name .. "." .. cons.Name)) then
- table.insert(cls.UndocumentedConstants, cons.Name);
- end
- else
- cons.Notes = CnDesc.Notes;
- CnDesc.IsExported = true;
- end
- end -- for j, cons
- else -- if (APIDesc.Constants ~= nil)
- for _, cons in ipairs(cls.Constants) do
- if not(IsConstantIgnored(cls.Name .. "." .. cons.Name)) then
- table.insert(cls.UndocumentedConstants, cons.Name);
- end
- end
- end -- else if (APIDesc.Constants ~= nil)
-
- -- Assign member variables' descriptions:
- if (APIDesc.Variables ~= nil) then
- for _, var in ipairs(cls.Variables) do
- local VarDesc = APIDesc.Variables[var.Name];
- if (VarDesc == nil) then
- -- Not documented
- if not(IsVariableIgnored(cls.Name .. "." .. var.Name)) then
- table.insert(cls.UndocumentedVariables, var.Name);
- end
- else
- -- Copy all documentation:
- for k, v in pairs(VarDesc) do
- var[k] = v
- end
- end
- end -- for j, var
- else -- if (APIDesc.Variables ~= nil)
- for _, var in ipairs(cls.Variables) do
- if not(IsVariableIgnored(cls.Name .. "." .. var.Name)) then
- table.insert(cls.UndocumentedVariables, var.Name);
- end
- end
- end -- else if (APIDesc.Variables ~= nil)
-
- if (APIDesc.ConstantGroups ~= nil) then
- -- Create links between the constants and the groups:
- local NumInGroups = 0;
- local NumInDescendantGroups = 0;
- for j, group in pairs(APIDesc.ConstantGroups) do
- group.Name = j;
- group.Constants = {};
- if (type(group.Include) == "string") then
- group.Include = { group.Include };
- end
- local NumInGroup = 0;
- for _, incl in ipairs(group.Include or {}) do
- for _, cons in ipairs(cls.Constants) do
- if ((cons.Group == nil) and cons.Name:match(incl)) then
- cons.Group = group;
- table.insert(group.Constants, cons);
- NumInGroup = NumInGroup + 1;
- end
- end -- for cidx - cls.Constants[]
- end -- for idx - group.Include[]
- NumInGroups = NumInGroups + NumInGroup;
- if (group.ShowInDescendants) then
- NumInDescendantGroups = NumInDescendantGroups + NumInGroup;
- end
-
- -- Sort the constants:
- table.sort(group.Constants,
- function(c1, c2)
- return (c1.Name < c2.Name);
- end
- );
- end -- for j - APIDesc.ConstantGroups[]
- cls.ConstantGroups = APIDesc.ConstantGroups;
- cls.NumConstantsInGroups = NumInGroups;
- cls.NumConstantsInGroupsForDescendants = NumInDescendantGroups;
-
- -- Remove grouped constants from the normal list:
- local NewConstants = {};
- for _, cons in ipairs(cls.Constants) do
- if (cons.Group == nil) then
- table.insert(NewConstants, cons);
- end
- end
- cls.Constants = NewConstants;
- end -- if (ConstantGroups ~= nil)
-
- else -- if (APIDesc ~= nil)
-
- -- Class is not documented at all, add all its members to Undocumented lists:
- cls.UndocumentedFunctions = {};
- cls.UndocumentedConstants = {};
- cls.UndocumentedVariables = {};
- cls.Variables = cls.Variables or {};
- g_Stats.NumUndocumentedClasses = g_Stats.NumUndocumentedClasses + 1;
- for _, func in ipairs(cls.Functions) do
- local FnName = func.DocID or func.Name;
- if not(IsFunctionIgnored(cls.Name, FnName)) then
- table.insert(cls.UndocumentedFunctions, FnName);
- end
- end -- for j, func - cls.Functions[]
- for _, cons in ipairs(cls.Constants) do
- if not(IsConstantIgnored(cls.Name .. "." .. cons.Name)) then
- table.insert(cls.UndocumentedConstants, cons.Name);
- end
- end -- for j, cons - cls.Constants[]
- for _, var in ipairs(cls.Variables) do
- if not(IsConstantIgnored(cls.Name .. "." .. var.Name)) then
- table.insert(cls.UndocumentedVariables, var.Name);
- end
- end -- for j, var - cls.Variables[]
- end -- else if (APIDesc ~= nil)
-
- -- Remove ignored functions:
- local NewFunctions = {};
- for _, fn in ipairs(cls.Functions) do
- if (not(IsFunctionIgnored(cls.Name, fn.Name))) then
- table.insert(NewFunctions, fn);
- end
- end -- for j, fn
- cls.Functions = NewFunctions;
-
- -- Sort the functions (they may have been renamed):
- table.sort(cls.Functions,
- function(f1, f2)
- if (f1.Name == f2.Name) then
- -- Same name, either comparing the same function to itself, or two overloads, in which case compare the params
- if ((f1.Params == nil) or (f2.Params == nil)) then
- return 0;
- end
- return (f1.Params < f2.Params);
- end
- return (f1.Name < f2.Name);
- end
- );
-
- -- Remove ignored constants:
- local NewConstants = {};
- for _, cn in ipairs(cls.Constants) do
- if (not(IsFunctionIgnored(cls.Name, cn.Name))) then
- table.insert(NewConstants, cn);
- end
- end -- for j, cn
- cls.Constants = NewConstants;
-
- -- Sort the constants:
- table.sort(cls.Constants,
- function(c1, c2)
- return (c1.Name < c2.Name);
- end
- );
-
- -- Remove ignored member variables:
- local NewVariables = {};
- for _, var in ipairs(cls.Variables) do
- if (not(IsVariableIgnored(cls.Name .. "." .. var.Name))) then
- table.insert(NewVariables, var);
- end
- end -- for j, var
- cls.Variables = NewVariables;
-
- -- Sort the member variables:
- table.sort(cls.Variables,
- function(v1, v2)
- return (v1.Name < v2.Name);
- end
- );
- end -- for i, cls
-
- -- Sort the descendants lists:
- for _, cls in ipairs(a_API) do
- table.sort(cls.Descendants,
- function(c1, c2)
- return (c1.Name < c2.Name);
- end
- );
- end -- for i, cls
-end
-
-
-
-
-
-local function ReadHooks(a_Hooks)
- --[[
- a_Hooks = {
- { Name = "HOOK_1"},
- { Name = "HOOK_2"},
- ...
- };
- We want to add hook descriptions to each hook in this array
- --]]
- for _, hook in ipairs(a_Hooks) do
- local HookDesc = g_APIDesc.Hooks[hook.Name];
- if (HookDesc ~= nil) then
- for key, val in pairs(HookDesc) do
- hook[key] = val;
- end
- end
- end -- for i, hook - a_Hooks[]
- g_Stats.NumTotalHooks = #a_Hooks;
-end
-
-
-
-
-
-local function WriteHtmlClass(a_ClassAPI, a_ClassMenu)
- local cf, err = io.open("API/" .. a_ClassAPI.Name .. ".html", "w");
- if (cf == nil) then
- LOGINFO("Cannot write HTML API for class " .. a_ClassAPI.Name .. ": " .. err)
- return;
- end
-
- -- Writes a table containing all functions in the specified list, with an optional "inherited from" header when a_InheritedName is valid
- local function WriteFunctions(a_Functions, a_InheritedName)
- if (#a_Functions == 0) then
- return;
- end
-
- if (a_InheritedName ~= nil) then
- cf:write("<h2>Functions inherited from ", a_InheritedName, "</h2>\n");
- end
- cf:write("<table>\n<tr><th>Name</th><th>Parameters</th><th>Return value</th><th>Notes</th></tr>\n");
- for _, func in ipairs(a_Functions) do
- cf:write("<tr><td>", func.Name, "</td>\n");
- cf:write("<td>", LinkifyString(func.Params or "", (a_InheritedName or a_ClassAPI.Name)), "</td>\n");
- cf:write("<td>", LinkifyString(func.Return or "", (a_InheritedName or a_ClassAPI.Name)), "</td>\n");
- cf:write("<td>", LinkifyString(func.Notes or "<i>(undocumented)</i>", (a_InheritedName or a_ClassAPI.Name)), "</td></tr>\n");
- end
- cf:write("</table>\n");
- end
-
- local function WriteConstantTable(a_Constants, a_Source)
- cf:write("<table>\n<tr><th>Name</th><th>Value</th><th>Notes</th></tr>\n");
- for _, cons in ipairs(a_Constants) do
- cf:write("<tr><td>", cons.Name, "</td>\n");
- cf:write("<td>", cons.Value, "</td>\n");
- cf:write("<td>", LinkifyString(cons.Notes or "", a_Source), "</td></tr>\n");
- end
- cf:write("</table>\n\n");
- end
-
- local function WriteConstants(a_Constants, a_ConstantGroups, a_NumConstantGroups, a_InheritedName)
- if ((#a_Constants == 0) and (a_NumConstantGroups == 0)) then
- return;
- end
-
- local Source = a_ClassAPI.Name
- if (a_InheritedName ~= nil) then
- cf:write("<h2>Constants inherited from ", a_InheritedName, "</h2>\n");
- Source = a_InheritedName;
- end
-
- if (#a_Constants > 0) then
- WriteConstantTable(a_Constants, Source);
- end
-
- for _, group in pairs(a_ConstantGroups) do
- if ((a_InheritedName == nil) or group.ShowInDescendants) then
- cf:write("<a name='", group.Name, "'><p>");
- cf:write(LinkifyString(group.TextBefore or "", Source));
- WriteConstantTable(group.Constants, a_InheritedName or a_ClassAPI.Name);
- cf:write(LinkifyString(group.TextAfter or "", Source), "</a></p>");
- end
- end
- end
-
- local function WriteVariables(a_Variables, a_InheritedName)
- if (#a_Variables == 0) then
- return;
- end
-
- if (a_InheritedName ~= nil) then
- cf:write("<h2>Member variables inherited from ", a_InheritedName, "</h2>\n");
- end
-
- cf:write("<table><tr><th>Name</th><th>Type</th><th>Notes</th></tr>\n");
- for _, var in ipairs(a_Variables) do
- cf:write("<tr><td>", var.Name, "</td>\n");
- cf:write("<td>", LinkifyString(var.Type or "<i>(undocumented)</i>", a_InheritedName or a_ClassAPI.Name), "</td>\n");
- cf:write("<td>", LinkifyString(var.Notes or "", a_InheritedName or a_ClassAPI.Name), "</td>\n </tr>\n");
- end
- cf:write("</table>\n\n");
- end
-
- local function WriteDescendants(a_Descendants)
- if (#a_Descendants == 0) then
- return;
- end
- cf:write("<ul>");
- for _, desc in ipairs(a_Descendants) do
- cf:write("<li><a href=\"", desc.Name, ".html\">", desc.Name, "</a>");
- WriteDescendants(desc.Descendants);
- cf:write("</li>\n");
- end
- cf:write("</ul>\n");
- end
-
- local ClassName = a_ClassAPI.Name;
-
- -- Build an array of inherited classes chain:
- local InheritanceChain = {};
- local CurrInheritance = a_ClassAPI.Inherits;
- while (CurrInheritance ~= nil) do
- table.insert(InheritanceChain, CurrInheritance);
- CurrInheritance = CurrInheritance.Inherits;
- end
-
- cf:write([[<!DOCTYPE html><html>
- <head>
- <title>Cuberite API - ]], a_ClassAPI.Name, [[ Class</title>
- <link rel="stylesheet" type="text/css" href="main.css" />
- <link rel="stylesheet" type="text/css" href="prettify.css" />
- <script src="prettify.js"></script>
- <script src="lang-lua.js"></script>
- </head>
- <body>
- <div id="content">
- <header>
- <h1>]], a_ClassAPI.Name, [[</h1>
- <hr />
- </header>
- <table><tr><td style="vertical-align: top;">
- Index:<br />
- <a href='index.html#articles'>Articles</a><br />
- <a href='index.html#classes'>Classes</a><br />
- <a href='index.html#hooks'>Hooks</a><br />
- <br />
- Quick navigation:<br />
- ]]);
- cf:write(a_ClassMenu);
- cf:write([[
- </td><td style="vertical-align: top;"><h1>Contents</h1>
- <p><ul>
- ]]);
-
- local HasInheritance = ((#a_ClassAPI.Descendants > 0) or (a_ClassAPI.Inherits ~= nil));
-
- local HasConstants = (#a_ClassAPI.Constants > 0) or (a_ClassAPI.NumConstantsInGroups > 0);
- local HasFunctions = (#a_ClassAPI.Functions > 0);
- local HasVariables = (#a_ClassAPI.Variables > 0);
- for _, cls in ipairs(InheritanceChain) do
- HasConstants = HasConstants or (#cls.Constants > 0) or (cls.NumConstantsInGroupsForDescendants > 0);
- HasFunctions = HasFunctions or (#cls.Functions > 0);
- HasVariables = HasVariables or (#cls.Variables > 0);
- end
-
- -- Write the table of contents:
- if (HasInheritance) then
- cf:write("<li><a href=\"#inherits\">Inheritance</a></li>\n");
- end
- if (HasConstants) then
- cf:write("<li><a href=\"#constants\">Constants</a></li>\n");
- end
- if (HasVariables) then
- cf:write("<li><a href=\"#variables\">Member variables</a></li>\n");
- end
- if (HasFunctions) then
- cf:write("<li><a href=\"#functions\">Functions</a></li>\n");
- end
- if (a_ClassAPI.AdditionalInfo ~= nil) then
- for i, additional in ipairs(a_ClassAPI.AdditionalInfo) do
- cf:write("<li><a href=\"#additionalinfo_", i, "\">", (additional.Header or "<i>(No header)</i>"), "</a></li>\n");
- end
- end
- cf:write("</ul></p>\n");
-
- -- Write the class description:
- cf:write("<hr /><a name=\"desc\"><h1>", ClassName, " class</h1></a>\n");
- if (a_ClassAPI.Desc ~= nil) then
- cf:write("<p>");
- cf:write(LinkifyString(a_ClassAPI.Desc, ClassName));
- cf:write("</p>\n\n");
- end;
-
- -- Write the inheritance, if available:
- if (HasInheritance) then
- cf:write("<hr /><a name=\"inherits\"><h1>Inheritance</h1></a>\n");
- if (#InheritanceChain > 0) then
- cf:write("<p>This class inherits from the following parent classes:<ul>\n");
- for _, cls in ipairs(InheritanceChain) do
- cf:write("<li><a href=\"", cls.Name, ".html\">", cls.Name, "</a></li>\n");
- end
- cf:write("</ul></p>\n");
- end
- if (#a_ClassAPI.Descendants > 0) then
- cf:write("<p>This class has the following descendants:\n");
- WriteDescendants(a_ClassAPI.Descendants);
- cf:write("</p>\n\n");
- end
- end
-
- -- Write the constants:
- if (HasConstants) then
- cf:write("<a name=\"constants\"><hr /><h1>Constants</h1></a>\n");
- WriteConstants(a_ClassAPI.Constants, a_ClassAPI.ConstantGroups, a_ClassAPI.NumConstantsInGroups, nil);
- g_Stats.NumTotalConstants = g_Stats.NumTotalConstants + #a_ClassAPI.Constants + (a_ClassAPI.NumConstantsInGroups or 0);
- for _, cls in ipairs(InheritanceChain) do
- WriteConstants(cls.Constants, cls.ConstantGroups, cls.NumConstantsInGroupsForDescendants, cls.Name);
- end;
- end;
-
- -- Write the member variables:
- if (HasVariables) then
- cf:write("<a name=\"variables\"><hr /><h1>Member variables</h1></a>\n");
- WriteVariables(a_ClassAPI.Variables, nil);
- g_Stats.NumTotalVariables = g_Stats.NumTotalVariables + #a_ClassAPI.Variables;
- for _, cls in ipairs(InheritanceChain) do
- WriteVariables(cls.Variables, cls.Name);
- end;
- end
-
- -- Write the functions, including the inherited ones:
- if (HasFunctions) then
- cf:write("<a name=\"functions\"><hr /><h1>Functions</h1></a>\n");
- WriteFunctions(a_ClassAPI.Functions, nil);
- g_Stats.NumTotalFunctions = g_Stats.NumTotalFunctions + #a_ClassAPI.Functions;
- for _, cls in ipairs(InheritanceChain) do
- WriteFunctions(cls.Functions, cls.Name);
- end
- end
-
- -- Write the additional infos:
- if (a_ClassAPI.AdditionalInfo ~= nil) then
- for i, additional in ipairs(a_ClassAPI.AdditionalInfo) do
- cf:write("<a name=\"additionalinfo_", i, "\"><h1>", additional.Header, "</h1></a>\n");
- cf:write(LinkifyString(additional.Contents, ClassName));
- end
- end
-
- cf:write([[</td></tr></table></div><script>prettyPrint();</script>]])
- cf:write(GetHtmlTimestamp())
- cf:write([[</body></html>]])
- cf:close()
-end
-
-
-
-
-
-local function WriteClasses(f, a_API, a_ClassMenu)
- f:write([[
- <a name="classes"><h2>Class index</h2></a>
- <p>The following classes are available in the Cuberite Lua scripting language:
- <ul>
- ]]);
- for _, cls in ipairs(a_API) do
- f:write("<li><a href=\"", cls.Name, ".html\">", cls.Name, "</a></li>\n");
- WriteHtmlClass(cls, a_ClassMenu);
- end
- f:write([[
- </ul></p>
- <hr />
- ]]);
-end
-
-
-
-
-
---- Writes a list of undocumented objects into a file
-local function ListUndocumentedObjects(API, UndocumentedHooks)
- local f = io.open("API/_undocumented.lua", "w");
- if (f ~= nil) then
- f:write("\n-- This is the list of undocumented API objects, automatically generated by APIDump\n\n");
- f:write("g_APIDesc =\n{\n\tClasses =\n\t{\n");
- for _, cls in ipairs(API) do
- local HasFunctions = ((cls.UndocumentedFunctions ~= nil) and (#cls.UndocumentedFunctions > 0));
- local HasConstants = ((cls.UndocumentedConstants ~= nil) and (#cls.UndocumentedConstants > 0));
- local HasVariables = ((cls.UndocumentedVariables ~= nil) and (#cls.UndocumentedVariables > 0));
- g_Stats.NumUndocumentedFunctions = g_Stats.NumUndocumentedFunctions + #cls.UndocumentedFunctions;
- g_Stats.NumUndocumentedConstants = g_Stats.NumUndocumentedConstants + #cls.UndocumentedConstants;
- g_Stats.NumUndocumentedVariables = g_Stats.NumUndocumentedVariables + #cls.UndocumentedVariables;
- if (HasFunctions or HasConstants or HasVariables) then
- f:write("\t\t" .. cls.Name .. " =\n\t\t{\n");
- if ((cls.Desc == nil) or (cls.Desc == "")) then
- f:write("\t\t\tDesc = \"\"\n");
- end
- end
-
- if (HasFunctions) then
- f:write("\t\t\tFunctions =\n\t\t\t{\n");
- table.sort(cls.UndocumentedFunctions);
- for _, fn in ipairs(cls.UndocumentedFunctions) do
- f:write("\t\t\t\t" .. fn .. " = { Params = \"\", Return = \"\", Notes = \"\" },\n");
- end -- for j, fn - cls.UndocumentedFunctions[]
- f:write("\t\t\t},\n\n");
- end
-
- if (HasConstants) then
- f:write("\t\t\tConstants =\n\t\t\t{\n");
- table.sort(cls.UndocumentedConstants);
- for _, cn in ipairs(cls.UndocumentedConstants) do
- f:write("\t\t\t\t" .. cn .. " = { Notes = \"\" },\n");
- end -- for j, fn - cls.UndocumentedConstants[]
- f:write("\t\t\t},\n\n");
- end
-
- if (HasVariables) then
- f:write("\t\t\tVariables =\n\t\t\t{\n");
- table.sort(cls.UndocumentedVariables);
- for _, vn in ipairs(cls.UndocumentedVariables) do
- f:write("\t\t\t\t" .. vn .. " = { Type = \"\", Notes = \"\" },\n");
- end -- for j, fn - cls.UndocumentedVariables[]
- f:write("\t\t\t},\n\n");
- end
-
- if (HasFunctions or HasConstants or HasVariables) then
- f:write("\t\t},\n\n");
- end
- end -- for i, cls - API[]
- f:write("\t},\n");
-
- if (#UndocumentedHooks > 0) then
- f:write("\n\tHooks =\n\t{\n");
- for i, hook in ipairs(UndocumentedHooks) do
- if (i > 1) then
- f:write("\n");
- end
- f:write("\t\t" .. hook .. " =\n\t\t{\n");
- f:write("\t\t\tCalledWhen = \"\",\n");
- f:write("\t\t\tDefaultFnName = \"On\", -- also used as pagename\n");
- f:write("\t\t\tDesc = [[\n\t\t\t\t\n\t\t\t]],\n");
- f:write("\t\t\tParams =\n\t\t\t{\n");
- f:write("\t\t\t\t{ Name = \"\", Type = \"\", Notes = \"\" },\n");
- f:write("\t\t\t\t{ Name = \"\", Type = \"\", Notes = \"\" },\n");
- f:write("\t\t\t\t{ Name = \"\", Type = \"\", Notes = \"\" },\n");
- f:write("\t\t\t\t{ Name = \"\", Type = \"\", Notes = \"\" },\n");
- f:write("\t\t\t\t{ Name = \"\", Type = \"\", Notes = \"\" },\n");
- f:write("\t\t\t\t{ Name = \"\", Type = \"\", Notes = \"\" },\n");
- f:write("\t\t\t\t{ Name = \"\", Type = \"\", Notes = \"\" },\n");
- f:write("\t\t\t\t{ Name = \"\", Type = \"\", Notes = \"\" },\n");
- f:write("\t\t\t},\n");
- f:write("\t\t\tReturns = [[\n\t\t\t\t\n\t\t\t]],\n");
- f:write("\t\t}, -- " .. hook .. "\n");
- end
- f:write("\t},\n");
- end
- f:write("}\n\n\n\n");
- f:close();
- end
- g_Stats.NumUndocumentedHooks = #UndocumentedHooks;
-end
-
-
-
-
-
---- Lists the API objects that are documented but not available in the API:
-local function ListUnexportedObjects()
- f = io.open("API/_unexported-documented.txt", "w");
- if (f ~= nil) then
- for clsname, cls in pairs(g_APIDesc.Classes) do
- if not(cls.IsExported) then
- -- The whole class is not exported
- f:write("class\t" .. clsname .. "\n");
- else
- if (cls.Functions ~= nil) then
- for fnname, fnapi in pairs(cls.Functions) do
- if not(fnapi.IsExported) then
- f:write("func\t" .. clsname .. "." .. fnname .. "\n");
- end
- end -- for j, fn - cls.Functions[]
- end
- if (cls.Constants ~= nil) then
- for cnname, cnapi in pairs(cls.Constants) do
- if not(cnapi.IsExported) then
- f:write("const\t" .. clsname .. "." .. cnname .. "\n");
- end
- end -- for j, fn - cls.Functions[]
- end
- end
- end -- for i, cls - g_APIDesc.Classes[]
- f:close();
- end
-end
-
-
-
-
-
-local function ListMissingPages()
- local MissingPages = {};
- local NumLinks = 0;
- for PageName, Referrers in pairs(g_TrackedPages) do
- NumLinks = NumLinks + 1;
- if not(cFile:Exists("API/" .. PageName .. ".html")) then
- table.insert(MissingPages, {Name = PageName, Refs = Referrers} );
- end
- end;
- g_Stats.NumTrackedLinks = NumLinks;
- g_TrackedPages = {};
-
- if (#MissingPages == 0) then
- -- No missing pages, congratulations!
- return;
- end
-
- -- Sort the pages by name:
- table.sort(MissingPages,
- function (Page1, Page2)
- return (Page1.Name < Page2.Name);
- end
- );
-
- -- Output the pages:
- local f, err = io.open("API/_missingPages.txt", "w");
- if (f == nil) then
- LOGWARNING("Cannot open _missingPages.txt for writing: '" .. err .. "'. There are " .. #MissingPages .. " pages missing.");
- return;
- end
- for _, pg in ipairs(MissingPages) do
- f:write(pg.Name .. ":\n");
- -- Sort and output the referrers:
- table.sort(pg.Refs);
- f:write("\t" .. table.concat(pg.Refs, "\n\t"));
- f:write("\n\n");
- end
- f:close();
- g_Stats.NumInvalidLinks = #MissingPages;
-end
-
-
-
-
-
---- Writes the documentation statistics (in g_Stats) into the given HTML file
-local function WriteStats(f)
- local function ExportMeter(a_Percent)
- local Color;
- if (a_Percent > 99) then
- Color = "green";
- elseif (a_Percent > 50) then
- Color = "orange";
- else
- Color = "red";
- end
-
- local meter = {
- "\n",
- "<div style=\"background-color: black; padding: 1px; width: 100px\">\n",
- "<div style=\"background-color: ",
- Color,
- "; width: ",
- a_Percent,
- "%; height: 16px\"></div></div>\n</td><td>",
- string.format("%.2f", a_Percent),
- " %",
- };
- return table.concat(meter, "");
- end
-
- f:write([[
- <hr /><a name="docstats"><h2>Documentation statistics</h2></a>
- <table><tr><th>Object</th><th>Total</th><th>Documented</th><th>Undocumented</th><th colspan="2">Documented %</th></tr>
- ]]);
- f:write("<tr><td>Classes</td><td>", g_Stats.NumTotalClasses);
- f:write("</td><td>", g_Stats.NumTotalClasses - g_Stats.NumUndocumentedClasses);
- f:write("</td><td>", g_Stats.NumUndocumentedClasses);
- f:write("</td><td>", ExportMeter(100 * (g_Stats.NumTotalClasses - g_Stats.NumUndocumentedClasses) / g_Stats.NumTotalClasses));
- f:write("</td></tr>\n");
-
- f:write("<tr><td>Functions</td><td>", g_Stats.NumTotalFunctions);
- f:write("</td><td>", g_Stats.NumTotalFunctions - g_Stats.NumUndocumentedFunctions);
- f:write("</td><td>", g_Stats.NumUndocumentedFunctions);
- f:write("</td><td>", ExportMeter(100 * (g_Stats.NumTotalFunctions - g_Stats.NumUndocumentedFunctions) / g_Stats.NumTotalFunctions));
- f:write("</td></tr>\n");
-
- f:write("<tr><td>Member variables</td><td>", g_Stats.NumTotalVariables);
- f:write("</td><td>", g_Stats.NumTotalVariables - g_Stats.NumUndocumentedVariables);
- f:write("</td><td>", g_Stats.NumUndocumentedVariables);
- f:write("</td><td>", ExportMeter(100 * (g_Stats.NumTotalVariables - g_Stats.NumUndocumentedVariables) / g_Stats.NumTotalVariables));
- f:write("</td></tr>\n");
-
- f:write("<tr><td>Constants</td><td>", g_Stats.NumTotalConstants);
- f:write("</td><td>", g_Stats.NumTotalConstants - g_Stats.NumUndocumentedConstants);
- f:write("</td><td>", g_Stats.NumUndocumentedConstants);
- f:write("</td><td>", ExportMeter(100 * (g_Stats.NumTotalConstants - g_Stats.NumUndocumentedConstants) / g_Stats.NumTotalConstants));
- f:write("</td></tr>\n");
-
- f:write("<tr><td>Hooks</td><td>", g_Stats.NumTotalHooks);
- f:write("</td><td>", g_Stats.NumTotalHooks - g_Stats.NumUndocumentedHooks);
- f:write("</td><td>", g_Stats.NumUndocumentedHooks);
- f:write("</td><td>", ExportMeter(100 * (g_Stats.NumTotalHooks - g_Stats.NumUndocumentedHooks) / g_Stats.NumTotalHooks));
- f:write("</td></tr>\n");
-
- f:write([[
- </table>
- <p>There are ]], g_Stats.NumTrackedLinks, " internal links, ", g_Stats.NumInvalidLinks, " of them are invalid.</p>"
- );
-end
-
-
-
-
-
-local function DumpAPIHtml(a_API)
- LOG("Dumping all available functions and constants to API subfolder...");
-
- -- Create the output folder
- if not(cFile:IsFolder("API")) then
- cFile:CreateFolder("API");
- end
-
- LOG("Copying static files..");
- cFile:CreateFolder("API/Static");
- local localFolder = g_Plugin:GetLocalFolder();
- for _, fnam in ipairs(cFile:GetFolderContents(localFolder .. "/Static")) do
- cFile:Delete("API/Static/" .. fnam);
- cFile:Copy(localFolder .. "/Static/" .. fnam, "API/Static/" .. fnam);
- end
-
- -- Extract hook constants:
- local Hooks = {};
- local UndocumentedHooks = {};
- for name, obj in pairs(cPluginManager) do
- if (
- (type(obj) == "number") and
- name:match("HOOK_.*") and
- (name ~= "HOOK_MAX") and
- (name ~= "HOOK_NUM_HOOKS")
- ) then
- table.insert(Hooks, { Name = name });
- end
- end
- table.sort(Hooks,
- function(Hook1, Hook2)
- return (Hook1.Name < Hook2.Name);
- end
- );
- ReadHooks(Hooks);
-
- -- Create a "class index" file, write each class as a link to that file,
- -- then dump class contents into class-specific file
- LOG("Writing HTML files...");
- local f, err = io.open("API/index.html", "w");
- if (f == nil) then
- LOGINFO("Cannot output HTML API: " .. err);
- return;
- end
-
- -- Create a class navigation menu that will be inserted into each class file for faster navigation (#403)
- local ClassMenuTab = {};
- for _, cls in ipairs(a_API) do
- table.insert(ClassMenuTab, "<a href='");
- table.insert(ClassMenuTab, cls.Name);
- table.insert(ClassMenuTab, ".html'>");
- table.insert(ClassMenuTab, cls.Name);
- table.insert(ClassMenuTab, "</a><br />");
- end
- local ClassMenu = table.concat(ClassMenuTab, "");
-
- -- Create a hook navigation menu that will be inserted into each hook file for faster navigation(#403)
- local HookNavTab = {};
- for _, hook in ipairs(Hooks) do
- table.insert(HookNavTab, "<a href='");
- table.insert(HookNavTab, hook.DefaultFnName);
- table.insert(HookNavTab, ".html'>");
- table.insert(HookNavTab, (hook.Name:gsub("^HOOK_", ""))); -- remove the "HOOK_" part of the name
- table.insert(HookNavTab, "</a><br />");
- end
- local HookNav = table.concat(HookNavTab, "");
-
- -- Write the HTML file:
- f:write([[<!DOCTYPE html>
- <html>
- <head>
- <title>Cuberite API - Index</title>
- <link rel="stylesheet" type="text/css" href="main.css" />
- </head>
- <body>
- <div id="content">
- <header>
- <h1>Cuberite API - Index</h1>
- <hr />
- </header>
- <p>The API reference is divided into the following sections:</p>
- <ul>
- <li><a href="#articles">Articles</a></li>
- <li><a href="#classes">Class index</a></li>
- <li><a href="#hooks">Hooks</a></li>
- <li><a href="#docstats">Documentation statistics</a></li>
- </ul>
- <hr />
- ]]);
-
- WriteArticles(f);
- WriteClasses(f, a_API, ClassMenu);
- WriteHooks(f, Hooks, UndocumentedHooks, HookNav);
-
- -- Copy the static files to the output folder:
- local StaticFiles =
- {
- "main.css",
- "prettify.js",
- "prettify.css",
- "lang-lua.js",
- };
- for _, fnam in ipairs(StaticFiles) do
- cFile:Delete("API/" .. fnam);
- cFile:Copy(g_Plugin:GetLocalFolder() .. "/" .. fnam, "API/" .. fnam);
- end
-
- -- List the documentation problems:
- LOG("Listing leftovers...");
- ListUndocumentedObjects(a_API, UndocumentedHooks);
- ListUnexportedObjects();
- ListMissingPages();
-
- WriteStats(f);
-
- f:write([[</ul></div>]])
- f:write(GetHtmlTimestamp())
- f:write([[</body></html>]])
- f:close()
-
- LOG("API subfolder written");
-end
-
-
-
-
-
---- Returns the string with extra tabs and CR/LFs removed
-local function CleanUpDescription(a_Desc)
- -- Get rid of indent and newlines, normalize whitespace:
- local res = a_Desc:gsub("[\n\t]", "")
- res = a_Desc:gsub("%s%s+", " ")
-
- -- Replace paragraph marks with newlines:
- res = res:gsub("<p>", "\n")
- res = res:gsub("</p>", "")
-
- -- Replace list items with dashes:
- res = res:gsub("</?ul>", "")
- res = res:gsub("<li>", "\n - ")
- res = res:gsub("</li>", "")
-
- return res
-end
-
-
-
-
-
---- Writes a list of methods into the specified file in ZBS format
-local function WriteZBSMethods(f, a_Methods)
- for _, func in ipairs(a_Methods or {}) do
- f:write("\t\t\t[\"", func.Name, "\"] =\n")
- f:write("\t\t\t{\n")
- f:write("\t\t\t\ttype = \"method\",\n")
- if ((func.Notes ~= nil) and (func.Notes ~= "")) then
- f:write("\t\t\t\tdescription = [[", CleanUpDescription(func.Notes or ""), " ]],\n")
- end
- f:write("\t\t\t},\n")
- end
-end
-
-
-
-
-
---- Writes a list of constants into the specified file in ZBS format
-local function WriteZBSConstants(f, a_Constants)
- for _, cons in ipairs(a_Constants or {}) do
- f:write("\t\t\t[\"", cons.Name, "\"] =\n")
- f:write("\t\t\t{\n")
- f:write("\t\t\t\ttype = \"value\",\n")
- if ((cons.Desc ~= nil) and (cons.Desc ~= "")) then
- f:write("\t\t\t\tdescription = [[", CleanUpDescription(cons.Desc or ""), " ]],\n")
- end
- f:write("\t\t\t},\n")
- end
-end
-
-
-
-
-
---- Writes one Cuberite class definition into the specified file in ZBS format
-local function WriteZBSClass(f, a_Class)
- assert(type(a_Class) == "table")
-
- -- Write class header:
- f:write("\t", a_Class.Name, " =\n\t{\n")
- f:write("\t\ttype = \"class\",\n")
- f:write("\t\tdescription = [[", CleanUpDescription(a_Class.Desc or ""), " ]],\n")
- f:write("\t\tchilds =\n")
- f:write("\t\t{\n")
-
- -- Export methods and constants:
- WriteZBSMethods(f, a_Class.Functions)
- WriteZBSConstants(f, a_Class.Constants)
-
- -- Finish the class definition:
- f:write("\t\t},\n")
- f:write("\t},\n\n")
-end
-
-
-
-
-
---- Dumps the entire API table into a file in the ZBS format
-local function DumpAPIZBS(a_API)
- LOG("Dumping ZBS API description...")
- local f, err = io.open("mcserver_api.lua", "w")
- if (f == nil) then
- LOG("Cannot open mcserver_lua.lua for writing, ZBS API will not be dumped. " .. err)
- return
- end
-
- -- Write the file header:
- f:write("-- This is a Cuberite API file automatically generated by the APIDump plugin\n")
- f:write("-- Note that any manual changes will be overwritten by the next dump\n\n")
- f:write("return {\n")
-
- -- Export each class except Globals, store those aside:
- local Globals
- for _, cls in ipairs(a_API) do
- if (cls.Name ~= "Globals") then
- WriteZBSClass(f, cls)
- else
- Globals = cls
- end
- end
-
- -- Export the globals:
- if (Globals) then
- WriteZBSMethods(f, Globals.Functions)
- WriteZBSConstants(f, Globals.Constants)
- end
-
- -- Finish the file:
- f:write("}\n")
- f:close()
- LOG("ZBS API dumped...")
-end
-
-
-
-
-
---- Returns true if a_Descendant is declared to be a (possibly indirect) descendant of a_Base
-local function IsDeclaredDescendant(a_DescendantName, a_BaseName, a_API)
- -- Check params:
- assert(type(a_DescendantName) == "string")
- assert(type(a_BaseName) == "string")
- assert(type(a_API) == "table")
- if not(a_API[a_BaseName]) then
- return false
- end
- assert(type(a_API[a_BaseName]) == "table", "Not a class name: " .. a_BaseName)
- assert(type(a_API[a_BaseName].Descendants) == "table")
-
- -- Check direct inheritance:
- for _, desc in ipairs(a_API[a_BaseName].Descendants) do
- if (desc.Name == a_DescendantName) then
- return true
- end
- end -- for desc - a_BaseName's descendants
-
- -- Check indirect inheritance:
- for _, desc in ipairs(a_API[a_BaseName].Descendants) do
- if (IsDeclaredDescendant(a_DescendantName, desc.Name, a_API)) then
- return true
- end
- end -- for desc - a_BaseName's descendants
-
- return false
-end
-
-
-
-
-
---- Checks the specified class' inheritance
--- Reports any problems as new items in the a_Report table
-local function CheckClassInheritance(a_Class, a_API, a_Report)
- -- Check params:
- assert(type(a_Class) == "table")
- assert(type(a_API) == "table")
- assert(type(a_Report) == "table")
-
- -- Check that the declared descendants are really descendants:
- local registry = debug.getregistry()
- for _, desc in ipairs(a_Class.Descendants or {}) do
- local isParent = false
- local parents = registry["tolua_super"][_G[desc.Name]]
- if not(parents[a_Class.Name]) then
- table.insert(a_Report, desc.Name .. " is not a descendant of " .. a_Class.Name)
- end
- end -- for desc - a_Class.Descendants[]
-
- -- Check that all inheritance is listed for the class:
- local parents = registry["tolua_super"][_G[a_Class.Name]] -- map of "classname" -> true for each class that a_Class inherits
- for clsName, isParent in pairs(parents or {}) do
- if ((clsName ~= "") and not(clsName:match("const .*"))) then
- if not(IsDeclaredDescendant(a_Class.Name, clsName, a_API)) then
- table.insert(a_Report, a_Class.Name .. " inherits from " .. clsName .. " but this isn't documented")
- end
- end
- end
-end
-
-
-
-
-
---- Checks each class's declared inheritance versus the actual inheritance
-local function CheckAPIDescendants(a_API)
- -- Check each class:
- local report = {}
- for _, cls in ipairs(a_API) do
- if (cls.Name ~= "Globals") then
- CheckClassInheritance(cls, a_API, report)
- end
- end
-
- -- If there's anything to report, output it to a file:
- if (report[1] ~= nil) then
- LOG("There are inheritance errors in the API description:")
- for _, msg in ipairs(report) do
- LOG(" " .. msg)
- end
-
- local f, err = io.open("API/_inheritance_errors.txt", "w")
- if (f == nil) then
- LOG("Cannot report inheritance problems to a file: " .. tostring(err))
- return
- end
- f:write(table.concat(report, "\n"))
- f:close()
- end
-end
-
-
-
-
-
-local function DumpApi()
- LOG("Dumping the API...")
-
- -- Load the API descriptions from the Classes and Hooks subfolders:
- -- This needs to be done each time the command is invoked because the export modifies the tables' contents
- dofile(g_PluginFolder .. "/APIDesc.lua")
- if (g_APIDesc.Classes == nil) then
- g_APIDesc.Classes = {};
- end
- if (g_APIDesc.Hooks == nil) then
- g_APIDesc.Hooks = {};
- end
- LoadAPIFiles("/Classes/", g_APIDesc.Classes);
- LoadAPIFiles("/Hooks/", g_APIDesc.Hooks);
-
- -- Reset the stats:
- g_TrackedPages = {}; -- List of tracked pages, to be checked later whether they exist. Each item is an array of referring pagenames.
- g_Stats = -- Statistics about the documentation
- {
- NumTotalClasses = 0,
- NumUndocumentedClasses = 0,
- NumTotalFunctions = 0,
- NumUndocumentedFunctions = 0,
- NumTotalConstants = 0,
- NumUndocumentedConstants = 0,
- NumTotalVariables = 0,
- NumUndocumentedVariables = 0,
- NumTotalHooks = 0,
- NumUndocumentedHooks = 0,
- NumTrackedLinks = 0,
- NumInvalidLinks = 0,
- }
-
- -- Create the API tables:
- local API, Globals = CreateAPITables();
-
- -- Sort the classes by name:
- table.sort(API,
- function (c1, c2)
- return (string.lower(c1.Name) < string.lower(c2.Name));
- end
- );
- g_Stats.NumTotalClasses = #API;
-
- -- Add Globals into the API:
- Globals.Name = "Globals";
- table.insert(API, Globals);
-
- -- Read in the descriptions:
- LOG("Reading descriptions...");
- ReadDescriptions(API);
-
- -- Check that the API lists the inheritance properly, report any problems to a file:
- CheckAPIDescendants(API)
-
- -- Dump all available API objects in HTML format into a subfolder:
- DumpAPIHtml(API);
-
- -- Dump all available API objects in format used by ZeroBraneStudio API descriptions:
- DumpAPIZBS(API)
-
- LOG("APIDump finished");
- return true
-end
-
-
-
-
-
-local function HandleWebAdminDump(a_Request)
- if (a_Request.PostParams["Dump"] ~= nil) then
- DumpApi()
- end
- return
- [[
- <p>Pressing the button will generate the API dump on the server. Note that this can take some time.</p>
- <form method="POST"><input type="submit" name="Dump" value="Dump the API"/></form>
- ]]
-end
-
-
-
-
-
-local function HandleCmdApi(a_Split)
- DumpApi()
- return true
-end
-
-
-
-
-
-local function HandleCmdApiShow(a_Split, a_EntireCmd)
- os.execute("API" .. cFile:GetPathSeparator() .. "index.html")
- return true, "Launching the browser to show the API docs..."
-end
-
-
-
-
-
-function Initialize(Plugin)
- g_Plugin = Plugin;
- g_PluginFolder = Plugin:GetLocalFolder();
-
- LOG("Initialising " .. Plugin:GetName() .. " v." .. Plugin:GetVersion())
-
- -- Bind a console command to dump the API:
- cPluginManager:BindConsoleCommand("api", HandleCmdApi, "Dumps the Lua API docs into the API/ subfolder")
- cPluginManager:BindConsoleCommand("apishow", HandleCmdApiShow, "Runs the default browser to show the API docs")
-
- -- Add a WebAdmin tab that has a Dump button
- g_Plugin:AddWebTab("APIDump", HandleWebAdminDump)
-
- return true
-end
diff --git a/MCServer/Plugins/APIDump/prettify.css b/MCServer/Plugins/APIDump/prettify.css
deleted file mode 100644
index d44b3a228..000000000
--- a/MCServer/Plugins/APIDump/prettify.css
+++ /dev/null
@@ -1 +0,0 @@
-.pln{color:#000}@media screen{.str{color:#080}.kwd{color:#008}.com{color:#800}.typ{color:#606}.lit{color:#066}.pun,.opn,.clo{color:#660}.tag{color:#008}.atn{color:#606}.atv{color:#080}.dec,.var{color:#606}.fun{color:red}}@media print,projection{.str{color:#060}.kwd{color:#006;font-weight:bold}.com{color:#600;font-style:italic}.typ{color:#404;font-weight:bold}.lit{color:#044}.pun,.opn,.clo{color:#440}.tag{color:#006;font-weight:bold}.atn{color:#404}.atv{color:#060}}pre.prettyprint{padding:2px;border:1px solid #888}ol.linenums{margin-top:0;margin-bottom:0}li.L0,li.L1,li.L2,li.L3,li.L5,li.L6,li.L7,li.L8{list-style-type:none}li.L1,li.L3,li.L5,li.L7,li.L9{background:#eee} \ No newline at end of file
diff --git a/MCServer/Plugins/APIDump/prettify.js b/MCServer/Plugins/APIDump/prettify.js
deleted file mode 100644
index 7b990496d..000000000
--- a/MCServer/Plugins/APIDump/prettify.js
+++ /dev/null
@@ -1,30 +0,0 @@
-!function(){var q=null;window.PR_SHOULD_USE_CONTINUATION=!0;
-(function(){function S(a){function d(e){var b=e.charCodeAt(0);if(b!==92)return b;var a=e.charAt(1);return(b=r[a])?b:"0"<=a&&a<="7"?parseInt(e.substring(1),8):a==="u"||a==="x"?parseInt(e.substring(2),16):e.charCodeAt(1)}function g(e){if(e<32)return(e<16?"\\x0":"\\x")+e.toString(16);e=String.fromCharCode(e);return e==="\\"||e==="-"||e==="]"||e==="^"?"\\"+e:e}function b(e){var b=e.substring(1,e.length-1).match(/\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\[0-3][0-7]{0,2}|\\[0-7]{1,2}|\\[\S\s]|[^\\]/g),e=[],a=
-b[0]==="^",c=["["];a&&c.push("^");for(var a=a?1:0,f=b.length;a<f;++a){var h=b[a];if(/\\[bdsw]/i.test(h))c.push(h);else{var h=d(h),l;a+2<f&&"-"===b[a+1]?(l=d(b[a+2]),a+=2):l=h;e.push([h,l]);l<65||h>122||(l<65||h>90||e.push([Math.max(65,h)|32,Math.min(l,90)|32]),l<97||h>122||e.push([Math.max(97,h)&-33,Math.min(l,122)&-33]))}}e.sort(function(e,a){return e[0]-a[0]||a[1]-e[1]});b=[];f=[];for(a=0;a<e.length;++a)h=e[a],h[0]<=f[1]+1?f[1]=Math.max(f[1],h[1]):b.push(f=h);for(a=0;a<b.length;++a)h=b[a],c.push(g(h[0])),
-h[1]>h[0]&&(h[1]+1>h[0]&&c.push("-"),c.push(g(h[1])));c.push("]");return c.join("")}function s(e){for(var a=e.source.match(/\[(?:[^\\\]]|\\[\S\s])*]|\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\\d+|\\[^\dux]|\(\?[!:=]|[()^]|[^()[\\^]+/g),c=a.length,d=[],f=0,h=0;f<c;++f){var l=a[f];l==="("?++h:"\\"===l.charAt(0)&&(l=+l.substring(1))&&(l<=h?d[l]=-1:a[f]=g(l))}for(f=1;f<d.length;++f)-1===d[f]&&(d[f]=++x);for(h=f=0;f<c;++f)l=a[f],l==="("?(++h,d[h]||(a[f]="(?:")):"\\"===l.charAt(0)&&(l=+l.substring(1))&&l<=h&&
-(a[f]="\\"+d[l]);for(f=0;f<c;++f)"^"===a[f]&&"^"!==a[f+1]&&(a[f]="");if(e.ignoreCase&&m)for(f=0;f<c;++f)l=a[f],e=l.charAt(0),l.length>=2&&e==="["?a[f]=b(l):e!=="\\"&&(a[f]=l.replace(/[A-Za-z]/g,function(a){a=a.charCodeAt(0);return"["+String.fromCharCode(a&-33,a|32)+"]"}));return a.join("")}for(var x=0,m=!1,j=!1,k=0,c=a.length;k<c;++k){var i=a[k];if(i.ignoreCase)j=!0;else if(/[a-z]/i.test(i.source.replace(/\\u[\da-f]{4}|\\x[\da-f]{2}|\\[^UXux]/gi,""))){m=!0;j=!1;break}}for(var r={b:8,t:9,n:10,v:11,
-f:12,r:13},n=[],k=0,c=a.length;k<c;++k){i=a[k];if(i.global||i.multiline)throw Error(""+i);n.push("(?:"+s(i)+")")}return RegExp(n.join("|"),j?"gi":"g")}function T(a,d){function g(a){var c=a.nodeType;if(c==1){if(!b.test(a.className)){for(c=a.firstChild;c;c=c.nextSibling)g(c);c=a.nodeName.toLowerCase();if("br"===c||"li"===c)s[j]="\n",m[j<<1]=x++,m[j++<<1|1]=a}}else if(c==3||c==4)c=a.nodeValue,c.length&&(c=d?c.replace(/\r\n?/g,"\n"):c.replace(/[\t\n\r ]+/g," "),s[j]=c,m[j<<1]=x,x+=c.length,m[j++<<1|1]=
-a)}var b=/(?:^|\s)nocode(?:\s|$)/,s=[],x=0,m=[],j=0;g(a);return{a:s.join("").replace(/\n$/,""),d:m}}function H(a,d,g,b){d&&(a={a:d,e:a},g(a),b.push.apply(b,a.g))}function U(a){for(var d=void 0,g=a.firstChild;g;g=g.nextSibling)var b=g.nodeType,d=b===1?d?a:g:b===3?V.test(g.nodeValue)?a:d:d;return d===a?void 0:d}function C(a,d){function g(a){for(var j=a.e,k=[j,"pln"],c=0,i=a.a.match(s)||[],r={},n=0,e=i.length;n<e;++n){var z=i[n],w=r[z],t=void 0,f;if(typeof w==="string")f=!1;else{var h=b[z.charAt(0)];
-if(h)t=z.match(h[1]),w=h[0];else{for(f=0;f<x;++f)if(h=d[f],t=z.match(h[1])){w=h[0];break}t||(w="pln")}if((f=w.length>=5&&"lang-"===w.substring(0,5))&&!(t&&typeof t[1]==="string"))f=!1,w="src";f||(r[z]=w)}h=c;c+=z.length;if(f){f=t[1];var l=z.indexOf(f),B=l+f.length;t[2]&&(B=z.length-t[2].length,l=B-f.length);w=w.substring(5);H(j+h,z.substring(0,l),g,k);H(j+h+l,f,I(w,f),k);H(j+h+B,z.substring(B),g,k)}else k.push(j+h,w)}a.g=k}var b={},s;(function(){for(var g=a.concat(d),j=[],k={},c=0,i=g.length;c<i;++c){var r=
-g[c],n=r[3];if(n)for(var e=n.length;--e>=0;)b[n.charAt(e)]=r;r=r[1];n=""+r;k.hasOwnProperty(n)||(j.push(r),k[n]=q)}j.push(/[\S\s]/);s=S(j)})();var x=d.length;return g}function v(a){var d=[],g=[];a.tripleQuotedStrings?d.push(["str",/^(?:'''(?:[^'\\]|\\[\S\s]|''?(?=[^']))*(?:'''|$)|"""(?:[^"\\]|\\[\S\s]|""?(?=[^"]))*(?:"""|$)|'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$))/,q,"'\""]):a.multiLineStrings?d.push(["str",/^(?:'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$)|`(?:[^\\`]|\\[\S\s])*(?:`|$))/,
-q,"'\"`"]):d.push(["str",/^(?:'(?:[^\n\r'\\]|\\.)*(?:'|$)|"(?:[^\n\r"\\]|\\.)*(?:"|$))/,q,"\"'"]);a.verbatimStrings&&g.push(["str",/^@"(?:[^"]|"")*(?:"|$)/,q]);var b=a.hashComments;b&&(a.cStyleComments?(b>1?d.push(["com",/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,q,"#"]):d.push(["com",/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\n\r]*)/,q,"#"]),g.push(["str",/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,q])):d.push(["com",
-/^#[^\n\r]*/,q,"#"]));a.cStyleComments&&(g.push(["com",/^\/\/[^\n\r]*/,q]),g.push(["com",/^\/\*[\S\s]*?(?:\*\/|$)/,q]));if(b=a.regexLiterals){var s=(b=b>1?"":"\n\r")?".":"[\\S\\s]";g.push(["lang-regex",RegExp("^(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*("+("/(?=[^/*"+b+"])(?:[^/\\x5B\\x5C"+b+"]|\\x5C"+s+"|\\x5B(?:[^\\x5C\\x5D"+b+"]|\\x5C"+
-s+")*(?:\\x5D|$))+/")+")")])}(b=a.types)&&g.push(["typ",b]);b=(""+a.keywords).replace(/^ | $/g,"");b.length&&g.push(["kwd",RegExp("^(?:"+b.replace(/[\s,]+/g,"|")+")\\b"),q]);d.push(["pln",/^\s+/,q," \r\n\t\u00a0"]);b="^.[^\\s\\w.$@'\"`/\\\\]*";a.regexLiterals&&(b+="(?!s*/)");g.push(["lit",/^@[$_a-z][\w$@]*/i,q],["typ",/^(?:[@_]?[A-Z]+[a-z][\w$@]*|\w+_t\b)/,q],["pln",/^[$_a-z][\w$@]*/i,q],["lit",/^(?:0x[\da-f]+|(?:\d(?:_\d+)*\d*(?:\.\d*)?|\.\d\+)(?:e[+-]?\d+)?)[a-z]*/i,q,"0123456789"],["pln",/^\\[\S\s]?/,
-q],["pun",RegExp(b),q]);return C(d,g)}function J(a,d,g){function b(a){var c=a.nodeType;if(c==1&&!x.test(a.className))if("br"===a.nodeName)s(a),a.parentNode&&a.parentNode.removeChild(a);else for(a=a.firstChild;a;a=a.nextSibling)b(a);else if((c==3||c==4)&&g){var d=a.nodeValue,i=d.match(m);if(i)c=d.substring(0,i.index),a.nodeValue=c,(d=d.substring(i.index+i[0].length))&&a.parentNode.insertBefore(j.createTextNode(d),a.nextSibling),s(a),c||a.parentNode.removeChild(a)}}function s(a){function b(a,c){var d=
-c?a.cloneNode(!1):a,e=a.parentNode;if(e){var e=b(e,1),g=a.nextSibling;e.appendChild(d);for(var i=g;i;i=g)g=i.nextSibling,e.appendChild(i)}return d}for(;!a.nextSibling;)if(a=a.parentNode,!a)return;for(var a=b(a.nextSibling,0),d;(d=a.parentNode)&&d.nodeType===1;)a=d;c.push(a)}for(var x=/(?:^|\s)nocode(?:\s|$)/,m=/\r\n?|\n/,j=a.ownerDocument,k=j.createElement("li");a.firstChild;)k.appendChild(a.firstChild);for(var c=[k],i=0;i<c.length;++i)b(c[i]);d===(d|0)&&c[0].setAttribute("value",d);var r=j.createElement("ol");
-r.className="linenums";for(var d=Math.max(0,d-1|0)||0,i=0,n=c.length;i<n;++i)k=c[i],k.className="L"+(i+d)%10,k.firstChild||k.appendChild(j.createTextNode("\u00a0")),r.appendChild(k);a.appendChild(r)}function p(a,d){for(var g=d.length;--g>=0;){var b=d[g];F.hasOwnProperty(b)?D.console&&console.warn("cannot override language handler %s",b):F[b]=a}}function I(a,d){if(!a||!F.hasOwnProperty(a))a=/^\s*</.test(d)?"default-markup":"default-code";return F[a]}function K(a){var d=a.h;try{var g=T(a.c,a.i),b=g.a;
-a.a=b;a.d=g.d;a.e=0;I(d,b)(a);var s=/\bMSIE\s(\d+)/.exec(navigator.userAgent),s=s&&+s[1]<=8,d=/\n/g,x=a.a,m=x.length,g=0,j=a.d,k=j.length,b=0,c=a.g,i=c.length,r=0;c[i]=m;var n,e;for(e=n=0;e<i;)c[e]!==c[e+2]?(c[n++]=c[e++],c[n++]=c[e++]):e+=2;i=n;for(e=n=0;e<i;){for(var p=c[e],w=c[e+1],t=e+2;t+2<=i&&c[t+1]===w;)t+=2;c[n++]=p;c[n++]=w;e=t}c.length=n;var f=a.c,h;if(f)h=f.style.display,f.style.display="none";try{for(;b<k;){var l=j[b+2]||m,B=c[r+2]||m,t=Math.min(l,B),A=j[b+1],G;if(A.nodeType!==1&&(G=x.substring(g,
-t))){s&&(G=G.replace(d,"\r"));A.nodeValue=G;var L=A.ownerDocument,o=L.createElement("span");o.className=c[r+1];var v=A.parentNode;v.replaceChild(o,A);o.appendChild(A);g<l&&(j[b+1]=A=L.createTextNode(x.substring(t,l)),v.insertBefore(A,o.nextSibling))}g=t;g>=l&&(b+=2);g>=B&&(r+=2)}}finally{if(f)f.style.display=h}}catch(u){D.console&&console.log(u&&u.stack||u)}}var D=window,y=["break,continue,do,else,for,if,return,while"],E=[[y,"auto,case,char,const,default,double,enum,extern,float,goto,inline,int,long,register,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"],
-"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],M=[E,"alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,delegate,dynamic_cast,explicit,export,friend,generic,late_check,mutable,namespace,nullptr,property,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],N=[E,"abstract,assert,boolean,byte,extends,final,finally,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],
-O=[N,"as,base,by,checked,decimal,delegate,descending,dynamic,event,fixed,foreach,from,group,implicit,in,internal,into,is,let,lock,object,out,override,orderby,params,partial,readonly,ref,sbyte,sealed,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,var,virtual,where"],E=[E,"debugger,eval,export,function,get,null,set,undefined,var,with,Infinity,NaN"],P=[y,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"],
-Q=[y,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"],W=[y,"as,assert,const,copy,drop,enum,extern,fail,false,fn,impl,let,log,loop,match,mod,move,mut,priv,pub,pure,ref,self,static,struct,true,trait,type,unsafe,use"],y=[y,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],R=/^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,
-V=/\S/,X=v({keywords:[M,O,E,"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",P,Q,y],hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0}),F={};p(X,["default-code"]);p(C([],[["pln",/^[^<?]+/],["dec",/^<!\w[^>]*(?:>|$)/],["com",/^<\!--[\S\s]*?(?:--\>|$)/],["lang-",/^<\?([\S\s]+?)(?:\?>|$)/],["lang-",/^<%([\S\s]+?)(?:%>|$)/],["pun",/^(?:<[%?]|[%?]>)/],["lang-",
-/^<xmp\b[^>]*>([\S\s]+?)<\/xmp\b[^>]*>/i],["lang-js",/^<script\b[^>]*>([\S\s]*?)(<\/script\b[^>]*>)/i],["lang-css",/^<style\b[^>]*>([\S\s]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup","htm","html","mxml","xhtml","xml","xsl"]);p(C([["pln",/^\s+/,q," \t\r\n"],["atv",/^(?:"[^"]*"?|'[^']*'?)/,q,"\"'"]],[["tag",/^^<\/?[a-z](?:[\w-.:]*\w)?|\/?>$/i],["atn",/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^\s"'>]*(?:[^\s"'/>]|\/(?=\s)))/],["pun",/^[/<->]+/],
-["lang-js",/^on\w+\s*=\s*"([^"]+)"/i],["lang-js",/^on\w+\s*=\s*'([^']+)'/i],["lang-js",/^on\w+\s*=\s*([^\s"'>]+)/i],["lang-css",/^style\s*=\s*"([^"]+)"/i],["lang-css",/^style\s*=\s*'([^']+)'/i],["lang-css",/^style\s*=\s*([^\s"'>]+)/i]]),["in.tag"]);p(C([],[["atv",/^[\S\s]+/]]),["uq.val"]);p(v({keywords:M,hashComments:!0,cStyleComments:!0,types:R}),["c","cc","cpp","cxx","cyc","m"]);p(v({keywords:"null,true,false"}),["json"]);p(v({keywords:O,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:R}),
-["cs"]);p(v({keywords:N,cStyleComments:!0}),["java"]);p(v({keywords:y,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]);p(v({keywords:P,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]);p(v({keywords:"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]);p(v({keywords:Q,
-hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]);p(v({keywords:E,cStyleComments:!0,regexLiterals:!0}),["javascript","js"]);p(v({keywords:"all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,throw,true,try,unless,until,when,while,yes",hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]);p(v({keywords:W,cStyleComments:!0,multilineStrings:!0}),["rc","rs","rust"]);
-p(C([],[["str",/^[\S\s]+/]]),["regex"]);var Y=D.PR={createSimpleLexer:C,registerLangHandler:p,sourceDecorator:v,PR_ATTRIB_NAME:"atn",PR_ATTRIB_VALUE:"atv",PR_COMMENT:"com",PR_DECLARATION:"dec",PR_KEYWORD:"kwd",PR_LITERAL:"lit",PR_NOCODE:"nocode",PR_PLAIN:"pln",PR_PUNCTUATION:"pun",PR_SOURCE:"src",PR_STRING:"str",PR_TAG:"tag",PR_TYPE:"typ",prettyPrintOne:D.prettyPrintOne=function(a,d,g){var b=document.createElement("div");b.innerHTML="<pre>"+a+"</pre>";b=b.firstChild;g&&J(b,g,!0);K({h:d,j:g,c:b,i:1});
-return b.innerHTML},prettyPrint:D.prettyPrint=function(a,d){function g(){for(var b=D.PR_SHOULD_USE_CONTINUATION?c.now()+250:Infinity;i<p.length&&c.now()<b;i++){for(var d=p[i],j=h,k=d;k=k.previousSibling;){var m=k.nodeType,o=(m===7||m===8)&&k.nodeValue;if(o?!/^\??prettify\b/.test(o):m!==3||/\S/.test(k.nodeValue))break;if(o){j={};o.replace(/\b(\w+)=([\w%+\-.:]+)/g,function(a,b,c){j[b]=c});break}}k=d.className;if((j!==h||e.test(k))&&!v.test(k)){m=!1;for(o=d.parentNode;o;o=o.parentNode)if(f.test(o.tagName)&&
-o.className&&e.test(o.className)){m=!0;break}if(!m){d.className+=" prettyprinted";m=j.lang;if(!m){var m=k.match(n),y;if(!m&&(y=U(d))&&t.test(y.tagName))m=y.className.match(n);m&&(m=m[1])}if(w.test(d.tagName))o=1;else var o=d.currentStyle,u=s.defaultView,o=(o=o?o.whiteSpace:u&&u.getComputedStyle?u.getComputedStyle(d,q).getPropertyValue("white-space"):0)&&"pre"===o.substring(0,3);u=j.linenums;if(!(u=u==="true"||+u))u=(u=k.match(/\blinenums\b(?::(\d+))?/))?u[1]&&u[1].length?+u[1]:!0:!1;u&&J(d,u,o);r=
-{h:m,c:d,j:u,i:o};K(r)}}}i<p.length?setTimeout(g,250):"function"===typeof a&&a()}for(var b=d||document.body,s=b.ownerDocument||document,b=[b.getElementsByTagName("pre"),b.getElementsByTagName("code"),b.getElementsByTagName("xmp")],p=[],m=0;m<b.length;++m)for(var j=0,k=b[m].length;j<k;++j)p.push(b[m][j]);var b=q,c=Date;c.now||(c={now:function(){return+new Date}});var i=0,r,n=/\blang(?:uage)?-([\w.]+)(?!\S)/,e=/\bprettyprint\b/,v=/\bprettyprinted\b/,w=/pre|xmp/i,t=/^code$/i,f=/^(?:pre|code|xmp)$/i,
-h={};g()}};typeof define==="function"&&define.amd&&define("google-code-prettify",[],function(){return Y})})();}()