public class PacketSendingEvent extends Object implements SessionEvent
| Constructor and Description |
|---|
PacketSendingEvent(Session session,
Packet packet)
Creates a new PacketSendingEvent instance.
|
| Modifier and Type | Method and Description |
|---|---|
void |
call(SessionListener listener)
Calls the event.
|
<T extends Packet> |
getPacket()
Gets the packet involved in this event as the required type.
|
Session |
getSession()
Gets the session involved in this event.
|
boolean |
isCancelled()
Gets whether the event has been cancelled.
|
void |
setCancelled(boolean cancelled)
Sets whether the event should be cancelled.
|
void |
setPacket(Packet packet)
Sets the packet that should be sent as a result of this event.
|
public Session getSession()
public <T extends Packet> T getPacket()
T - Type of the packet.IllegalStateException - If the packet's value isn't of the required type.public void setPacket(Packet packet)
packet - The packet to send.public boolean isCancelled()
public void setCancelled(boolean cancelled)
cancelled - Whether the event should be cancelled.public void call(SessionListener listener)
SessionEventcall in interface SessionEventlistener - Listener to call the event on.Copyright © 2022. All rights reserved.