diff options
Diffstat (limited to 'MCServer')
-rw-r--r-- | MCServer/.gitignore | 1 | ||||
-rw-r--r-- | MCServer/Plugins/APIDump/APIDesc.lua | 322 | ||||
-rw-r--r-- | MCServer/Plugins/APIDump/main.css | 5 | ||||
-rw-r--r-- | MCServer/Plugins/APIDump/main.lua | 2 | ||||
m--------- | MCServer/Plugins/Core | 0 | ||||
-rw-r--r-- | MCServer/monsters.ini | 30 | ||||
-rw-r--r-- | MCServer/vg | 7 | ||||
-rw-r--r-- | MCServer/vg.supp | 0 | ||||
-rw-r--r-- | MCServer/webadmin/template.lua | 4 |
9 files changed, 269 insertions, 102 deletions
diff --git a/MCServer/.gitignore b/MCServer/.gitignore index ff0517cfa..d9d869986 100644 --- a/MCServer/.gitignore +++ b/MCServer/.gitignore @@ -16,5 +16,6 @@ memdump* *.grab ProtectionAreas.sqlite helgrind.log +valgrind.log motd.txt *.deuser diff --git a/MCServer/Plugins/APIDump/APIDesc.lua b/MCServer/Plugins/APIDump/APIDesc.lua index 444d697fa..86256e4b3 100644 --- a/MCServer/Plugins/APIDump/APIDesc.lua +++ b/MCServer/Plugins/APIDump/APIDesc.lua @@ -487,9 +487,9 @@ g_APIDesc = ]], Functions = { - Sort = { Notes = "void" }, - IsInside = { Notes = "bool" }, - IsInside = { Notes = "bool" }, + Sort = { Return = "" }, + IsInside = { Return = "bool" }, + IsInside = { Return = "bool" }, }, Variables = { @@ -688,14 +688,14 @@ g_APIDesc = ]], Functions = { - SetName = { Notes = "void" }, - GetName = { Notes = "String" }, - SetColor = { Notes = "void" }, - GetColor = { Notes = "String" }, - AddCommand = { Notes = "void" }, - HasCommand = { Notes = "bool" }, - AddPermission = { Notes = "void" }, - InheritFrom = { Notes = "void" }, + SetName = { Return = "" }, + GetName = { Return = "string" }, + SetColor = { Return = "" }, + GetColor = { Return = "string" }, + AddCommand = { Return = "" }, + HasCommand = { Return = "bool" }, + AddPermission = { Return = "" }, + InheritFrom = { Return = "" }, }, Constants = { @@ -709,16 +709,16 @@ g_APIDesc = Functions = { constructor = { Return = "{{cIniFile|cIniFile}}" }, - CaseSensitive = { Notes = "void" }, - CaseInsensitive = { Notes = "void" }, - Path = { Notes = "void" }, - Path = { Notes = "String" }, - SetPath = { Notes = "void" }, - ReadFile = { Notes = "bool" }, - WriteFile = { Notes = "bool" }, - Erase = { Notes = "void" }, - Clear = { Notes = "void" }, - Reset = { Notes = "void" }, + CaseSensitive = { Return = "" }, + CaseInsensitive = { Return = "" }, + Path = { Return = "" }, + Path = { Return = "string" }, + SetPath = { Return = "" }, + ReadFile = { Return = "bool" }, + WriteFile = { Return = "bool" }, + Erase = { Return = "" }, + Clear = { Return = "" }, + Reset = { Return = "" }, FindKey = { Notes = "long i" }, FindValue = { Notes = "long i" }, NumKeys = { Notes = "unsigned i" }, @@ -743,29 +743,29 @@ g_APIDesc = GetValueSetI = { Notes = "i" }, GetValueSetB = { Notes = "bo" }, GetValueSetF = { Notes = "doub" }, - SetValue = { Notes = "bool" }, - SetValue = { Notes = "bool" }, - SetValueI = { Notes = "bool" }, - SetValueB = { Notes = "bool" }, - SetValueF = { Notes = "bool" }, - DeleteValueByID = { Notes = "bool" }, - DeleteValue = { Notes = "bool" }, - DeleteKey = { Notes = "bool" }, + SetValue = { Return = "bool" }, + SetValue = { Return = "bool" }, + SetValueI = { Return = "bool" }, + SetValueB = { Return = "bool" }, + SetValueF = { Return = "bool" }, + DeleteValueByID = { Return = "bool" }, + DeleteValue = { Return = "bool" }, + DeleteKey = { Return = "bool" }, NumHeaderComments = { Notes = "unsigned int" }, - HeaderComment = { Notes = "void" }, + HeaderComment = { Return = "" }, HeaderComment = { Notes = "Stri" }, - DeleteHeaderComment = { Notes = "bool" }, - DeleteHeaderComments = { Notes = "void" }, + DeleteHeaderComment = { Return = "bool" }, + DeleteHeaderComments = { Return = "" }, NumKeyComments = { Notes = "unsigned i" }, NumKeyComments = { Notes = "unsigned i" }, - KeyComment = { Notes = "bool" }, - KeyComment = { Notes = "bool" }, + KeyComment = { Return = "bool" }, + KeyComment = { Return = "bool" }, KeyComment = { Notes = "Stri" }, KeyComment = { Notes = "Stri" }, - DeleteKeyComment = { Notes = "bool" }, - DeleteKeyComment = { Notes = "bool" }, - DeleteKeyComments = { Notes = "bool" }, - DeleteKeyComments = { Notes = "bool" }, + DeleteKeyComment = { Return = "bool" }, + DeleteKeyComment = { Return = "bool" }, + DeleteKeyComments = { Return = "bool" }, + DeleteKeyComments = { Return = "bool" }, }, Constants = { @@ -1042,12 +1042,12 @@ a_Player:OpenWindow(Window); ]], Functions = { - TeleportToEntity = { Notes = "void" }, - TeleportTo = { Notes = "void" }, - Heal = { Notes = "void" }, - TakeDamage = { Notes = "void" }, - KilledBy = { Notes = "void" }, - GetHealth = { Notes = "int" }, + TeleportToEntity = { Return = "" }, + TeleportTo = { Return = "" }, + Heal = { Return = "" }, + TakeDamage = { Return = "" }, + KilledBy = { Return = "" }, + GetHealth = { Return = "number" }, }, Constants = { @@ -1063,7 +1063,7 @@ a_Player:OpenWindow(Window); { cPickup = { Notes = "[[cPickup}}" }, GetItem = { Notes = "{{cItem|cItem}}" }, - CollectedBy = { Notes = "bool" }, + CollectedBy = { Return = "bool" }, }, Constants = { @@ -1077,40 +1077,35 @@ a_Player:OpenWindow(Window); ]], Functions = { - GetEyeHeight = { Notes = "double" }, - GetEyePosition = { Notes = "{{Vector3d|Vector3d}}" }, - GetFlying = { Notes = "bool" }, - GetStance = { Notes = "double" }, - GetInventory = { Notes = "{{cInventory|cInventory}}" }, - TeleportTo = { Notes = "void" }, - GetGameMode = { Notes = "{{eGameMode|eGameMode}}" }, - GetIP = { Notes = "String" }, - GetLastBlockActionTime = { Notes = "float" }, - GetLastBlockActionCnt = { Notes = "int" }, - SetLastBlockActionCnt = { Notes = "void" }, - SetLastBlockActionTime = { Notes = "void" }, - SetGameMode = { Notes = "void" }, - MoveTo = { Notes = "void" }, - GetClientHandle = { Notes = "{{cClientHandle|cClientHandle}}" }, - SendMessage = { Notes = "void" }, - GetName = { Notes = "String" }, - SetName = { Notes = "void" }, - AddToGroup = { Notes = "void" }, - CanUseCommand = { Notes = "bool" }, - HasPermission = { Notes = "bool" }, - IsInGroup = { Notes = "bool" }, - GetColor = { Notes = "String" }, - TossItem = { Notes = "void" }, - Heal = { Notes = "void" }, - TakeDamage = { Notes = "void" }, - KilledBy = { Notes = "void" }, - Respawn = { Notes = "void" }, - SetVisible = { Notes = "void" }, - IsVisible = { Notes = "bool" }, - MoveToWorld = { Notes = "bool" }, - LoadPermissionsFromDisk = { Notes = "void" }, - GetGroups = { Notes = "list<{{cGroup|cGroup}}>" }, - GetResolvedPermissions = { Notes = "String" }, + GetEyeHeight = { Return = "number" }, + GetEyePosition = { Return = "{{Vector3d|EyePositionVector}}" }, + GetFlying = { Return = "bool" }, + GetStance = { Return = "number" }, + GetInventory = { Return = "{{cInventory|Inventory}}" }, + GetGameMode = { Return = "{{eGameMode|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" }, + SetGameMode = { Return = "" }, + MoveTo = { Return = "" }, + GetClientHandle = { Return = "{{cClientHandle|ClientHandle}}" }, + SendMessage = { Return = "" }, + GetName = { Return = "String" }, + SetName = { Return = "" }, + AddToGroup = { Return = "" }, + CanUseCommand = { Return = "bool" }, + HasPermission = { Return = "bool" }, + IsInGroup = { Return = "bool" }, + GetColor = { Return = "string" }, + TossItem = { Return = "" }, + Heal = { Return = "" }, + TakeDamage = { Return = "" }, + KilledBy = { Return = "" }, + Respawn = { Return = "" }, + SetVisible = { Return = "" }, + IsVisible = { Return = "bool" }, + MoveToWorld = { Return = "bool" }, + LoadPermissionsFromDisk = { Return = "" }, + GetGroups = { Return = "list<{{cGroup|cGroup}}>" }, + GetResolvedPermissions = { Return = "string" }, }, Constants = { @@ -1124,11 +1119,11 @@ a_Player:OpenWindow(Window); ]], Functions = { - GetName = { Notes = "String" }, - SetName = { Notes = "void" }, + GetName = { Return = "string" }, + SetName = { Return = "" }, GetVersion = { Notes = "int" }, - SetVersion = { Notes = "void" }, - GetFileName = { Notes = "String" }, + SetVersion = { Return = "" }, + GetFileName = { Return = "string" }, CreateWebPlugin = { Notes = "{{cWebPlugin|cWebPlugin}}" }, }, Constants = @@ -1146,34 +1141,106 @@ a_Player:OpenWindow(Window); 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 hook and in-game console commands. -</p> - <p>There is one instance of cPluginManager in MCServer, to get it, call either {{GetPluginManager|GetPluginManager}}() or cPluginManager:Get() function. + 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> + There is one instance of cPluginManager in MCServer, 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> +cPluginManager.AddHook(cPluginManager.HOOK_CHAT, OnChatMessage); +</pre></p> ]], Functions = { - AddHook = { Params = "{{cPlugin|Plugin}}, HookType", Return = "", Notes = "Adds processing of the specified hook" }, - BindCommand = { Params = "Command, Permission, Callback, HelpString", Return = "", Notes = "Binds an in-game command with the specified callback function, permission and help string" }, - BindConsoleCommand = { Params = "Command, Callback, HelpString", Return = "", Notes = "Binds a console command with the specified callback function and help string" }, - DisablePlugin = { Params = "PluginName", Return = "", Notes = "Disables a plugin specified by its name" }, - ExecuteCommand = { Params = "Player, Command", Return = "bool", Notes = "Executes the command as if given by the specified Player. Checks permissions. Returns true if executed" }, - ExecuteConsoleCommand = { Params = "Command", Return = "bool", Notes = "Executes the command as if given on the server console. Returns true if executed." }, + AddHook = + { + { Params = "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 function name is looked up, based on the hook type" }, + { Params = "{{cPlugin|Plugin}}, 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 = "", 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." }, + { Params = "Command, Permission, Callback, HelpString", Return = "", 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." }, + }, + BindConsoleCommand = + { + { Params = "Command, Callback, HelpString", Return = "", 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." }, + { Params = "Command, Callback, HelpString", Return = "", 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." }, + }, + DisablePlugin = { Params = "PluginName", Return = "bool", Notes = "Disables a plugin specified by its name. Returns true if the plugin was disabled, false if it wasn't found or wasn't active." }, + ExecuteCommand = { Params = "{{cPlayer|Player}}, CommandStr", Return = "bool", Notes = "Executes the command as if given by the specified Player. Checks permissions. Returns true if executed." }, + ExecuteConsoleCommand = { Params = "CommandStr", Return = "bool", Notes = "Executes the command as if given on the server console. Returns true if executed." }, FindPlugins = { Params = "", Return = "", Notes = "Refreshes the list of plugins to include all folders inside the Plugins folder (potentially new disabled plugins)" }, - ForceExecuteCommand = { Params = "Player, Command", Return = "bool", Notes = "Same as ExecuteCommand, but doesn't check permissions" }, - ForEachCommand = { Params = "Callback", Return = "", Notes = "Calls the Callback function for each command that has been bound using BindCommand()" }, - ForEachConsoleCommand = { Params = "Callback", Return = "", Notes = "Calls the Callback function for each command that has been bound using BindConsoleCommand()" }, + ForceExecuteCommand = { Params = "{{cPlayer|Player}}, CommandStr", Return = "bool", 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>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>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." }, Get = { Params = "", Return = "cPluginManager", Notes = "Returns the single instance of the plugin manager" }, - GetAllPlugins = { Params = "", Return = "PluginTable", Notes = "Returns a table of all plugins, [name => cPlugin] pairs" }, + GetAllPlugins = { Params = "", Return = "table", Notes = "Returns a table (dictionary) of all plugins, [name => {{cPlugin}}] pairing." }, GetCommandPermission = { Params = "Command", Return = "Permission", Notes = "Returns the permission needed for executing the specified command" }, GetNumPlugins = { Params = "", Return = "number", Notes = "Returns the number of plugins, including the disabled ones" }, GetPlugin = { Params = "PluginName", Return = "{{cPlugin|cPlugin}}", Notes = "Returns a plugin handle of the specified plugin" }, - IsCommandBound = { Params = "Command", Return = "boolean", Notes = "Returns true if in-game Command is already bound (by any plugin)" }, - IsConsoleCommandBound = { Params = "Command", Return = "boolean", Notes = "Returns true if console Command is already bound (by any plugin)" }, - LoadPlugin = { Params = "PluginFolder", Return = "", Notes = "Loads a plugin from the specified folder" }, + 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)" }, + 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." }, ReloadPlugins = { Params = "", Return = "", Notes = "Reloads all active plugins" }, }, Constants = { + 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_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_MAX = { Notes = "The maximum TypeID of a hook. Used internally by MCS to check hook type for validity." }, + HOOK_NUM_HOOKS = { Notes = "Total number of hook types MCS supports. Used internally by MCS to check hook type for validity." }, + 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_EATING = { Notes = "Called when the player starts eating a held item. Plugins may abort the eating." }, + 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_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_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_TICK = { Notes = "Called in each world's tick thread when the game logic is about to tick (20 times a second)." }, }, }, @@ -1191,6 +1258,25 @@ a_Player:OpenWindow(Window); ]], Functions = { + Get = { Params = "", Return = "Root object", Notes = "This function returns the cRoot object." }, + BroadcastChat = { Params = "Message", Return = "", Notes = "Broadcasts a message to every player in the server." }, + FindAndDoWithPlayer = { Params = "PlayerName, CallbackFunction", Return = "", Notes = "Calls the given callback function for the given player." }, + ForEachPlayer = { Params = "CallbackFunction", Return = "", Notes = "Calls the given callback function for each player. The callback function has the following signature: <pre>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>function Callback({{cWorld|cWorld}})</pre>" }, + GetCraftingRecipes = { Params = "", Return = "{{cCraftingRecipe|cCraftingRecipe}}", Notes = "Returns the CraftingRecipes object" }, + GetDefaultWorld = { Params = "", Return = "{{cWorld|cWorld}}", Notes = "Returns the world object from the default world." }, + GetFurnaceRecipe = { Params = "", Return = "{{cFurnaceRecipe|cFurnaceRecipe}}", Notes = "Returns the cFurnaceRecipes object." }, + GetGroupManager = { Params = "", Return = "{{cGroupManager|cGroupManager}}", Notes = "Returns the cGroupManager object." }, + 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." }, + GetTotalChunkCount = { Params = "", Return = "number", Notes = "Returns the amount of loaded chunks." }, + 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 " .. '"stop" and "restart" commands have special handling.' }, + SaveAllChunks = { Params = "", Return = "", Notes = "Saves all the chunks in all the worlds." }, + SetPrimaryServerVersion = { Params = "Protocol Version", Return = "", Notes = "Sets the servers PrimaryServerVersion to the given protocol number." } }, Constants = { @@ -1576,6 +1662,44 @@ World:ForEachEntity( { }, }, + Globals = + { + Desc = [[These functions are available directly, without a class instance. Any plugin cal call them at any time.]], + Functions = + { + AddFaceDirection = {Params = "BlockX, BlockY, BlockZ, BlockFace, Inverse", Return = "BlockX, BlockY, BlockZ", Notes = "Returns the coords of a block adjacent to the specified block through the specified face"}, + BlockStringToType = {Params = "BlockTypeString", Return = "BLOCKTYPE", Notes = "Returns the block type parsed from the given string"}, + ClickActionToString = {Params = "ClickAction", Return = "string", Notes = "Returns a string description of the ClickAction enumerated value"}, + DamageTypeToString = {Params = "{{TakeDamageInfo|eDamageType}}", Return = "string", Notes = "Converts a damage type 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 "}, + GetTime = {Return = "number", Notes = "Returns the current OS time, as a unix time stamp (number of seconds since Jan 1, 1970)"}, + 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) "}, + LOGERROR = {Params = "string", Notes = "Logs a 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)"}, + LOGWARN = {Params = "string", Notes = "Logs a text into the server console using “warning” severity (red text); OBSOLETE"}, + LOGWARNING = {Params = "string", Notes = "Logs a text into the server console using “warning” severity (red text)"}, + NoCaseCompare = {Params = "string, string", Return = "number", Notes = "Case-insensitive string comparison; returns 0 if the strings are the same"}, + ReplaceString = {Params = "full-string, to-be-replaced-string, to-replace-string", Notes = "Replaces *each* occurence of to-be-replaced-string in full-string with to-replace-string"}, + StringSplit = {Params = "string, Seperator", Return = "list", Notes = "Seperates string into multiple by splitting every time Seperator is encountered."}, + StringToBiome = {Params = "string", Return = "EMCSBiome", Notes = "Converts a string representation to a biome enumerated value"}, + StringToDamageType = {Params = "string", Return = "{{TakeDamageInfo|eDamageType}}", Notes = "Converts a string representation to an {{TakeDamageInfo|eDamageType}} enumerated value "}, + StringToDimension = {Params = "string", Return = "eDimension", Notes = "Converts a string representation to an eDimension 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 = "number", Notes = "Converts a string representation to a mob 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 = "Trime whitespace at both ends of the string"}, + md5 = {Params = "string", Return = "string", Notes = "converts a string to an md5 hash"}, + }, + Constants = + { + }, + }, }, diff --git a/MCServer/Plugins/APIDump/main.css b/MCServer/Plugins/APIDump/main.css index f9cdfc3ce..777f6d71a 100644 --- a/MCServer/Plugins/APIDump/main.css +++ b/MCServer/Plugins/APIDump/main.css @@ -21,3 +21,8 @@ td, th border: 1px solid #ccc; } +pre +{ + border: 1px solid #ccc; + background-color: #eee; +}
\ No newline at end of file diff --git a/MCServer/Plugins/APIDump/main.lua b/MCServer/Plugins/APIDump/main.lua index 73acd3e69..7c200712d 100644 --- a/MCServer/Plugins/APIDump/main.lua +++ b/MCServer/Plugins/APIDump/main.lua @@ -591,7 +591,7 @@ function WriteHtmlClass(a_ClassAPI, a_AllAPI) 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(additional.Contents); + cf:write(LinkifyString(additional.Contents)); end end diff --git a/MCServer/Plugins/Core b/MCServer/Plugins/Core -Subproject e3a45f34303331be77aceacf2ba53e503ad7284 +Subproject 3871f7afa326d3147b0f74653f7b836243a5c26 diff --git a/MCServer/monsters.ini b/MCServer/monsters.ini index 8289e0a0a..efd801a62 100644 --- a/MCServer/monsters.ini +++ b/MCServer/monsters.ini @@ -152,3 +152,33 @@ AttackRate=1 AttackDamage=6.0 SightDistance=25.0 MaxHealth=16 + +[Horse] +AttackRange=5.0 +AttackRate=1 +AttackDamage=6.0 +SightDistance=25.0 +MaxHealth=30 + +[EnderDragon] +AttackRange=5.0 +AttackRate=1 +AttackDamage=6.0 +SightDistance=25.0 +MaxHealth=200 + +[Giant] +AttackRange=5.0 +AttackRate=1 +AttackDamage=6.0 +SightDistance=25.0 +MaxHealth=100 + +[IronGolem] +AttackRange=5.0 +AttackRate=1 +AttackDamage=6.0 +SightDistance=25.0 +MaxHealth=100 + + diff --git a/MCServer/vg b/MCServer/vg new file mode 100644 index 000000000..fcc8270d0 --- /dev/null +++ b/MCServer/vg @@ -0,0 +1,7 @@ +#! /bin/bash + +# This script runs MCServer under valgrind +# It expects valgrind to be normally installed and available +# Note that this is for Linux only and debug-only, since it slows down MCS way too much + +valgrind --log-file=valgrind.log --suppressions=vg.supp --tool=memcheck --leak-check=full --leak-resolution=high --show-reachable=yes --track-origins=yes -v ./MCServer diff --git a/MCServer/vg.supp b/MCServer/vg.supp new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/MCServer/vg.supp diff --git a/MCServer/webadmin/template.lua b/MCServer/webadmin/template.lua index 1ab1aab88..c9fdf7148 100644 --- a/MCServer/webadmin/template.lua +++ b/MCServer/webadmin/template.lua @@ -58,7 +58,7 @@ function ShowPage(WebAdmin, TemplateRequest) SiteContent = {} local BaseURL = WebAdmin:GetBaseURL(TemplateRequest.Request.Path) local Title = "MCServer" - local MemoryUsage = cWebAdmin:GetMemoryUsage() + local MemoryUsageKiB = cWebAdmin:GetMemoryUsage() local NumChunks = cRoot:Get():GetTotalChunkCount() local PluginPage = WebAdmin:GetPage(TemplateRequest.Request) local PageContent = PluginPage.Content @@ -456,7 +456,7 @@ function ShowPage(WebAdmin, TemplateRequest) </div> <!-- // #containerHolder --> - <p id="footer">MCServer is using: ]] .. MemoryUsage .. [[MB of memory; Current chunk count: ]] .. NumChunks .. [[ </p> + <p id="footer">MCServer is using: ]] .. MemoryUsageKiB / 1024 .. [[ MiB of memory; Current chunk count: ]] .. NumChunks .. [[ </p> </div> <!-- // #wrapper --> </body> |