<?phpclass plugCoffeeTest{ protected static $helpers = array(); protected static $counter = 0; public static function load(){ eventhandler::addHandler('coffee', EVENT_TYPE_COMMAND, 'coffee'); } public static function coffee(event $event){ $dh = $event->getDataHelper(); $dh->replyAction("grinds some beans"); $dh->replyAction("starts the coffee drip"); $dh->reply("This will be a little while."); self::$helpers[self::$counter] = $dh; eventhandler::addHandler('coffeeTimer', EVENT_TYPE_TIMER, 'coffee_callback'.self::$counter); timer::create('coffee_callback'.self::$counter, rand(40, 110)); $event->delete(); unset($dh); } public static function coffeeTimer(event $event){ $counter = substr($event->getName(), 15); $dh = self::$helpers[$counter]; unset(self::$helpers[$counter]); if($dh->getCommandTrailing()){ $dh->replyAction("hands ".$dh->getCommandTrailing()." a cup of coffee"); }else{ $dh->replyAction("hands ".$dh->getFromNickString()." a cup of coffee"); } $event->delete(); unset($dh); }}?>