====== OnHandshake hook callback function ======
When a client sends the Handshake packet, MCServer triggers this hook event. At this stage, only the client IP and (unverified) username are known. Plugins may refuse access to the server based on this information.

===== Function signature =====
<code lua>
function OnHandshake(ClientHandle, UserName)
</code>
Parameters:
| ClientHandle | [[API:cClientHandle|cClientHandle]] | The client handle object that represents the connection |
| UserName | string | The username reported in the Handshake packet. Note that this username is not verified through authentication! |

===== Return values =====
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.

===== Registering the callback =====
To register your plugin to receive a callback through this function, use the hook [[api:plugin:hooks|HOOK_HANDSHAKE]]
<code lua>
PluginManager = cPluginManager:GetPluginManager();
PluginManager:AddHook(Plugin, cPluginManager.HOOK_HANDSHAKE);
</code>
