public function tick() { $time = time(); if (abs($time - $this->time) > 10) { $this->time = $time - 1; } while ($this->time < $time) { $now = date('siHdmw', ++$this->time); foreach ($this->jobs as $job) { if (FALSE === (bool) preg_match('/' . $job['regex'] . '/', $now)) { continue; } switch ($job['cmd'][0]) { case '/': IS_MST()->Msg($job['cmd'])->Send(); break; default: IS_MSX()->Msg($job['cmd'])->Send(); break; } } } }
public function castLFSCommand($cmd, $ucid) { # Get the command and it's args. $argc = count($argv = str_getcsv($cmd, ' ')); array_shift($argv); $cmd = array_shift($argv); if ($cmd == 'ban') { $minutes = array_shift($argv); } if ($cmd == 'ban' && $argc < 4 || $argc < 3) { IS_MTC()->UCID($ucid)->Text("Useage: `prism {$cmd}" . ($cmd == 'ban' ? ' <time>' : '') . ' <targets> ...`')->Send(); return PLUGIN_HANDLED; } $castingAdmin = $this->getClientByUCID($ucid); # If we don't have target(s), then we can't do anything. foreach ($argv as $target) { $target = strToLower($target); if (strToLower($castingAdmin->UName) == $target) { IS_MTC()->UCID($ucid)->Text('Why would you even try to run this on yourself?')->Send(); } else { if ($this->isImmune($target)) { IS_MSX()->Msg("Admin {$castingAdmin->UName} tired to {$cmd} immune Admin {$target}.")->Send(); } else { IS_MST()->Msg("/{$cmd} {$target}")->Send(); IS_MSX()->Msg("Admin {$castingAdmin->UName} {$cmd}'ed {$target}.")->Send(); } } } return PLUGIN_HANDLED; }