f7ef93611c
It has been crashing the server. http://forum.mc-server.org/showthread.php?tid=610 git-svn-id: http://mc-server.googlecode.com/svn/trunk@1024 0a769ca7-a7f5-676a-18bf-c427514a06d6
67 lines
1.1 KiB
C++
67 lines
1.1 KiB
C++
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#ifdef USE_SQUIRREL
|
|
|
|
|
|
|
|
|
|
|
|
#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;
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif // USE_SQUIRREL
|
|
|
|
|
|
|
|
|