public function mute($msg, $length, $src) { $mute = new MuteIssue(); /** @noinspection PhpDeprecationInspection */ $mute->cid = $this->getPlayer()->getClientId(); $mute->ip = $this->getPlayer()->getAddress(); $mute->uid = $this->getUid(); $mute->length = $length; $mute->msg = $msg; $mute->since = time(); $mute->src = $src; $type = MuteHormone::fromObject($this->getMain(), $mute); $type->release(); return $mute; }
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(); } }