summaryrefslogtreecommitdiffstats
path: root/MCServer/Plugins/APIDump/Hooks
diff options
context:
space:
mode:
Diffstat (limited to 'MCServer/Plugins/APIDump/Hooks')
-rw-r--r--MCServer/Plugins/APIDump/Hooks/OnChat.lua3
-rw-r--r--MCServer/Plugins/APIDump/Hooks/OnEntityChangeWorld.lua29
-rw-r--r--MCServer/Plugins/APIDump/Hooks/OnEntityChangedWorld.lua28
-rw-r--r--MCServer/Plugins/APIDump/Hooks/OnExecuteCommand.lua22
4 files changed, 75 insertions, 7 deletions
diff --git a/MCServer/Plugins/APIDump/Hooks/OnChat.lua b/MCServer/Plugins/APIDump/Hooks/OnChat.lua
index d98df008a..a15d09cc7 100644
--- a/MCServer/Plugins/APIDump/Hooks/OnChat.lua
+++ b/MCServer/Plugins/APIDump/Hooks/OnChat.lua
@@ -7,7 +7,8 @@ return
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
- commands are handled separately using a command framework API.
+ 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" },
diff --git a/MCServer/Plugins/APIDump/Hooks/OnEntityChangeWorld.lua b/MCServer/Plugins/APIDump/Hooks/OnEntityChangeWorld.lua
new file mode 100644
index 000000000..25072ca5c
--- /dev/null
+++ b/MCServer/Plugins/APIDump/Hooks/OnEntityChangeWorld.lua
@@ -0,0 +1,29 @@
+return
+{
+ HOOK_ENTITY_CHANGE_WORLD =
+ {
+ CalledWhen = "Before a entity is changing the world.",
+ DefaultFnName = "OnEntityChangeWorld", -- 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_CHANGE_WORLD
+}
+
+
+
+
+
diff --git a/MCServer/Plugins/APIDump/Hooks/OnEntityChangedWorld.lua b/MCServer/Plugins/APIDump/Hooks/OnEntityChangedWorld.lua
new file mode 100644
index 000000000..00645c152
--- /dev/null
+++ b/MCServer/Plugins/APIDump/Hooks/OnEntityChangedWorld.lua
@@ -0,0 +1,28 @@
+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 {{OnEntityChangeWorld|HOOK_ENTITY_CHANGE_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/OnExecuteCommand.lua b/MCServer/Plugins/APIDump/Hooks/OnExecuteCommand.lua
index dadc4e94f..db7eb97d1 100644
--- a/MCServer/Plugins/APIDump/Hooks/OnExecuteCommand.lua
+++ b/MCServer/Plugins/APIDump/Hooks/OnExecuteCommand.lua
@@ -2,7 +2,10 @@ 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.",
+ 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
@@ -11,17 +14,24 @@ return
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.
+ 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 = "Command", Type = "table of strings", Notes = "The command and its parameters, broken into a table by spaces" },
+ { 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 true, the command will be blocked and none of the remaining hook handlers will
- be called. If the plugin returns false, MCServer calls all the remaining hook handlers and finally
- the command will be executed.
+ If the plugin returns false, MCServer 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
}