PostEnableVoiceEvent

PostEnableVoiceEvent

The PostEnableVoiceEvent is a custom event in the MelodyMine plugin. This event is triggered after a player enables their voice chat. It provides information about the player who enabled their voice chat.

Event Details

FieldTypeDescription

playerName

String

The name of the player who enabled their voice chat.

playerUuid

String

The UUID of the player who enabled their voice chat.

playerServer

String

The server of the player who enabled their voice chat.

targetSocketID

String

The socket ID of the player who enabled their voice chat.

Methods

MethodReturn TypeDescription

getPlayer()

MelodyPlayer

Returns the MelodyPlayer instance of the player who enabled their voice chat.

getTargetPlayer()

MelodyPlayer

Returns the MelodyPlayer instance of the player who is the target of the voice chat.

Example Usage

Here is an example of how to listen to this event using the Bukkit event API in Java:

import ir.taher7.melodymine.api.events.PostEnableVoiceEvent;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;

public class MyListener implements Listener {

    @EventHandler
    public void onPostEnableVoice(PostEnableVoiceEvent event) {
        // Get the player's name who enabled their voice chat
        String playerName = event.getPlayerName();

        // Log the player's name to the console
        Bukkit.getLogger().info(playerName + " has enabled their voice chat.");
    }
}

In this example, we create a listener for the PostEnableVoiceEvent. When the event is triggered, we retrieve the name of the player who enabled their voice chat and log it to the console.

Last updated