protected function run(array $args, Session $sender)
 {
     if (!isset($args[0])) {
         return false;
     }
     $msg = implode(" ", $args);
     $local = true;
     if (substr($msg, 0, 1) === ".") {
         $msg = substr($msg, 1);
         $local = false;
     }
     $type = Hormone::get($sender->getMain(), Hormone::CONSOLE_MESSAGE, $sender->getInGameName(), $msg, $local ? Settings::$LOCALIZE_CLASS : Settings::CLASS_ALL, ["ip" => Settings::$LOCALIZE_IP, "port" => Settings::$LOCALIZE_PORT]);
     $type->release();
     return "Message sent to every staff member.";
 }
 protected function run(array $args, Session $sender)
 {
     if (!isset($args[0])) {
         return false;
     }
     $msg = implode(" ", $args);
     $local = true;
     if (substr($msg, 0, 1) === ".") {
         $msg = substr($msg, 1);
         $local = false;
     }
     $type = new ConsoleChatType($sender->getMain(), $sender->getInGameName(), $msg, $local ? Settings::$LOCALIZE_CLASS : Settings::CLASS_ALL, ["ip" => Settings::$LOCALIZE_IP, "port" => Settings::$LOCALIZE_PORT]);
     $type->push();
     return true;
 }
 public function detectAds(&$string)
 {
     $string = preg_replace_callback('%([0-9]{1,3}\\.){3}[0-9]{1,3}%i', function ($match) {
         return str_repeat("-", strlen($match));
     }, $string);
     $string = str_replace([".lbsg.net", ".leet.cc"], "", $string);
     $string = preg_replace_callback('%(http[s]?://)?(([A-Za-z0-9\\-]+\\.){2,}([A-Za-z0-9\\-]{1,3}))%', function ($match) {
         if (strlen($match[1]) > 6) {
             return $match[0];
         }
         $domain = $match[3] . $match[4];
         if (in_array($domain, $this->session->getMain()->getApprovedDomains())) {
             return $match[0];
         }
         return str_repeat("-", strlen($match));
     }, $string);
 }
 public function __construct(Session $session, $lid)
 {
     $this->uid = $session->getUid();
     $this->lid = $lid;
     parent::__construct($session->getMain());
 }
 public function execWarnOn(CommandSender $issuer, Session $ses)
 {
     $msg = $ses->translate(Phrases::WARNING_RECEIVED_NOTIFICATION, ["issuer" => $issuer->getName(), "message" => $this->msg, "points" => $this->points, "totalpoints" => $ses->getWarningPoints()]);
     $consequence = Settings::getWarnPtsConsequence($ses->getWarningPoints(), $this->creation);
     if ($consequence->banLength) {
         $msg .= $ses->translate(Phrases::WARNING_BANNED_NOTIFICATION, ["length" => MUtils::time_secsToString($consequence->banLength)]);
         $msg = "\n" . $msg;
         $ses->getPlayer()->kick($msg, false);
     } elseif ($consequence->muteSecs) {
         $mute = new MuteIssue();
         $mute->cid = $this->clientId;
         $mute->ip = $ses->getPlayer()->getAddress();
         $mute->uid = $this->uid;
         $mute->length = $consequence->muteSecs;
         $mute->msg = $this->msg;
         $mute->since = $this->creation;
         $mute->src = $issuer->getName();
         $ses->getPlayer()->sendMessage($msg);
         MuteHormone::fromObject($ses->getMain(), $mute)->release();
     }
 }