summaryrefslogtreecommitdiffstats
path: root/MCServer/Plugins/APIDump/Hooks/OnExecuteCommand.lua
blob: d920a83baed167b9dfada074ee6e88b960766bd8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
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. However, it doesn't call
			the hook for unregistered in-game commands, simply because there's no way to distinguish between a
			command and a chat message. If a plugin needs to intercept unknown in-game commands, 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 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.
		]],
	},  -- HOOK_EXECUTE_COMMAND
}