All pastes #81624 Raw Edit

Stuff

public text v1 · immutable
·published 2006-07-07 18:15 UTC
rendered paste body
void ForgiveTK::AllPluginsLoaded()
{
	//AdminInterfaceListner *AdminInterfacePointer;

	if(m_AdminManager) // We dont need to find the AdminInterface again, we allready found it once.
		return;

	//we don't really need this for anything other than interplugin communication
	//and that's not used in this plugin.
	//If we really wanted, we could override the factories so other plugins can request
	// interfaces we make.  In this callback, the plugin could be assured that either
	// the interfaces it requires were either loaded in another plugin or not.
	PluginId id2; 

	void *ptr = g_SMAPI->MetaFactory("AdminInterface", NULL, &id2); 
	
	if (!ptr) 
	{
		ServerCommand("echo [ForgiveTK Error] Did not find AdminInterface, plugin will not check admin rights"); 
	} else if(id2 > 100) { // This is to prevent a crash bug
		m_AdminManager = (AdminInterface *)ptr;
		m_AdminManager->AddEventListner(this);
		int InterfaceVersion = m_AdminManager->GetInterfaceVersion();
		
		if(InterfaceVersion == ADMININTERFACE_VERSION)
		{
			ServerCommand("echo [ForgiveTK] Found AdminInterface via %s (Interface version: %d)",m_AdminManager->GetModName(),InterfaceVersion); 
#if FTK_DEBUG == 1
			ServerCommand("echo [ForgiveTK] Found AdminInterface[%d] at (%p), via %s (Interface version: %d)", id2, ptr,m_AdminManager->GetModName(),InterfaceVersion); 
#endif
		}
		else
			ServerCommand("echo [ForgiveTK] Found AdminInterface via %s (Interface version: %d), but internal version is %d",m_AdminManager->GetModName(),InterfaceVersion,ADMININTERFACE_VERSION); 
	}
}