Package me.hackware.api.event.impl
Class PacketEvent
java.lang.Object
me.hackware.api.event.Event
me.hackware.api.event.impl.PacketEvent
Fired when a packet is sent (SEND) or received (RECEIVE).
Cancellable — cancelling a SEND prevents this packet from being sent,
and cancelling a RECEIVE prevents it from being processed.
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionPacketEvent(net.minecraft.network.protocol.Packet<?> packet, PacketEvent.Direction direction) -
Method Summary
Modifier and TypeMethodDescription<T extends net.minecraft.network.protocol.Packet<?>>
TCast the packet to a specific type (unchecked — callis(java.lang.Class<? extends net.minecraft.network.protocol.Packet<?>>)first).net.minecraft.network.protocol.Packet<?> The packet being sent or received.booleanCheck whether the packet is an instance of a specific type.booleanbooleanisSend()Methods inherited from class me.hackware.api.event.Event
cancel, isCancelled
-
Constructor Details
-
PacketEvent
public PacketEvent(net.minecraft.network.protocol.Packet<?> packet, PacketEvent.Direction direction)
-
-
Method Details
-
getPacket
public net.minecraft.network.protocol.Packet<?> getPacket()The packet being sent or received. -
getDirection
-
isSend
public boolean isSend() -
isReceive
public boolean isReceive() -
is
Check whether the packet is an instance of a specific type.if (event.is(ServerboundSwingPacket.class)) { ... } -
as
Cast the packet to a specific type (unchecked — callis(java.lang.Class<? extends net.minecraft.network.protocol.Packet<?>>)first).
-