summaryrefslogtreecommitdiffstats
path: root/source/Plugin.h
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2013-02-01 20:55:42 +0100
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2013-02-01 20:55:42 +0100
commit019c8b5bc71708e2d895a95757643406f75b4149 (patch)
tree47c5e399e562384a255d5d789d761d8857dff6af /source/Plugin.h
parentRenamed HOOK_KILLED to HOOK_KILLING to match naming conventions. (diff)
downloadcuberite-019c8b5bc71708e2d895a95757643406f75b4149.tar
cuberite-019c8b5bc71708e2d895a95757643406f75b4149.tar.gz
cuberite-019c8b5bc71708e2d895a95757643406f75b4149.tar.bz2
cuberite-019c8b5bc71708e2d895a95757643406f75b4149.tar.lz
cuberite-019c8b5bc71708e2d895a95757643406f75b4149.tar.xz
cuberite-019c8b5bc71708e2d895a95757643406f75b4149.tar.zst
cuberite-019c8b5bc71708e2d895a95757643406f75b4149.zip
Diffstat (limited to 'source/Plugin.h')
-rw-r--r--source/Plugin.h24
1 files changed, 6 insertions, 18 deletions
diff --git a/source/Plugin.h b/source/Plugin.h
index 44d8d29a5..51cdeab68 100644
--- a/source/Plugin.h
+++ b/source/Plugin.h
@@ -81,6 +81,12 @@ public:
virtual bool OnUpdatingSign (cWorld * a_World, int a_BlockX, int a_BlockY, int a_BlockZ, AString & a_Line1, AString & a_Line2, AString & a_Line3, AString & a_Line4, cPlayer * a_Player);
virtual bool OnWeatherChanged (cWorld * a_World);
+ /// Handles the command split into a_Split, issued by player a_Player. Command permissions have already been checked.
+ virtual bool HandleCommand(const AStringVector & a_Split, cPlayer * a_Player);
+
+ /// All bound commands are to be removed, do any language-dependent cleanup here
+ virtual void ClearCommands(void) {} ;
+
/** Called from cPluginManager::AddHook() to check if the hook can be added.
Plugin API providers may check if the plugin is written correctly (has the hook handler function)
Returns true if the hook can be added (handler exists)
@@ -89,13 +95,6 @@ public:
virtual bool CanAddHook(cPluginManager::PluginHook a_Hook) { return false; }
// tolua_begin
- struct CommandStruct
- {
- AString Command;
- AString Description;
- AString Permission;
- };
-
const AString & GetName(void) const { return m_Name; }
void SetName(const AString & a_Name) { m_Name = a_Name; }
@@ -104,14 +103,8 @@ public:
const AString & GetDirectory(void) const {return m_Directory; }
AString GetLocalDirectory(void) const;
-
- void AddCommand(const AString & a_Command, const AString & a_Description, const AString & a_Permission);
// tolua_end
- typedef bool (FuncCommandHandler)( AString & a_Command, std::vector< std::string > & a_Split );
- void BindCommand( FuncCommandHandler* a_Function, AString & a_Command ); // >> EXPORTED IN MANUALBINDINGS <<
- const std::vector< CommandStruct > & GetCommands() const { return m_Commands; } // >> EXPORTED IN MANUALBINDINGS <<
-
/* This should not be exposed to scripting languages */
enum PluginLanguage
@@ -123,13 +116,8 @@ public:
PluginLanguage GetLanguage() { return m_Language; }
void SetLanguage( PluginLanguage a_Language ) { m_Language = a_Language; }
- bool CanBindCommands() { return m_bCanBindCommands; }
private:
- friend class cPluginManager;
- bool m_bCanBindCommands; // Only changed by cPluginManager
-
PluginLanguage m_Language;
- std::vector< CommandStruct > m_Commands;
AString m_Name;
int m_Version;