PostPlayerSetDeafenEvent
Event Details
Field
Type
Description
melodyPlayer
MelodyPlayer
The player whose deafen status has been set.
value
boolean
The new deafen status of the player. false
if the player is now deafened, true
otherwise.
Example Usage
Here is an example of how to listen to this event using the Bukkit event API:
import ir.taher7.melodymine.api.events.PostPlayerSetDeafenEvent;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
public class ExampleListener implements Listener {
@EventHandler
public void onPlayerSetDeafen(PostPlayerSetDeafenEvent event) {
// Get the player and the new deafen status
MelodyPlayer player = event.getMelodyPlayer();
boolean isDeafened = event.getValue();
// Log the new deafen status to the console
Bukkit.getLogger().info(player.getName() + " is now " + (isDeafened ? "not deafened" : "deafened"));
}
}
In this example, we create a listener for the PostPlayerSetDeafenEvent
. When the event is triggered, we retrieve the player and their new deafen status. We then log this information to the console.
Remember to register your event listener with the Bukkit plugin manager for your listener to receive events.
Last updated