Fixed at least a little of the plugin guide.

master
Alexander Harkness 2014-01-30 21:19:45 +00:00
parent e0cb06dfae
commit d3b8796c48
1 changed files with 7 additions and 15 deletions

View File

@ -25,7 +25,7 @@
</p> </p>
<p> <p>
Next, we must obtain a copy of CoreMessaging.lua. This can be found Next, we must obtain a copy of CoreMessaging.lua. This can be found
<a href="https://raw.github.com/mc-server/MCServer/master/MCServer/Plugins/MagicCarpet/coremessaging.lua">here.</a> <a href="https://gist.github.com/bearbin/8715888">here.</a>
This is used to provide messaging support that is compliant with MCServer standards. This is used to provide messaging support that is compliant with MCServer standards.
</p> </p>
<h2>Creating the basic template</h2> <h2>Creating the basic template</h2>
@ -35,19 +35,14 @@
Format it like so: Format it like so:
</p> </p>
<pre class="prettyprint lang-lua"> <pre class="prettyprint lang-lua">
local PLUGIN PLUGIN = nil
function Initialize(Plugin) function Initialize(Plugin)
Plugin:SetName("DerpyPlugin") Plugin:SetName("NewPlugin")
Plugin:SetVersion(1) Plugin:SetVersion(1)
PLUGIN = Plugin PLUGIN = Plugin
-- Hooks
local PluginManager = cPluginManager:Get()
-- Command bindings
LOG("Initialised " .. Plugin:GetName() .. " v." .. Plugin:GetVersion()) LOG("Initialised " .. Plugin:GetName() .. " v." .. Plugin:GetVersion())
return true return true
end end
@ -84,7 +79,7 @@ end
To register a hook, insert the following code template into the "-- Hooks" area in the previous code example. To register a hook, insert the following code template into the "-- Hooks" area in the previous code example.
</p> </p>
<pre class="prettyprint lang-lua"> <pre class="prettyprint lang-lua">
cPluginManager:AddHook(cPluginManager.HOOK_NAME_HERE, FunctionNameToBeCalled) cPluginManager.AddHook(cPluginManager.HOOK_NAME_HERE, FunctionNameToBeCalled)
</pre> </pre>
<p> <p>
What does this code do? What does this code do?
@ -102,10 +97,7 @@ function Initialize(Plugin)
Plugin:SetName("DerpyPlugin") Plugin:SetName("DerpyPlugin")
Plugin:SetVersion(1) Plugin:SetVersion(1)
cPluginManager:AddHook(cPluginManager.HOOK_PLAYER_MOVING, OnPlayerMoving) cPluginManager.AddHook(cPluginManager.HOOK_PLAYER_MOVING, OnPlayerMoving)
local PluginManager = cPluginManager:Get()
-- Command bindings
LOG("Initialised " .. Plugin:GetName() .. " v." .. Plugin:GetVersion()) LOG("Initialised " .. Plugin:GetName() .. " v." .. Plugin:GetVersion())
return true return true
@ -127,10 +119,10 @@ end
</p> </p>
<pre class="prettyprint lang-lua"> <pre class="prettyprint lang-lua">
-- ADD THIS IF COMMAND DOES NOT REQUIRE A PARAMETER (/explode) -- ADD THIS IF COMMAND DOES NOT REQUIRE A PARAMETER (/explode)
PluginManager:BindCommand("/commandname", "permissionnode", FunctionToCall, " - Description of command") PluginManager.BindCommand("/commandname", "permissionnode", FunctionToCall, " - Description of command")
-- ADD THIS IF COMMAND DOES REQUIRE A PARAMETER (/explode Notch) -- ADD THIS IF COMMAND DOES REQUIRE A PARAMETER (/explode Notch)
PluginManager:BindCommand("/commandname", "permissionnode", FunctionToCall, " ~ Description of command and parameter(s)") PluginManager.BindCommand("/commandname", "permissionnode", FunctionToCall, " ~ Description of command and parameter(s)")
</pre> </pre>
<p> <p>
What does it do, and why are there two? What does it do, and why are there two?