ChannelMembershipManager

class ChannelMembershipManager(channelManager: ChannelManager, logger: Logger, config: ChannelChatFeatureConfig, debug: DebugLogger = DebugLogger.Disabled, hasModerationBypass: (UUID) -> Boolean = ::hasChannelBypassPermission, now: () -> Long = System::currentTimeMillis)(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.

now

The current time in milliseconds, injected so invitation expiry can be tested.

Constructors

Link copied to clipboard
constructor(channelManager: ChannelManager, logger: Logger, config: ChannelChatFeatureConfig, debug: DebugLogger = DebugLogger.Disabled, hasModerationBypass: (UUID) -> Boolean = ::hasChannelBypassPermission, now: () -> Long = System::currentTimeMillis)

Types

Link copied to clipboard
object Companion

Functions

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

Bans targetId from channelId on actorId's authority.

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 hasInvitation(playerId: UUID, channelId: String): Boolean

Whether playerId holds an unexpired invitation to channelId.

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>

Records actorId's invitation of targetId to channelId, which the target accepts by joining within INVITATION_LIFETIME.

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): 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(actorId: UUID, targetId: UUID, channelId: String): Result<Unit>

Removes targetId from channelId as a moderation action on actorId's authority.

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.