Class NetworkChannelPacketReceiveEvent
java.lang.Object
eu.cloudnetservice.driver.event.Event
eu.cloudnetservice.driver.event.events.network.NetworkEvent
eu.cloudnetservice.driver.event.events.network.NetworkChannelPacketReceiveEvent
- All Implemented Interfaces:
Cancelable
An event fired always when a packet is received in a channel. Reads to the packet buffer will get reflected down the
line.
- Since:
- 4.0
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionNetworkChannelPacketReceiveEvent(@NonNull NetworkChannel channel, @NonNull Packet packet) Creates a new instance of this network event. -
Method Summary
Methods inherited from class eu.cloudnetservice.driver.event.events.network.NetworkEvent
networkChannel
-
Field Details
-
packet
-
cancelled
private boolean cancelled
-
-
Constructor Details
-
NetworkChannelPacketReceiveEvent
public NetworkChannelPacketReceiveEvent(@NonNull @NonNull NetworkChannel channel, @NonNull @NonNull Packet packet) Creates a new instance of this network event.- Parameters:
channel- the channel which is associated with this event.packet- the packet which was received.- Throws:
NullPointerException- if the given channel or packet is null.
-
-
Method Details
-
packet
Get the packet which got send by the other network component.- Returns:
- the packet which got send.
-
cancelled
public boolean cancelled()Gets the cancellation state of the event. A cancelled event will stop the execution of the representing change in the system, but will be passed to all event listeners nevertheless.- Specified by:
cancelledin interfaceCancelable- Returns:
- true if this is cancelled, false otherwise.
-
cancelled
public void cancelled(boolean cancelled) Marks this event as cancelled and stops the execution of the representing change in the system. The event will be passed to other event listeners down the line anyway.- Specified by:
cancelledin interfaceCancelable- Parameters:
cancelled- true if this event should get marked as cancelled, false otherwise.
-