PreChangeSoundVolumeEvent
The PreChangeSoundVolumeEvent
is a custom event in the MelodyMine plugin. This event is called before the volume of a sound is changed. It provides information about the sound that is about to have its volume changed, including the sound name, whether the change should be sent to all players, the socket ID of the player who initiated the change, and the new volume level.
This event is cancellable, meaning you can prevent the volume change from happening by cancelling this event in your event handler.
Event Details
soundName
String
The name of the sound that is about to have its volume changed.
sendToAll
Boolean
Whether the volume change should be sent to all players.
socketID
String
The socket ID of the player who initiated the volume change.
volume
Double
The new volume level.
Example
Here is an example of how to listen to this event using the Bukkit event API in Java:
In this example, we're logging the name of the sound and the new volume to the console whenever a sound's volume is about to be changed. If the new volume is above a certain level, we cancel the event to prevent the volume change from happening.
Last updated