ChannelManager

Constructors

Link copied to clipboard
constructor(storage: ChannelStorage, logger: Logger, config: ChannelChatFeatureConfig)

Functions

Link copied to clipboard
fun addMember(channelId: String, playerId: UUID, role: ChannelRole): Result<Unit>

Adds a member to a channel.

Link copied to clipboard
fun banPlayer(channelId: String, playerId: UUID): Result<Channel>

Bans a player from a channel.

Link copied to clipboard

Creates a new channel.

Link copied to clipboard
fun deleteChannel(channelId: String, requesterId: UUID, hasBypassPermission: Boolean = false): Result<Unit>

Deletes a channel.

Link copied to clipboard

Retrieves all channels.

Link copied to clipboard
fun getChannel(channelId: String): Result<Channel>

Retrieves a channel by its ID.

Link copied to clipboard

Retrieves members of a channel.

Link copied to clipboard
fun getPlayerChannel(playerId: UUID): String?

Gets the active channel of a player.

Link copied to clipboard

Gets the full channel context (channel and members) of a player's active channel.

Link copied to clipboard

Retrieves all public channels.

Link copied to clipboard

Initializes the ChannelManager by loading data from storage.

Link copied to clipboard
fun isPlayerBanned(channelId: String, playerId: UUID): Result<Boolean>

Checks if a player is banned from a channel.

Link copied to clipboard
fun removeMember(channelId: String, playerId: UUID): Result<Unit>

Removes a member from a channel.

Link copied to clipboard

Restores the active channel of a player based on their channel membership. If the player is a member of multiple channels, the most recently joined one is selected.

Link copied to clipboard

Saves the current state of channels and members to storage synchronously. Should only br called during server shutdown.

Link copied to clipboard
fun setPlayerChannel(playerId: UUID, channelId: String?)

Sets the active channel of a player.

Link copied to clipboard
fun unbanPlayer(channelId: String, playerId: UUID): Result<Channel>

Unbans a player from a channel.

Link copied to clipboard
fun updateChannelOwner(channelId: String, newOwnerId: UUID): Result<Channel>

Updates the channel owner.

Link copied to clipboard
fun updateMemberRole(channelId: String, playerId: UUID, newRole: ChannelRole): Result<Unit>

Updates a member's role in a channel.