Class NetworkChannelPacketSendEvent

java.lang.Object
eu.cloudnetservice.driver.event.Event
eu.cloudnetservice.driver.event.events.network.NetworkEvent
eu.cloudnetservice.driver.event.events.network.NetworkChannelPacketSendEvent
All Implemented Interfaces:
Cancelable

public final class NetworkChannelPacketSendEvent extends NetworkEvent implements Cancelable
An event fired before a packet gets sent to another network component. Writes or reads to or from the buffer will be reflected down the line.
Since:
4.0
  • Field Details

    • packet

      private final Packet packet
    • cancelled

      private boolean cancelled
  • Constructor Details

    • NetworkChannelPacketSendEvent

      public NetworkChannelPacketSendEvent(@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 will get send.
      Throws:
      NullPointerException - if either the channel or packet is null.
  • Method Details

    • packet

      @NonNull public @NonNull Packet packet()
      Get the packet which is being sent.
      Returns:
      the packet which is being sent.
    • 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:
      cancelled in interface Cancelable
      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:
      cancelled in interface Cancelable
      Parameters:
      cancelled - true if this event should get marked as cancelled, false otherwise.