youknowwhoim_
📎 1 file 1,349 chars
📄
pasted-code-1788678628189.txt
txt 33 lines
▶
Create a simple Minecraft proximity voice chat plugin.

Requirements:

Players can use voice chat without entering or selecting any special mode.
Voice chat should work automatically when a player joins the server.
Players can talk to nearby players using proximity voice chat.
Add an invite system so a player can invite another player to a private voice chat.

Commands:

/voicechat invite  — invite a player to your private voice chat.
/voicechat accept — accept a voice-chat invitation.
/voicechat deny — deny an invitation.
/voicechat leave — leave the current private voice chat.
/voicechat help — show all available commands.

The plugin should:

Have a simple, user-friendly system.
Require no /voicechat mode or mode selection.
Automatically handle voice-chat connections.
Show clear messages when someone sends, accepts, denies, or leaves an invitation.
Prevent players from joining a private voice chat without an invitation.
Support multiple private voice-chat groups.
Clean up voice groups when everyone leaves.
Include permission checks where appropriate.
Make the commands tab-completable.
Store configuration in a simple YAML configuration file.

The main goal is: install the plugin, join the server, and immediately be able to use voice chat. The only command needed to invite someone should be:

/voicechat invite 
Kodari AI
KodariSep 6 at 7:13 am 2
ProximityVoiceChat
A Minecraft plugin providing automatic proximity voice chat and private voice chat groups. Players can talk to nearby players without any setup or mode selection. The plugin includes an invite system with commands to invite, accept, deny, and leave private voice chats. It supports multiple simultaneous private groups, automatically cleans up empty groups, includes permission checks, tab completion for commands, and YAML configuration. Clear messages notify players of invitation events. The plugin requires no special mode selection—voice chat works immediately upon joining the server.
  1. Create the Gradle/plugin foundation and YAML configuration.

  2. Add Simple Voice Chat integration with automatic proximity voice and private groups.

  3. Add invite commands, permissions, tab completion, messaging, and lifecycle cleanup.

Created the KodariVoiceChat plugin with:

  • Automatic Simple Voice Chat proximity support.

  • Invitation-only private isolated voice groups.

  • /voicechat invite <player>

  • /voicechat accept

  • /voicechat deny

  • /voicechat leave

  • /voicechat help

  • Permissions and tab completion.

  • Configurable group names, invitation expiry, and messages.

  • Voice connection validation.

  • Group cleanup when players leave, disconnect, or the server shuts down.

  • Simple Voice Chat plugin dependency declaration.

  • Gradle Java 21 project configuration.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
settings.gradle
Code
9 619
src/main/java/com/kodari/voicechat/VoiceChatPlugin.java
package com.kodari.voicechat;

import com.kodari.voicechat.command.VoiceChatCommand;
import com.kodari.voicechat.integration.VoiceChatIntegration;
import com.kodari.voicechat.manager.PrivateVoiceManager;
import com.kodari.voicechat.listener.BukkitVoiceChatListener;
import de.maxhenkel.voicechat.api.BukkitVoicechatService;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;

public final class VoiceChatPlugin extends JavaPlugin {

    private PrivateVoiceManager privateVoiceManager;

    @Override
    public void onEnable() {
        saveDefaultConfig();

        privateVoiceManager = new PrivateVoiceManager(this);
        Bukkit.getPluginManager().registerEvents(new BukkitVoiceChatListener(privateVoiceManager), this);

        VoiceChatCommand command = new VoiceChatCommand(privateVoiceManager);
        if (getCommand("voicechat") != null) {
            getCommand("voicechat").setExecutor(command);
            getCommand("voicechat").setTabCompleter(command);
        }

        BukkitVoicechatService service = getServer().getServicesManager().load(BukkitVoicechatService.class);
        if (service == null) {
            getLogger().severe("Simple Voice Chat was not available. Disabling plugin.");
            getServer().getPluginManager().disablePlugin(this);
            return;
        }

        service.registerPlugin(new VoiceChatIntegration(privateVoiceManager));
        getLogger().info("Automatic proximity voice chat enabled.");
    }

    @Override
    public void onDisable() {
        if (privateVoiceManager != null) {
            privateVoiceManager.shutdown();
        }
    }
}