PrePlaySoundEvent
The PrePlaySoundEvent
is a custom event in the MelodyMine plugin. This event is triggered before a sound is played in the client for players. It provides information about the sound that is about to be played, such as the sound name, whether the sound is sent to all players, the socket ID of the player who will receive the sound, and the volume of the sound.
Event Details
soundName
String
The name of the sound that is about to be played.
sendToAll
Boolean
Indicates whether the sound is sent to all players.
socketID
String
The socket ID of the player who will receive the sound.
volume
Double
The volume of the sound.
Example Usage
Here is an example of how to listen to this event using the Bukkit event API in Java:
In this example, we create a listener for the PrePlaySoundEvent
. When the event is triggered, we retrieve the details of the sound that is about to be played and log them to the console.
Remember to register your listener in your plugin's onEnable
method to ensure that it listens to the events.
Last updated