From f0d6d16406907425270c162277bcc968b50f7998 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Sat, 16 Nov 2024 22:39:00 +0000 Subject: [PATCH] tidy --- src/Server.php | 14 +------------- src/player/Player.php | 1 - 2 files changed, 1 insertion(+), 14 deletions(-) diff --git a/src/Server.php b/src/Server.php index 3621b0574b..47b6548c50 100644 --- a/src/Server.php +++ b/src/Server.php @@ -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)){ @@ -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. @@ -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); diff --git a/src/player/Player.php b/src/player/Player.php index 597e465786..c420f8f44f 100644 --- a/src/player/Player.php +++ b/src/player/Player.php @@ -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])){