/** * @param ChannelSubscriber $subscriber * @param string $name * @param int $class * @param bool $canFreeJoin * @param bool $checkFreeJoin * @return Channel|false Channel object for the channel trying to join, or false if cannot join */ public function joinChannel(ChannelSubscriber $subscriber, $name, $class, $canFreeJoin = false, $checkFreeJoin = false) { if ($this->hasChannel($name)) { $ch = $this->getChannel($name); if ($checkFreeJoin and !$ch->canFreeJoin()) { return false; } $subscriber->subscribeToChannel($this->getChannel($name)); } else { $this->addChannel($ch = new Channel($name, $subscriber, $class, $canFreeJoin)); } return $ch; }
public function kick(ChannelSubscriber $kicker, ChannelSubscriber $target) { if (!$kicker->isOper() and $kicker !== $this->owner) { $kicker->tell(TextFormat::RED . "You don't have permission to kick a subscriber on channel #%s!", $this->name); return; } if ($target instanceof LegionPE) { $kicker->tell(TextFormat::RED . "You can't kick the server out of the channel!"); return; } $target->unsubscribeFromChannel($this); if ($target === $this->owner) { $this->broadcast("The channel owner of #{$this} has been kicked. The owner of #{$this} is now Legion PE.", self::LEVEL_IMPORTANT_INFO); $this->owner = $this->owner->getMain(); } $kicker->tell(TextFormat::GREEN . "{$target} has been kicked from #{$this}."); }
public function isDeafTo(ChannelSubscriber $other) { if ($this->deaf) { return true; } if ($other instanceof ChannelSubscriber and strpos($this->ignoring, "," . $other->getID() . ",") !== false) { return true; } return false; }