All pastes #417584 Raw Edit

Stuff

public php v1 · immutable
#417584 ·published 2007-03-30 23:32 UTC
rendered paste body
<?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] = array($dh->getServer(), $dh->getChannel()==''?$dh->getFromNick():$dh->getChannel(), $dh->getCommandTrailing()?$dh->getCommandTrailing():$dh->getFromNickString());    eventhandler::addHandler('coffeeTimer', EVENT_TYPE_TIMER, 'coffee_callback'.self::$counter);    timer::create('coffee_callback'.self::$counter, rand(40, 110));    $event->delete();    self::$counter++;    unset($dh);  }    public static function coffeeTimer(event $event){    $counter = substr($event->getName(), 15);    $data = self::$helpers[$counter];    unset(self::$helpers[$counter]);    bot::action($data[0], $data[1], "hands ".$data[2]." a cup of coffee"    $event->delete();    unset($dh);  }}?>