PrePlaySoundEvent
Event Details
Property
Type
Description
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