Interface ChatChannelService


public interface ChatChannelService
Service for managing player chat channels in Zentrix.

Players can switch between global, team, and party chat channels. Channel availability depends on the player's current state (in-game, in a party, etc.).

Example Usage


 ChatChannelService chatService = ZentrixAPI.get().getChatChannelService();

 // Get a player's current channel
 ChatChannel channel = chatService.getChannel(player);

 // Switch to team chat
 if (chatService.canUseTeamChat(player)) {
     chatService.setChannel(player, ChatChannel.TEAM);
 }

 // Toggle through available channels
 ChatChannel newChannel = chatService.toggleChannel(player);
 player.sendMessage("Switched to " + newChannel.getId() + " chat");
 
Since:
1.2.0
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    canUsePartyChat(@NotNull org.bukkit.entity.Player player)
    Checks if a player can use party chat.
    boolean
    canUseTeamChat(@NotNull org.bukkit.entity.Player player)
    Checks if a player can use team chat.
    @NotNull ChatChannel
    getChannel(@NotNull UUID playerId)
    Gets a player's current chat channel by UUID.
    @NotNull ChatChannel
    getChannel(@NotNull org.bukkit.entity.Player player)
    Gets a player's current chat channel.
    void
    resetChannel(@NotNull org.bukkit.entity.Player player)
    Resets a player's chat channel back to ChatChannel.GLOBAL.
    void
    setChannel(@NotNull org.bukkit.entity.Player player, @NotNull ChatChannel channel)
    Sets a player's chat channel.
    @NotNull ChatChannel
    toggleChannel(@NotNull org.bukkit.entity.Player player)
    Toggles a player's chat channel to the next available channel.
  • Method Details

    • getChannel

      @NotNull @NotNull ChatChannel getChannel(@NotNull @NotNull org.bukkit.entity.Player player)
      Gets a player's current chat channel.
      Parameters:
      player - The player
      Returns:
      The player's current chat channel (defaults to ChatChannel.GLOBAL)
    • getChannel

      @NotNull @NotNull ChatChannel getChannel(@NotNull @NotNull UUID playerId)
      Gets a player's current chat channel by UUID.
      Parameters:
      playerId - The player's UUID
      Returns:
      The player's current chat channel (defaults to ChatChannel.GLOBAL)
    • setChannel

      void setChannel(@NotNull @NotNull org.bukkit.entity.Player player, @NotNull @NotNull ChatChannel channel)
      Sets a player's chat channel.
      Parameters:
      player - The player
      channel - The channel to set
    • toggleChannel

      @NotNull @NotNull ChatChannel toggleChannel(@NotNull @NotNull org.bukkit.entity.Player player)
      Toggles a player's chat channel to the next available channel.

      Cycle order: GLOBAL → TEAM → PARTY → GLOBAL, skipping channels that are not currently available to the player.

      Parameters:
      player - The player
      Returns:
      The new chat channel after toggling
    • resetChannel

      void resetChannel(@NotNull @NotNull org.bukkit.entity.Player player)
      Resets a player's chat channel back to ChatChannel.GLOBAL.
      Parameters:
      player - The player
    • canUseTeamChat

      boolean canUseTeamChat(@NotNull @NotNull org.bukkit.entity.Player player)
      Checks if a player can use team chat.

      Team chat requires the player to be in a game with a team size greater than 1 and not be a spectator.

      Parameters:
      player - The player
      Returns:
      true if team chat is available
    • canUsePartyChat

      boolean canUsePartyChat(@NotNull @NotNull org.bukkit.entity.Player player)
      Checks if a player can use party chat.

      Party chat requires the player to be in a party.

      Parameters:
      player - The player
      Returns:
      true if party chat is available