Package dev.itsharshxd.zentrix.api.chat
Interface ChatChannelService
public interface ChatChannelService
Manages player chat channels in Zentrix.
Players can switch between global, team, and party chat. Available channels depend on the player's current state, such as being in a game or party.
Example
ChatChannelService chatService = ZentrixAPI.get().getChatChannelService();
// Get the player's current channel
ChatChannel channel = chatService.getChannel(player);
// Switch to team chat when available
if (chatService.canUseTeamChat(player)) {
chatService.setChannel(player, ChatChannel.TEAM);
}
// Move to the next available channel
ChatChannel newChannel = chatService.toggleChannel(player);
player.sendMessage("Switched to " + newChannel.getId() + " chat");
- Since:
- 1.2.0
-
Method Summary
Modifier and TypeMethodDescriptionbooleancanUsePartyChat(@NotNull org.bukkit.entity.Player player) Checks if a player can use party chat.booleancanUseTeamChat(@NotNull org.bukkit.entity.Player player) Checks if a player can use team chat.@NotNull ChatChannelgetChannel(@NotNull UUID playerId) Gets a player's current chat channel by UUID.@NotNull ChatChannelgetChannel(@NotNull org.bukkit.entity.Player player) Gets a player's current chat channel.voidresetChannel(@NotNull org.bukkit.entity.Player player) Resets a player's chat channel back toChatChannel.GLOBAL.voidsetChannel(@NotNull org.bukkit.entity.Player player, @NotNull ChatChannel channel) Sets a player's chat channel.@NotNull ChatChanneltoggleChannel(@NotNull org.bukkit.entity.Player player) Toggles a player's chat channel to the next available channel.
-
Method Details
-
getChannel
Gets a player's current chat channel.- Parameters:
player- The player- Returns:
- The player's current chat channel (defaults to
ChatChannel.GLOBAL)
-
getChannel
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 playerchannel- The channel to set
-
toggleChannel
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 toChatChannel.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:
trueif 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:
trueif party chat is available
-