PlayerEndVoiceEvent

The PlayerEndVoiceEvent is a custom event in the MelodyMine plugin. This event is triggered when a player ends their voice session on the client. The event contains a single property, melodyPlayer, which is an instance of the MelodyPlayer class representing the player who ended their voice session.

Properties

PropertyTypeDescription

melodyPlayer

MelodyPlayer

The player who ended their voice session.

Example

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

import ir.taher7.melodymine.api.events.PlayerEndVoiceEvent;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.plugin.java.JavaPlugin;

public class MyPlugin extends JavaPlugin implements Listener {

    @Override
    public void onEnable() {
        getServer().getPluginManager().registerEvents(this, this);
    }

    @EventHandler
    public void onPlayerEndVoice(PlayerEndVoiceEvent event) {
        String playerName = event.getMelodyPlayer().getName();
        getLogger().info(playerName + " has ended their voice session.");
    }
}

In this example, we're creating a listener for the PlayerEndVoiceEvent. When a player ends their voice session, the onPlayerEndVoice method is called, and the player's name is logged to the console with a message indicating that they have ended their voice session.

Last updated