PrePlayerSetSelfMuteEvent
Event Details
Field
Type
Description
Example Usage
import ir.taher7.melodymine.api.events.PrePlayerSetSelfMuteEvent;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.plugin.java.JavaPlugin;
public class ExampleListener implements Listener {
private JavaPlugin plugin;
public ExampleListener(JavaPlugin plugin) {
this.plugin = plugin;
}
@EventHandler
public void onPrePlayerSetSelfMute(PrePlayerSetSelfMuteEvent event) {
// Get the player and the new mute status
MelodyPlayer player = event.getMelodyPlayer();
boolean newMuteStatus = event.getValue();
// Log the information to the console
plugin.getLogger().info(player.getName() + " is about to change their self-mute status to: " + newMuteStatus);
// If the new mute status is true, cancel the event
if (newMuteStatus) {
event.setCancelled(true);
plugin.getLogger().info("Cancelled the self-mute status change for " + player.getName());
}
}
}Last updated