public function onAfterInstall()
{
// Minimum build is 2615
$minBuild = '2615';
// If your build is lower
if (craft()->getBuild() < $minBuild) {
// First disable plugin
// With this we force Craft to look up the plugin's ID, which isn't cached at this moment yet
// Without this we get a fatal error
craft()->plugins->disablePlugin($this->getClassHandle());
// Uninstall plugin
craft()->plugins->uninstallPlugin($this->getClassHandle());
// Show error message
craft()->userSession->setError(Craft::t('{plugin} only works on Craft build {build} or higher', array('plugin' => $this->getName(), 'build' => $minBuild)));
}
}