====== Plugin:Initialize ======
The [[Initialize|Initialize]] Function is called only once when the Plugin is loaded. You need to do your Plugin Setup here. The following things are required:

to give your plugin a unique name to be displayed call: <code>Plugin:SetName( "MySuperPlugin" )</code>


to set the id so people will know which plugin version this is call: <code>Plugin:SetVersion( 101 )</code> The version number needs to be a whole number (eg. no 1.2345)
===== Return =====
When this function returns false, the plugin is removed from the server.
When it returns true, the plugin is added to the server and will receive function calls on it's hooks

===== Registering Function Callbacks =====
A Hook is required for the server to know on which events you'd like to do something.
The following Hooks can be registered:

{{page>api:plugin:hooks#Hooks&noheader&noeditbtn}}

To Register some hooks call:
<code lua>
PluginManager = cRoot:Get():GetPluginManager()
PluginManager:AddHook( Plugin, cPluginManager.E_PLUGIN_CHAT )
PluginManager:AddHook( Plugin, cPluginManager.E_PLUGIN_PLAYER_JOIN )
PluginManager:AddHook( Plugin, cPluginManager.E_PLUGIN_BLOCK_PLACE )
</code>
===== OnChat =====
If you registered a Chat-Hook, you will also need to tell the server about commands you'd like to be handled by you.

For this you call AddCommand:
<code>
Plugin:AddCommand("/command", " - if you call /command this plugin will do something... I am a description", "myplugin.basepermission")
</code>
And you bind your command to a plugin function. You could bind one function to multiple commands (for command aliases, for example):
<code>
Plugin:BindCommand("/command", "myplugin.basepermission", HandleMypluginFunction)
Plugin:BindCommand("/c", "myplugin.basepermission", HandleMypluginFunction)
</code>