Skip to content

Commit

Permalink
tidy
Browse files Browse the repository at this point in the history
  • Loading branch information
dktapps committed Nov 16, 2024
1 parent e994606 commit f0d6d16
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 14 deletions.
14 changes: 1 addition & 13 deletions src/Server.php
Original file line number Diff line number Diff line change
Expand Up @@ -1059,7 +1059,6 @@ public function __construct(
$forwarder = new BroadcastLoggerForwarder($this->logger, $this->language);
$this->subscribeToBroadcastChannel(self::BROADCAST_CHANNEL_ADMINISTRATIVE, $forwarder);
$this->subscribeToBroadcastChannel(self::BROADCAST_CHANNEL_USERS, $forwarder);
$this->subscribeToBroadcastChannel(self::BROADCAST_CHANNEL_USERS, $forwarder);

//TODO: move console parts to a separate component
if($this->configGroup->getPropertyBool(Yml::CONSOLE_ENABLE_INPUT, true)){
Expand Down Expand Up @@ -1248,17 +1247,6 @@ private function startupPrepareNetworkInterfaces() : bool{
return true;
}

private function getBroadcastChannel(string $channelId) : ?MessageChannel{
return $this->broadcastChannels[$channelId] ?? null;
}

public function createBroadcastChannel(string $channelId, ?string $permission) : void{
if(isset($this->broadcastChannels[$channelId])){
throw new \InvalidArgumentException("Channel \"$channelId\" already exists");
}
$this->broadcastChannels[$channelId] = new MessageChannel($permission);
}

/**
* Subscribes to a particular message broadcast channel.
* The channel ID can be any arbitrary string.
Expand Down Expand Up @@ -1304,7 +1292,7 @@ public function getBroadcastChannelSubscribers(string $channelId) : array{
* @param MessageBroadcastSubscriber[]|null $recipients
*/
public function broadcastMessage(CommandSender $source, Translatable|string $message, string $channelId = self::BROADCAST_CHANNEL_USERS, ?array $recipients = null) : int{
$recipients = $recipients ?? $this->getBroadcastChannel($channelId)?->getPermittedSubscribers() ?? [];
$recipients = $recipients ?? $this->getBroadcastChannelSubscribers($channelId);

foreach($recipients as $recipient){
$recipient->onMessage($source, $message, $channelId);
Expand Down
1 change: 0 additions & 1 deletion src/player/Player.php
Original file line number Diff line number Diff line change
Expand Up @@ -895,7 +895,6 @@ public function doFirstSpawn() : void{
return;
}
$this->spawned = true;

$this->recheckBroadcastPermissions();
$this->getPermissionRecalculationCallbacks()->add(function(array $changedPermissionsOldValues) : void{
if(isset($changedPermissionsOldValues[Server::BROADCAST_CHANNEL_ADMINISTRATIVE]) || isset($changedPermissionsOldValues[Server::BROADCAST_CHANNEL_USERS])){
Expand Down

0 comments on commit f0d6d16

Please sign in to comment.