ChannelMembershipManager

class ChannelMembershipManager(channelManager: ChannelManager, logger: Logger, config: ChannelChatFeatureConfig, hasModerationBypass: (UUID) -> Boolean = ::hasChannelBypassPermission)(source)

Parameters

hasModerationBypass

Whether a player is exempt from being kicked or banned. Injected rather than read from Bukkit inline so this manager stays testable without a running server.

Constructors

Link copied to clipboard
constructor(channelManager: ChannelManager, logger: Logger, config: ChannelChatFeatureConfig, hasModerationBypass: (UUID) -> Boolean = ::hasChannelBypassPermission)

Functions

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

Bans targetId from channelId.

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

Gets the role of a member in a channel.

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

Gets the role of a member in a channel without throwing exceptions.

Link copied to clipboard

Gets all channels where the player is a member.

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

Checks if a player has a specific role or higher in a channel.

Link copied to clipboard
fun inviteToChannel(actorId: UUID, targetId: UUID, channelId: String): Result<Unit>

Adds targetId to channelId on actorId's invitation, bypassing the private-channel gate.

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

Checks if a player is a member of a channel.

Link copied to clipboard
fun joinChannel(playerId: UUID, channelId: String, bypassPrivateCheck: Boolean = false): Result<Unit>

Adds a player to a channel as a member and sets it as their active channel. If the player is already a member of other channels, they remain members of those channels. Only one channel can be active at a time.

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

Removes targetId from channelId as a moderation action.

Link copied to clipboard
fun leaveChannel(playerId: UUID): Result<Unit>

Removes the player from the active channel completely. The player will be removed from the channel membership and the active channel will be cleared.

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

Switches the player's active channel to a channel they are already a member of.