diff options
author | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2012-09-24 00:09:57 +0200 |
---|---|---|
committer | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2012-09-24 00:09:57 +0200 |
commit | ecfe6ab65bd1fc2c7f5733fe6ef4e6ddaac44a26 (patch) | |
tree | 898e37fe747f0fdcefeb88f833557fd45db3347c /source/squirrelbindings/SquirrelBaseClass.h | |
parent | Source files cleanup: ChunkDataSerializer is Protocol-related (diff) | |
download | cuberite-ecfe6ab65bd1fc2c7f5733fe6ef4e6ddaac44a26.tar cuberite-ecfe6ab65bd1fc2c7f5733fe6ef4e6ddaac44a26.tar.gz cuberite-ecfe6ab65bd1fc2c7f5733fe6ef4e6ddaac44a26.tar.bz2 cuberite-ecfe6ab65bd1fc2c7f5733fe6ef4e6ddaac44a26.tar.lz cuberite-ecfe6ab65bd1fc2c7f5733fe6ef4e6ddaac44a26.tar.xz cuberite-ecfe6ab65bd1fc2c7f5733fe6ef4e6ddaac44a26.tar.zst cuberite-ecfe6ab65bd1fc2c7f5733fe6ef4e6ddaac44a26.zip |
Diffstat (limited to 'source/squirrelbindings/SquirrelBaseClass.h')
-rw-r--r-- | source/squirrelbindings/SquirrelBaseClass.h | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/source/squirrelbindings/SquirrelBaseClass.h b/source/squirrelbindings/SquirrelBaseClass.h new file mode 100644 index 000000000..ef03c1a55 --- /dev/null +++ b/source/squirrelbindings/SquirrelBaseClass.h @@ -0,0 +1,41 @@ +#pragma once
+#include "SquirrelBindings.h"
+#include "../Plugin_Squirrel.h"
+#include "../PluginManager.h"
+#include "../Root.h"
+#include "../SquirrelCommandBinder.h"
+
+//The baseclass for squirrel plugins
+class cSquirrelBaseClass
+{
+public:
+ cSquirrelBaseClass()
+ : m_Instance(0)
+ {
+ }
+
+ void setInstance(cPlugin_Squirrel *a_Instance)
+ {
+ m_Instance = a_Instance;
+ }
+
+ void AddHook(short a_Hook)
+ {
+ if(m_Instance)
+ cRoot::Get()->GetPluginManager()->AddHook(m_Instance, (cPluginManager::PluginHook) a_Hook);
+ }
+
+ void AddCommand( std::string a_Command, std::string a_Description, std::string a_Permission )
+ {
+ if(m_Instance) m_Instance->AddCommand(a_Command, a_Description, a_Permission);
+ }
+
+ bool BindCommand( const std::string a_Command, const std::string a_Permission, Sqrat::Function a_Callback)
+ {
+ if(!m_Instance) return false;
+ return cRoot::Get()->GetPluginManager()->GetSquirrelCommandBinder()->BindCommand(a_Command, a_Permission, m_Instance, a_Callback);
+ }
+
+protected:
+ cPlugin_Squirrel *m_Instance;
+};
\ No newline at end of file |