public class PacketEvent
extends java.util.EventObject
implements org.bukkit.event.Cancellable
Constructor and Description |
---|
PacketEvent(java.lang.Object source)
Use the static constructors to create instances of this event.
|
Modifier and Type | Method and Description |
---|---|
static PacketEvent |
fromClient(java.lang.Object source,
PacketContainer packet,
org.bukkit.entity.Player client)
Creates an event representing a client packet transmission.
|
static PacketEvent |
fromServer(java.lang.Object source,
PacketContainer packet,
org.bukkit.entity.Player recipient)
Creates an event representing a server packet transmission.
|
PacketContainer |
getPacket()
Retrieves the packet that will be sent to the player.
|
int |
getPacketID()
Retrieves the packet ID.
|
org.bukkit.entity.Player |
getPlayer()
Retrieves the player that has sent the packet or is recieving it.
|
boolean |
isCancelled()
Retrieves whether or not the packet should be cancelled.
|
boolean |
isServerPacket()
Whether or not this packet was created by the server.
|
void |
setCancelled(boolean cancel)
Sets whether or not the packet should be cancelled.
|
void |
setPacket(PacketContainer packet)
Replace the packet that will be sent to the player.
|
public PacketEvent(java.lang.Object source)
source
- - the event source.public static PacketEvent fromClient(java.lang.Object source, PacketContainer packet, org.bukkit.entity.Player client)
source
- - the event source.packet
- - the packet.client
- - the client that sent the packet.public static PacketEvent fromServer(java.lang.Object source, PacketContainer packet, org.bukkit.entity.Player recipient)
source
- - the event source.packet
- - the packet.recipient
- - the client that will receieve the packet.public PacketContainer getPacket()
public void setPacket(PacketContainer packet)
packet
- - the packet that will be sent instead.public int getPacketID()
public boolean isCancelled()
isCancelled
in interface org.bukkit.event.Cancellable
public void setCancelled(boolean cancel)
setCancelled
in interface org.bukkit.event.Cancellable
cancel
- - TRUE if it should be cancelled, FALSE otherwise.public org.bukkit.entity.Player getPlayer()
public boolean isServerPacket()