PreSendSoundSettingsEvent
Class Structure
Method/Variable
Type
Description
socketID
String
The ID of the socket to which the sound settings are being sent.
isCancelled
Boolean
A flag indicating whether the event is cancelled. If true, the sound settings will not be sent.
Example Usage
Here is an example of how to listen to this event:
import ir.taher7.melodymine.api.events.PreSendSoundSettingsEvent;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
public class ExampleListener implements Listener {
@EventHandler
public void onPreSendSoundSettings(PreSendSoundSettingsEvent event) {
// Get the socket ID
String socketID = event.getSocketID();
// Log the socket ID to the console
Bukkit.getLogger().info("Preparing to send sound settings to socket: " + socketID);
// You can cancel the event like this
// event.setCancelled(true);
}
}
Remember to register your listener in your plugin's onEnable
method to ensure that it's active.
@Override
public void onEnable() {
getServer().getPluginManager().registerEvents(new ExampleListener(), this);
}
This listener will log the ID of the socket to which the sound settings are being sent every time the PreSendSoundSettingsEvent
is triggered. You can also cancel the event to prevent the sound settings from being sent.
Last updated