summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--MCServer/Plugins/APIDump/APIDesc.lua284
-rw-r--r--MCServer/Plugins/APIDump/main.css5
-rw-r--r--MCServer/Plugins/APIDump/main.lua2
m---------MCServer/Plugins/Core0
-rw-r--r--Tools/ProtoProxy/Connection.cpp56
-rw-r--r--Tools/ProtoProxy/Connection.h1
-rw-r--r--source/Bindings.cpp35
-rw-r--r--source/Bindings.h2
-rw-r--r--source/ClientHandle.h1
-rw-r--r--source/Entities/Entity.cpp5
-rw-r--r--source/Entities/Pickup.h2
-rw-r--r--source/ManualBindings.cpp74
-rw-r--r--source/OSSupport/File.cpp14
-rw-r--r--source/OSSupport/File.h3
-rw-r--r--source/Plugin.cpp12
-rw-r--r--source/Plugin.h3
-rw-r--r--source/PluginLua.cpp3
-rw-r--r--source/PluginManager.cpp6
-rw-r--r--source/Protocol/Protocol125.cpp15
-rw-r--r--source/Protocol/Protocol16x.cpp2
-rw-r--r--source/Protocol/Protocol16x.h2
-rw-r--r--source/Protocol/ProtocolRecognizer.cpp6
-rw-r--r--source/Protocol/ProtocolRecognizer.h6
23 files changed, 383 insertions, 156 deletions
diff --git a/MCServer/Plugins/APIDump/APIDesc.lua b/MCServer/Plugins/APIDump/APIDesc.lua
index 444d697fa..82bbe9e0d 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 =
{
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/Tools/ProtoProxy/Connection.cpp b/Tools/ProtoProxy/Connection.cpp
index e985c2ff6..c4776949e 100644
--- a/Tools/ProtoProxy/Connection.cpp
+++ b/Tools/ProtoProxy/Connection.cpp
@@ -15,7 +15,14 @@
-#ifdef _DEBUG
+/// When defined, the following macro causes a sleep after each parsed packet (DEBUG-mode only)
+// #define SLEEP_AFTER_PACKET
+
+
+
+
+
+#if defined(_DEBUG) && defined(SLEEP_AFTER_PACKET)
#define DebugSleep Sleep
#else
#define DebugSleep(X)
@@ -182,6 +189,7 @@ enum
PACKET_BLOCK_CHANGE = 0x35,
PACKET_BLOCK_ACTION = 0x36,
PACKET_MAP_CHUNK_BULK = 0x38,
+ PACKET_EXPLOSION = 0x3c,
PACKET_SOUND_EFFECT = 0x3d,
PACKET_NAMED_SOUND_EFFECT = 0x3e,
PACKET_CHANGE_GAME_STATE = 0x46,
@@ -299,7 +307,7 @@ void cConnection::Run(void)
Log("Cannot connect to server; aborting");
return;
}
-
+
while (true)
{
fd_set ReadFDs;
@@ -694,6 +702,7 @@ bool cConnection::DecodeServersPackets(const char * a_Data, int a_Size)
case PACKET_ENTITY_STATUS: HANDLE_SERVER_READ(HandleServerEntityStatus); break;
case PACKET_ENTITY_TELEPORT: HANDLE_SERVER_READ(HandleServerEntityTeleport); break;
case PACKET_ENTITY_VELOCITY: HANDLE_SERVER_READ(HandleServerEntityVelocity); break;
+ case PACKET_EXPLOSION: HANDLE_SERVER_READ(HandleServerExplosion); break;
case PACKET_INCREMENT_STATISTIC: HANDLE_SERVER_READ(HandleServerIncrementStatistic); break;
case PACKET_KEEPALIVE: HANDLE_SERVER_READ(HandleServerKeepAlive); break;
case PACKET_KICK: HANDLE_SERVER_READ(HandleServerKick); break;
@@ -1586,6 +1595,49 @@ bool cConnection::HandleServerEntityVelocity(void)
+bool cConnection::HandleServerExplosion(void)
+{
+ HANDLE_SERVER_PACKET_READ(ReadBEDouble, double, PosX);
+ HANDLE_SERVER_PACKET_READ(ReadBEDouble, double, PosY);
+ HANDLE_SERVER_PACKET_READ(ReadBEDouble, double, PosZ);
+ HANDLE_SERVER_PACKET_READ(ReadBEFloat, float, Force);
+ HANDLE_SERVER_PACKET_READ(ReadBEInt, int, NumRecords);
+ struct sCoords
+ {
+ int x, y, z;
+
+ sCoords(int a_X, int a_Y, int a_Z) : x(a_X), y(a_Y), z(a_Z) {}
+ } ;
+ std::vector<sCoords> Records;
+ Records.reserve(NumRecords);
+ int PosXI = (int)PosX, PosYI = (int)PosY, PosZI = (int)PosZ;
+ for (int i = 0; i < NumRecords; i++)
+ {
+ HANDLE_SERVER_PACKET_READ(ReadChar, char, rx);
+ HANDLE_SERVER_PACKET_READ(ReadChar, char, ry);
+ HANDLE_SERVER_PACKET_READ(ReadChar, char, rz);
+ Records.push_back(sCoords(PosXI + rx, PosYI + ry, PosZI + rz));
+ }
+ HANDLE_SERVER_PACKET_READ(ReadBEFloat, float, PlayerMotionX);
+ HANDLE_SERVER_PACKET_READ(ReadBEFloat, float, PlayerMotionY);
+ HANDLE_SERVER_PACKET_READ(ReadBEFloat, float, PlayerMotionZ);
+ Log("Received a PACKET_EXPLOSION from the server:");
+ Log(" Pos = {%.02f, %.02f, %.02f}", PosX, PosY, PosZ);
+ Log(" Force = %.02f", Force);
+ Log(" NumRecords = %d", NumRecords);
+ for (int i = 0; i < NumRecords; i++)
+ {
+ Log(" Records[%d] = {%d, %d, %d}", i, Records[i].x, Records[i].y, Records[i].z);
+ }
+ Log(" Player motion = <%.02f, %.02f, %.02f>", PlayerMotionX, PlayerMotionY, PlayerMotionZ);
+ COPY_TO_CLIENT();
+ return true;
+}
+
+
+
+
+
bool cConnection::HandleServerIncrementStatistic(void)
{
// 0xc8
diff --git a/Tools/ProtoProxy/Connection.h b/Tools/ProtoProxy/Connection.h
index c30a28727..6093408d6 100644
--- a/Tools/ProtoProxy/Connection.h
+++ b/Tools/ProtoProxy/Connection.h
@@ -158,6 +158,7 @@ protected:
bool HandleServerEntityStatus(void);
bool HandleServerEntityTeleport(void);
bool HandleServerEntityVelocity(void);
+ bool HandleServerExplosion(void);
bool HandleServerIncrementStatistic(void);
bool HandleServerKeepAlive(void);
bool HandleServerKick(void);
diff --git a/source/Bindings.cpp b/source/Bindings.cpp
index a08985144..0a1d44964 100644
--- a/source/Bindings.cpp
+++ b/source/Bindings.cpp
@@ -1,6 +1,6 @@
/*
** Lua binding: AllToLua
-** Generated automatically by tolua++-1.0.92 on 09/16/13 11:41:45.
+** Generated automatically by tolua++-1.0.92 on 09/18/13 22:13:21.
*/
#ifndef __cplusplus
@@ -10828,6 +10828,38 @@ static int tolua_AllToLua_cPlugin_GetLocalDirectory00(lua_State* tolua_S)
}
#endif //#ifndef TOLUA_DISABLE
+/* method: GetLocalFolder of class cPlugin */
+#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlugin_GetLocalFolder00
+static int tolua_AllToLua_cPlugin_GetLocalFolder00(lua_State* tolua_S)
+{
+#ifndef TOLUA_RELEASE
+ tolua_Error tolua_err;
+ if (
+ !tolua_isusertype(tolua_S,1,"const cPlugin",0,&tolua_err) ||
+ !tolua_isnoobj(tolua_S,2,&tolua_err)
+ )
+ goto tolua_lerror;
+ else
+#endif
+ {
+ const cPlugin* self = (const cPlugin*) tolua_tousertype(tolua_S,1,0);
+#ifndef TOLUA_RELEASE
+ if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetLocalFolder'", NULL);
+#endif
+ {
+ AString tolua_ret = (AString) self->GetLocalFolder();
+ tolua_pushcppstring(tolua_S,(const char*)tolua_ret);
+ }
+ }
+ return 1;
+#ifndef TOLUA_RELEASE
+ tolua_lerror:
+ tolua_error(tolua_S,"#ferror in function 'GetLocalFolder'.",&tolua_err);
+ return 0;
+#endif
+}
+#endif //#ifndef TOLUA_DISABLE
+
/* get function: __cWebPlugin__ of class cPluginLua */
#ifndef TOLUA_DISABLE_tolua_get_cPluginLua___cWebPlugin__
static int tolua_get_cPluginLua___cWebPlugin__(lua_State* tolua_S)
@@ -29797,6 +29829,7 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S)
tolua_function(tolua_S,"SetVersion",tolua_AllToLua_cPlugin_SetVersion00);
tolua_function(tolua_S,"GetDirectory",tolua_AllToLua_cPlugin_GetDirectory00);
tolua_function(tolua_S,"GetLocalDirectory",tolua_AllToLua_cPlugin_GetLocalDirectory00);
+ tolua_function(tolua_S,"GetLocalFolder",tolua_AllToLua_cPlugin_GetLocalFolder00);
tolua_endmodule(tolua_S);
tolua_cclass(tolua_S,"cPluginLua","cPluginLua","cPlugin",NULL);
tolua_beginmodule(tolua_S,"cPluginLua");
diff --git a/source/Bindings.h b/source/Bindings.h
index 4d1777180..2ff2944d2 100644
--- a/source/Bindings.h
+++ b/source/Bindings.h
@@ -1,6 +1,6 @@
/*
** Lua binding: AllToLua
-** Generated automatically by tolua++-1.0.92 on 09/16/13 11:41:45.
+** Generated automatically by tolua++-1.0.92 on 09/18/13 22:13:21.
*/
/* Exported function */
diff --git a/source/ClientHandle.h b/source/ClientHandle.h
index 01059c511..ef6dbd124 100644
--- a/source/ClientHandle.h
+++ b/source/ClientHandle.h
@@ -1,3 +1,4 @@
+
// cClientHandle.h
// Interfaces to the cClientHandle class representing a client connected to this server. The client need not be a player yet
diff --git a/source/Entities/Entity.cpp b/source/Entities/Entity.cpp
index dc3c7796e..d465c75bd 100644
--- a/source/Entities/Entity.cpp
+++ b/source/Entities/Entity.cpp
@@ -549,12 +549,11 @@ void cEntity::HandlePhysics(float a_Dt, cChunk & a_Chunk)
int RelBlockX = BlockX - (NextChunk->GetPosX() * cChunkDef::Width);
int RelBlockZ = BlockZ - (NextChunk->GetPosZ() * cChunkDef::Width);
BLOCKTYPE BlockIn = NextChunk->GetBlock( RelBlockX, BlockY, RelBlockZ );
- BLOCKTYPE BlockBelow = NextChunk->GetBlock( RelBlockX, BlockY - 1, RelBlockZ );
+ BLOCKTYPE BlockBelow = (BlockY > 0) ? NextChunk->GetBlock(RelBlockX, BlockY - 1, RelBlockZ) : E_BLOCK_AIR;
if (!g_BlockIsSolid[BlockIn]) // Making sure we are not inside a solid block
{
if (m_bOnGround) // check if it's still on the ground
{
- BLOCKTYPE BlockBelow = NextChunk->GetBlock( RelBlockX, BlockY - 1, RelBlockZ );
if (!g_BlockIsSolid[BlockBelow]) // Check if block below is air or water.
{
m_bOnGround = false;
@@ -613,7 +612,7 @@ void cEntity::HandlePhysics(float a_Dt, cChunk & a_Chunk)
{
fallspeed = m_Gravity * a_Dt / 3; // Fall 3x slower in water.
}
- else if ((IsBlockRail(BlockBelow)) && (IsMinecart())) // Rails aren't solid, except for Minecarts
+ else if (IsBlockRail(BlockBelow) && IsMinecart()) // Rails aren't solid, except for Minecarts
{
fallspeed = 0;
m_bOnGround = true;
diff --git a/source/Entities/Pickup.h b/source/Entities/Pickup.h
index e35914684..488f91fb2 100644
--- a/source/Entities/Pickup.h
+++ b/source/Entities/Pickup.h
@@ -24,7 +24,7 @@ class cPickup :
public:
CLASS_PROTODEF(cPickup);
- cPickup(double a_MicroPosX, double a_MicroPosY, double a_MicroPosZ, const cItem & a_Item, float a_SpeedX = 0.f, float a_SpeedY = 0.f, float a_SpeedZ = 0.f); // tolua_export
+ cPickup(double a_X, double a_Y, double a_Z, const cItem & a_Item, float a_SpeedX = 0.f, float a_SpeedY = 0.f, float a_SpeedZ = 0.f); // tolua_export
cItem & GetItem(void) {return m_Item; } // tolua_export
const cItem & GetItem(void) const {return m_Item; }
diff --git a/source/ManualBindings.cpp b/source/ManualBindings.cpp
index a80e186eb..a2b4c8810 100644
--- a/source/ManualBindings.cpp
+++ b/source/ManualBindings.cpp
@@ -1235,7 +1235,10 @@ static int tolua_cPluginManager_ForEachConsoleCommand(lua_State * tolua_S)
static int tolua_cPluginManager_BindCommand(lua_State * L)
{
- // Function signature: cPluginManager:BindCommand(Command, Permission, Function, HelpString)
+ /* Function signatures:
+ cPluginManager:BindCommand(Command, Permission, Function, HelpString)
+ cPluginManager.BindCommand(Command, Permission, Function, HelpString) -- without the "self" param
+ */
cPluginLua * Plugin = GetLuaPlugin(L);
if (Plugin == NULL)
{
@@ -1244,26 +1247,30 @@ static int tolua_cPluginManager_BindCommand(lua_State * L)
// Read the arguments to this API call:
tolua_Error tolua_err;
+ int idx = 1;
+ if (tolua_isusertype(L, 1, "cPluginManager", 0, &tolua_err))
+ {
+ idx++;
+ }
if (
- !tolua_isusertype (L, 1, "cPluginManager", 0, &tolua_err) ||
- !tolua_iscppstring(L, 2, 0, &tolua_err) ||
- !tolua_iscppstring(L, 3, 0, &tolua_err) ||
- !tolua_iscppstring(L, 5, 0, &tolua_err) ||
- !tolua_isnoobj (L, 6, &tolua_err)
+ !tolua_iscppstring(L, idx, 0, &tolua_err) ||
+ !tolua_iscppstring(L, idx + 1, 0, &tolua_err) ||
+ !tolua_iscppstring(L, idx + 3, 0, &tolua_err) ||
+ !tolua_isnoobj (L, idx + 4, &tolua_err)
)
{
tolua_error(L, "#ferror in function 'BindCommand'.", &tolua_err);
return 0;
}
- if (!lua_isfunction(L, 4))
+ if (!lua_isfunction(L, idx + 2))
{
luaL_error(L, "\"BindCommand\" function expects a function as its 3rd parameter. Command-binding aborted.");
return 0;
}
- cPluginManager * self = (cPluginManager *)tolua_tousertype(L, 1, 0);
- AString Command (tolua_tocppstring(L, 2, ""));
- AString Permission(tolua_tocppstring(L, 3, ""));
- AString HelpString(tolua_tocppstring(L, 5, ""));
+ cPluginManager * self = cPluginManager::Get();
+ AString Command (tolua_tocppstring(L, idx, ""));
+ AString Permission(tolua_tocppstring(L, idx + 1, ""));
+ AString HelpString(tolua_tocppstring(L, idx + 3, ""));
// Store the function reference:
lua_pop(L, 1); // Pop the help string off the stack
@@ -1290,37 +1297,42 @@ static int tolua_cPluginManager_BindCommand(lua_State * L)
static int tolua_cPluginManager_BindConsoleCommand(lua_State * L)
{
- // Function signature: cPluginManager:BindConsoleCommand(Command, Function, HelpString)
+ /* Function signatures:
+ cPluginManager:BindConsoleCommand(Command, Function, HelpString)
+ cPluginManager.BindConsoleCommand(Command, Function, HelpString) -- without the "self" param
+ */
// Get the plugin identification out of LuaState:
- lua_getglobal(L, LUA_PLUGIN_INSTANCE_VAR_NAME);
- if (!lua_islightuserdata(L, -1))
+ cPluginLua * Plugin = GetLuaPlugin(L);
+ if (Plugin == NULL)
{
- LOGERROR("cPluginManager:BindConsoleCommand() cannot get plugin instance, what have you done to my Lua state? Command-binding aborted.");
+ return 0;
}
- cPluginLua * Plugin = (cPluginLua *)lua_topointer(L, -1);
- lua_pop(L, 1);
// Read the arguments to this API call:
tolua_Error tolua_err;
+ int idx = 1;
+ if (tolua_isusertype(L, 1, "cPluginManager", 0, &tolua_err))
+ {
+ idx++;
+ }
if (
- !tolua_isusertype (L, 1, "cPluginManager", 0, &tolua_err) || // self
- !tolua_iscppstring(L, 2, 0, &tolua_err) || // Command
- !tolua_iscppstring(L, 4, 0, &tolua_err) || // HelpString
- !tolua_isnoobj (L, 5, &tolua_err)
+ !tolua_iscppstring(L, idx, 0, &tolua_err) || // Command
+ !tolua_iscppstring(L, idx + 2, 0, &tolua_err) || // HelpString
+ !tolua_isnoobj (L, idx + 3, &tolua_err)
)
{
tolua_error(L, "#ferror in function 'BindConsoleCommand'.", &tolua_err);
return 0;
}
- if (!lua_isfunction(L, 3))
+ if (!lua_isfunction(L, idx + 1))
{
luaL_error(L, "\"BindConsoleCommand\" function expects a function as its 2nd parameter. Command-binding aborted.");
return 0;
}
- cPluginManager * self = (cPluginManager *)tolua_tousertype(L, 1, 0);
- AString Command (tolua_tocppstring(L, 2, ""));
- AString HelpString(tolua_tocppstring(L, 4, ""));
+ cPluginManager * self = cPluginManager::Get();
+ AString Command (tolua_tocppstring(L, idx, ""));
+ AString HelpString(tolua_tocppstring(L, idx + 2, ""));
// Store the function reference:
lua_pop(L, 1); // Pop the help string off the stack
@@ -1489,14 +1501,16 @@ static int tolua_cPluginLua_AddWebTab(lua_State * tolua_S)
tolua_Error tolua_err;
tolua_err.array = 0;
- tolua_err.index = 0;
- tolua_err.type = 0;
+ tolua_err.index = 3;
+ tolua_err.type = "function";
std::string Title = "";
int Reference = LUA_REFNIL;
- if( tolua_isstring( tolua_S, 2, 0, &tolua_err ) &&
- lua_isfunction( tolua_S, 3 ) )
+ if (
+ tolua_isstring(tolua_S, 2, 0, &tolua_err ) &&
+ lua_isfunction(tolua_S, 3 )
+ )
{
Reference = luaL_ref(tolua_S, LUA_REGISTRYINDEX);
Title = ((std::string) tolua_tocppstring(tolua_S,2,0));
@@ -2028,12 +2042,12 @@ void ManualBindings::Bind(lua_State * tolua_S)
tolua_endmodule(tolua_S);
tolua_beginmodule(tolua_S, "cPluginManager");
+ tolua_function(tolua_S, "AddHook", tolua_cPluginManager_AddHook);
tolua_function(tolua_S, "BindCommand", tolua_cPluginManager_BindCommand);
tolua_function(tolua_S, "BindConsoleCommand", tolua_cPluginManager_BindConsoleCommand);
tolua_function(tolua_S, "ForEachCommand", tolua_cPluginManager_ForEachCommand);
tolua_function(tolua_S, "ForEachConsoleCommand", tolua_cPluginManager_ForEachConsoleCommand);
tolua_function(tolua_S, "GetAllPlugins", tolua_cPluginManager_GetAllPlugins);
- tolua_function(tolua_S, "AddHook", tolua_cPluginManager_AddHook);
tolua_endmodule(tolua_S);
tolua_beginmodule(tolua_S, "cPlayer");
diff --git a/source/OSSupport/File.cpp b/source/OSSupport/File.cpp
index cc0916711..871d9fb94 100644
--- a/source/OSSupport/File.cpp
+++ b/source/OSSupport/File.cpp
@@ -287,6 +287,20 @@ bool cFile::Rename(const AString & a_OrigFileName, const AString & a_NewFileName
+bool cFile::IsFolder(const AString & a_Path)
+{
+ #ifdef _WIN32
+ return ((GetFileAttributes(a_Path.c_str()) & FILE_ATTRIBUTE_DIRECTORY) != 0);
+ #else
+ struct stat st;
+ return ((stat(a_Path.c_str(), &st) == 0) && S_ISDIR(st.st_mode));
+ #endif
+}
+
+
+
+
+
int cFile::Printf(const char * a_Fmt, ...)
{
AString buf;
diff --git a/source/OSSupport/File.h b/source/OSSupport/File.h
index 8a057afa8..d4ea0d3a8 100644
--- a/source/OSSupport/File.h
+++ b/source/OSSupport/File.h
@@ -99,6 +99,9 @@ public:
/// Renames a file, returns true if successful. May fail if dest already exists (libc-dependant)!
static bool Rename(const AString & a_OrigFileName, const AString & a_NewFileName);
+ /// Returns true if the specified path is a folder
+ static bool IsFolder(const AString & a_Path);
+
int Printf(const char * a_Fmt, ...);
private:
diff --git a/source/Plugin.cpp b/source/Plugin.cpp
index 229b997cd..98ccfb88c 100644
--- a/source/Plugin.cpp
+++ b/source/Plugin.cpp
@@ -2,10 +2,6 @@
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
#include "Plugin.h"
-#include "Entities/Player.h"
-#include "World.h"
-#include "CommandOutput.h"
-#include "Mobs/Monster.h"
@@ -32,7 +28,11 @@ cPlugin::~cPlugin()
-AString cPlugin::GetLocalDirectory(void) const
+AString cPlugin::GetLocalFolder(void) const
{
return std::string("Plugins/") + m_Directory;
-} \ No newline at end of file
+}
+
+
+
+
diff --git a/source/Plugin.h b/source/Plugin.h
index be803bab2..06e5819df 100644
--- a/source/Plugin.h
+++ b/source/Plugin.h
@@ -121,7 +121,8 @@ public:
void SetVersion(int a_Version) { m_Version = a_Version; }
const AString & GetDirectory(void) const {return m_Directory; }
- AString GetLocalDirectory(void) const;
+ AString GetLocalDirectory(void) const {return GetLocalFolder(); } // OBSOLETE, use GetLocalFolder() instead
+ AString GetLocalFolder(void) const;
// tolua_end
diff --git a/source/PluginLua.cpp b/source/PluginLua.cpp
index 81a536838..03aefb098 100644
--- a/source/PluginLua.cpp
+++ b/source/PluginLua.cpp
@@ -81,6 +81,9 @@ bool cPluginLua::Initialize(void)
lua_setglobal(m_LuaState, LUA_PLUGIN_INSTANCE_VAR_NAME);
lua_pushstring(m_LuaState, GetName().c_str());
lua_setglobal(m_LuaState, LUA_PLUGIN_NAME_VAR_NAME);
+
+ tolua_pushusertype(m_LuaState, this, "cPluginLua");
+ lua_setglobal(m_LuaState, "g_Plugin");
}
std::string PluginPath = FILE_IO_PREFIX + GetLocalDirectory() + "/";
diff --git a/source/PluginManager.cpp b/source/PluginManager.cpp
index 93ee71926..e7cac457c 100644
--- a/source/PluginManager.cpp
+++ b/source/PluginManager.cpp
@@ -75,14 +75,14 @@ void cPluginManager::FindPlugins(void)
AStringList Files = GetDirectoryContents(PluginsPath.c_str());
for (AStringList::const_iterator itr = Files.begin(); itr != Files.end(); ++itr)
{
- if (itr->rfind(".") != AString::npos)
+ if (!cFile::IsFolder(*itr))
{
- // Ignore files, we only want directories
+ // We only want folders
continue;
}
// Add plugin name/directory to the list
- if (m_Plugins.find( *itr ) == m_Plugins.end())
+ if (m_Plugins.find(*itr) == m_Plugins.end())
{
m_Plugins[ *itr ] = NULL;
}
diff --git a/source/Protocol/Protocol125.cpp b/source/Protocol/Protocol125.cpp
index 54bd28c9f..050132917 100644
--- a/source/Protocol/Protocol125.cpp
+++ b/source/Protocol/Protocol125.cpp
@@ -436,15 +436,18 @@ void cProtocol125::SendExplosion(double a_BlockX, double a_BlockY, double a_Bloc
WriteDouble (a_BlockZ);
WriteFloat (a_Radius);
WriteInt (a_BlocksAffected.size());
+ int BlockX = (int)a_BlockX;
+ int BlockY = (int)a_BlockY;
+ int BlockZ = (int)a_BlockZ;
for (cVector3iArray::const_iterator itr = a_BlocksAffected.begin(); itr != a_BlocksAffected.end(); ++itr)
{
- WriteByte ((Byte)(itr->x - a_BlockX));
- WriteByte ((Byte)(itr->y - a_BlockY));
- WriteByte ((Byte)(itr->z - a_BlockZ));
+ WriteByte((Byte)(itr->x - BlockX));
+ WriteByte((Byte)(itr->y - BlockY));
+ WriteByte((Byte)(itr->z - BlockZ));
}
- WriteFloat ((float)a_PlayerMotion.x);
- WriteFloat ((float)a_PlayerMotion.y);
- WriteFloat ((float)a_PlayerMotion.z);
+ WriteFloat((float)a_PlayerMotion.x);
+ WriteFloat((float)a_PlayerMotion.y);
+ WriteFloat((float)a_PlayerMotion.z);
Flush();
}
diff --git a/source/Protocol/Protocol16x.cpp b/source/Protocol/Protocol16x.cpp
index be5b45f19..0eac7b081 100644
--- a/source/Protocol/Protocol16x.cpp
+++ b/source/Protocol/Protocol16x.cpp
@@ -7,6 +7,8 @@ Implements the 1.6.x protocol classes:
- release 1.6.1 protocol (#73)
- cProtocol162
- release 1.6.2 protocol (#74)
+ - release 1.6.3 protocol (#77) - no relevant changes
+ - release 1.6.4 protocol (#78) - no relevant changes
(others may be added later in the future for the 1.6 release series)
*/
diff --git a/source/Protocol/Protocol16x.h b/source/Protocol/Protocol16x.h
index 077c7958b..2447f90a7 100644
--- a/source/Protocol/Protocol16x.h
+++ b/source/Protocol/Protocol16x.h
@@ -7,6 +7,8 @@ Declares the 1.6.x protocol classes:
- release 1.6.1 protocol (#73)
- cProtocol162
- release 1.6.2 protocol (#74)
+ - release 1.6.3 protocol (#77) - no relevant changes
+ - release 1.6.4 protocol (#78) - no relevant changes
(others may be added later in the future for the 1.6 release series)
*/
diff --git a/source/Protocol/ProtocolRecognizer.cpp b/source/Protocol/ProtocolRecognizer.cpp
index 853018329..fe99b22e1 100644
--- a/source/Protocol/ProtocolRecognizer.cpp
+++ b/source/Protocol/ProtocolRecognizer.cpp
@@ -55,6 +55,8 @@ AString cProtocolRecognizer::GetVersionTextFromInt(int a_ProtocolVersion)
case PROTO_VERSION_1_5_2: return "1.5.2";
case PROTO_VERSION_1_6_1: return "1.6.1";
case PROTO_VERSION_1_6_2: return "1.6.2";
+ case PROTO_VERSION_1_6_3: return "1.6.3";
+ case PROTO_VERSION_1_6_4: return "1.6.4";
}
ASSERT(!"Unknown protocol version");
return Printf("Unknown protocol (%d)", a_ProtocolVersion);
@@ -707,6 +709,8 @@ bool cProtocolRecognizer::TryRecognizeProtocol(void)
return true;
}
case PROTO_VERSION_1_6_2:
+ case PROTO_VERSION_1_6_3:
+ case PROTO_VERSION_1_6_4:
{
m_Protocol = new cProtocol162(m_Client);
return true;
@@ -746,6 +750,8 @@ void cProtocolRecognizer::HandleServerPing(void)
case PROTO_VERSION_1_5_2:
case PROTO_VERSION_1_6_1:
case PROTO_VERSION_1_6_2:
+ case PROTO_VERSION_1_6_3:
+ case PROTO_VERSION_1_6_4:
{
// The server list ping now has 1 more byte of "magic". Mojang just loves to complicate stuff.
// http://wiki.vg/wiki/index.php?title=Protocol&oldid=3101#Server_List_Ping_.280xFE.29
diff --git a/source/Protocol/ProtocolRecognizer.h b/source/Protocol/ProtocolRecognizer.h
index 2178d5e61..c53288230 100644
--- a/source/Protocol/ProtocolRecognizer.h
+++ b/source/Protocol/ProtocolRecognizer.h
@@ -18,8 +18,8 @@
// Adjust these if a new protocol is added or an old one is removed:
-#define MCS_CLIENT_VERSIONS "1.2.4, 1.2.5, 1.3.1, 1.3.2, 1.4.2, 1.4.4, 1.4.5, 1.4.6, 1.4.7, 1.5, 1.5.1, 1.5.2, 1.6.1, 1.6.2"
-#define MCS_PROTOCOL_VERSIONS "29, 39, 47, 49, 51, 60, 61, 73, 74"
+#define MCS_CLIENT_VERSIONS "1.2.4, 1.2.5, 1.3.1, 1.3.2, 1.4.2, 1.4.4, 1.4.5, 1.4.6, 1.4.7, 1.5, 1.5.1, 1.5.2, 1.6.1, 1.6.2, 1.6.3, 1.6.4"
+#define MCS_PROTOCOL_VERSIONS "29, 39, 47, 49, 51, 60, 61, 73, 74, 77, 78"
@@ -42,6 +42,8 @@ public:
PROTO_VERSION_1_5_2 = 61,
PROTO_VERSION_1_6_1 = 73,
PROTO_VERSION_1_6_2 = 74,
+ PROTO_VERSION_1_6_3 = 77,
+ PROTO_VERSION_1_6_4 = 78,
PROTO_VERSION_NEXT,
PROTO_VERSION_LATEST = PROTO_VERSION_NEXT - 1, ///< Automatically assigned to the last protocol version, this serves as the default for PrimaryServerVersion