public function onRun(array $args, CommandSender $sender, ChannelSubscriber $sub)
 {
     if (!isset($args[0])) {
         return false;
     }
     $channel = $this->getPlugin()->getChannelManager()->getChannel(array_shift($args));
     if (!$channel instanceof Channel) {
         return "Channel doesn't exist!";
     }
     $flags = $channel->getFlags($sub->getID());
     if (in_array($this->flag, $flags)) {
         return "You are already {$this->rankName} on channel {$channel}!";
     }
     $flags[] = $this->flag;
     $channel->setFlags($sub->getID(), $flags);
     return "You are now a {$this->rankName} on channel {$channel}.";
 }
Ejemplo n.º 2
0
 public function send($message, ChannelSubscriber $source)
 {
     if ($source->isMuted()) {
         $source->sendMessage("You are muted!", $this);
     }
     if (in_array(self::MODE_MUTED, $this->getFlags($source->getID()))) {
         $source->sendMessage("You are muted on this channel!", $this);
     }
     $this->broadcast(sprintf("%s<%s> %s", $this->plugin->getPrefixAPI()->getPrefixes($source, $this), $source->getDisplayName(), $message), self::LEVEL_CHAT);
 }