Skip to main content

API Reference

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

Access

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
}

Channel Management

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

Player Management

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?

Moderation

MethodReturnsDescription
muteInChannel(channelId, player)booleanMute player in channel
unmuteInChannel(channelId, player)booleanUnmute player
kickFromChannel(channelId, player)booleanKick player
setChannelPassword(channelId, password)booleanSet password

Permissions

MethodReturnsDescription
promoteToMod(channelId, player)booleanPromote to moderator
demoteFromMod(channelId, player)booleanDemote from moderator
getPermission(channelId, player)ChannelPermissionGet permission level

Talk Power

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

Proximity Settings

MethodReturnsDescription
setProximityRange(blocks)voidSet hearing distance
getProximityRange()floatGet hearing distance
setFullVolumeDistance(blocks)voidSet full-volume distance
getFullVolumeDistance()floatGet full-volume distance

Statistics

MethodReturnsDescription
isPlayerSpeaking(player)booleanIs player currently speaking?
getActiveChannelCount()intNumber of active channels
getTotalVoiceUsers()intTotal users in channels

Events

VoiceHubAPI.getInstance().registerChannelJoinListener(event -> {
UUID player = event.playerUuid();
String channel = event.channelId();
// Player joined a channel
});

VoiceHubAPI.getInstance().registerChannelLeaveListener(event -> {
// Player left a channel
});

Example: Quest Integration

// 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());