. * * * ************************************************************************ * * Bots/MCBot.class.php * * MCBot bot... * */ class {$_NAME} extends Bot { private $uplink; private $mcbot; public function load($uplink, $old = false) { $this->uplink = $uplink; if(!$old) { $nick = "MCBot"; $ident = "mcbot"; $ip = "0::0"; $host = "Services.WebGamesNet.net"; $realname = "MineCraft Bot"; $modes = "ioknISD"; $this->mcbot = $this->uplink->addUser($nick,$ident,$host,$ip,$modes,$realname); if(is_a($this->mcbot, "P10_User")) { $this->uplink->join($this->mcbot, "#MineCraft", (P10_Channel::USERPRIV_OPED | P10_Channel::USERPRIV_VOICE)); $this->uplink->join($this->mcbot, "#dev", P10_Channel::USERPRIV_VOICE); } } else { $this->mcbot = $old; } ModCMD::bind($this, BIND_JOIN, "recive_join"); ModCMD::bind($this, BIND_QUIT, "recive_quit"); } public function unload($rehash = false) { if($rehash) { return $this->mcbot; } else { $this->uplink->delUser($this->mcbot, "Bye."); } } private function botOppedOnChannel($channel) { $privs = $channel->getUserPrivs($this->mcbot); return ($privs & P10_Channel::USERPRIV_OPED); } public function recive_join($user, $channel, $isBurst) { if(!$this->botOppedOnChannel($channel)) return false; if(preg_match("#(.*).spoof.minecraft.WebGamesNet#i",$user->getHost())) { $this->uplink->mode($this->mcbot, $channel, "+v ".$user->getNumeric()); } } public function recive_quit($user, $reason) { if($user === $this->mcbot) { $this->load($this->uplink); } } } ?>