PostChangeSoundVolumeEvent
Event Details
Property
Description
soundName
The name of the sound that had its volume changed.
sendToAll
A boolean indicating whether the volume change should be sent to all players.
socketID
The socket ID associated with the event.
volume
The new volume level of the sound.
Example
Here is an example of how to listen to this event using the Bukkit event API:
import ir.taher7.melodymine.api.events.PostChangeSoundVolumeEvent;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
public class VolumeChangeListener implements Listener {
@EventHandler
public void onVolumeChange(PostChangeSoundVolumeEvent event) {
// Get the Bukkit logger
Logger logger = Bukkit.getLogger();
// Log the details of the event
logger.info("Sound volume changed:");
logger.info("Sound Name: " + event.getSoundName());
logger.info("Send to All: " + event.isSendToAll());
logger.info("Socket ID: " + event.getSocketID());
logger.info("New Volume: " + event.getVolume());
}
}
In this example, we create a listener for the PostChangeSoundVolumeEvent
. When the event is triggered, we log the details of the event to the console using Bukkit's logger.
Remember to register your listener in your plugin's onEnable
method to ensure that it listens to the event.
@Override
public void onEnable() {
getServer().getPluginManager().registerEvents(new VolumeChangeListener(), this);
}
This will ensure that the VolumeChangeListener
starts listening for the PostChangeSoundVolumeEvent
when your plugin is enabled.
Last updated