Example
Global voice channel
note
- The example below is whats needed to create a global voice channel where anyone can talk.
public class CBVoicePlugin extends JavaPlugin
{
@Override
public void onEnable()
{
CheatBreakerAPI.getInstance().voiceEnabled(true);
final VoiceChannel publicVoiceChannel = new VoiceChannel("Public Channel");
CheatBreakerAPI.getInstance().createVoiceChannels(publicVoiceChannel);
getServer().getPluginManager().registerEvents(
new Listener() {
@EventHandler
public void onPlayerJoin(PlayerJoinEvent event) {
publicVoiceChannel.addPlayer(event.getPlayer());
CheatBreakerAPI.getInstance().setActiveChannel(event.getPlayer(), publicVoiceChannel);
}
}, this
);
}
}