Skip to content

API Reference

VoiceHub provides a public API for other mods to integrate with.

VoiceHubAPI api = VoiceHubAPI.getInstance();
if (VoiceHubAPI.isAvailable()) {
// VoiceHub is loaded and ready
}

VoiceHub is standalone — use reflection-based access if you don’t want a compile dependency:

try {
Class<?> apiClass = Class.forName("com.kyuubisoft.voicehub.api.VoiceHubAPI");
Method getInstance = apiClass.getMethod("getInstance");
Object api = getInstance.invoke(null);
// Use reflection to call methods
} catch (ClassNotFoundException e) {
// VoiceHub not installed
}
MethodReturnsDescription
createChannel(name, type, owner)VoiceChannelCreate a channel
createChannel(name, type, owner, password)VoiceChannelCreate with password
createChannelWithPermission(name, type, owner, joinPerm)VoiceChannelCreate permission-locked persistent channel
deleteChannel(channelId)booleanDelete a channel
getChannel(channelId)VoiceChannelGet channel by ID
listChannels()List<VoiceChannel>All channels
listChannels(type)List<VoiceChannel>Filter by type
MethodReturnsDescription
joinChannel(player, channelId, password)booleanJoin a channel
leaveChannel(player)booleanLeave current channel
getPlayerChannel(player)VoiceChannelGet player’s current channel
isInChannel(player)booleanIs player in any channel?
isInChannel(player, channelId)booleanIs player in specific channel?
MethodReturnsDescription
muteInChannel(channelId, player)booleanMute player in channel
unmuteInChannel(channelId, player)booleanUnmute player
kickFromChannel(channelId, player)booleanKick player
setChannelPassword(channelId, password)booleanSet password
MethodReturnsDescription
promoteToMod(channelId, player)booleanPromote to moderator
demoteFromMod(channelId, player)booleanDemote from moderator
getPermission(channelId, player)ChannelPermissionGet permission level
MethodReturnsDescription
setModerated(channelId, moderated)booleanToggle moderated mode
grantTalkPower(channelId, player)booleanGrant talk power
revokeTalkPower(channelId, player)booleanRevoke talk power
revokeAllTalkPower(channelId)booleanRevoke all talk power
requestTalkPower(channelId, player)booleanRequest talk power
hasTalkPower(channelId, player)booleanCheck talk power
getTalkRequests(channelId)Set<UUID>Get pending requests
MethodReturnsDescription
setProximityRange(blocks)voidSet hearing distance
getProximityRange()floatGet hearing distance
setFullVolumeDistance(blocks)voidSet full-volume distance
getFullVolumeDistance()floatGet full-volume distance
MethodReturnsDescription
isPlayerSpeaking(player)booleanIs player currently speaking?
getActiveChannelCount()intNumber of active channels
getTotalVoiceUsers()intTotal users in channels
VoiceHubAPI.getInstance().registerChannelJoinListener(event -> {
UUID player = event.playerUuid();
String channel = event.channelId();
// Player joined a channel
});
VoiceHubAPI.getInstance().registerChannelLeaveListener(event -> {
// Player left a channel
});
// Create a party channel for a dungeon group
VoiceChannel ch = VoiceHubAPI.getInstance()
.createChannel("Dungeon Party", ChannelType.GROUP, partyLeaderUuid);
// Add all party members
for (UUID member : partyMembers) {
VoiceHubAPI.getInstance().joinChannel(member, ch.getId(), null);
}
// After dungeon completion, delete the channel
VoiceHubAPI.getInstance().deleteChannel(ch.getId());