PreSendQRCodeEvent
The PreSendQRCodeEvent
is a custom event in the Bukkit API. It is triggered before a QR code is sent to a player. This event is cancellable, meaning you can prevent the QR code from being sent to the player by cancelling this event in your event handler.
Class Structure
getPlayer()
Player
Returns the player to whom the QR code is about to be sent.
isCancelled()
boolean
Checks if the event is cancelled.
setCancelled(boolean)
void
Sets the cancellation state of this event. A cancelled event will not be executed in the server, but will still pass to other plugins.
Example Usage
Here is an example of how to listen to this event using the Bukkit event API:
In this example, we're listening for the PreSendQRCodeEvent
. When the event is triggered, we're logging a message to the console. If the player's name is "TAHER7", we're cancelling the event, which prevents the QR code from being sent, and logging another message to the console.
Remember to register your event listener in your plugin's onEnable()
method, otherwise Bukkit won't know to pass events to it.
Last updated