Class PulsePacketSendEvent
java.lang.Object
org.bukkit.event.Event
dev.pulsemc.pulse.api.events.network.PulsePacketSendEvent
- All Implemented Interfaces:
Cancellable
Triggered when a packet is about to be added to the Pulse buffer.
This event is called synchronously on the main thread before any optimization logic. You can use this event to modify the packet, cancel it, or force immediate sending.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.bukkit.event.Event
Event.Result -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanChecks if this packet is allowed to be optimized.static HandlerListGets the raw packet being sent.Gets the player receiving this packet.booleanbooleanChecks if immediate sending is requested.voidsetCanBeOptimized(boolean can) Sets whether this packet can be optimized by the engine.voidsetCancelled(boolean cancel) voidsetForceSendImmediately(boolean force) Sets whether this packet should bypass the buffer and be sent immediately.voidReplaces the packet with a modified one.Methods inherited from class org.bukkit.event.Event
callEvent, getEventName, isAsynchronous
-
Constructor Details
-
PulsePacketSendEvent
-
-
Method Details
-
getPlayer
Gets the player receiving this packet.- Returns:
- the target player
-
getPacket
Gets the raw packet being sent.- Returns:
- the packet
-
setPacket
Replaces the packet with a modified one.- Parameters:
packet- the new packet
-
setCanBeOptimized
public void setCanBeOptimized(boolean can) Sets whether this packet can be optimized by the engine.- Parameters:
can- true to allow optimization, false to force individual sending.
-
canBeOptimized
public boolean canBeOptimized()Checks if this packet is allowed to be optimized.- Returns:
- true if optimization is allowed.
-
setForceSendImmediately
public void setForceSendImmediately(boolean force) Sets whether this packet should bypass the buffer and be sent immediately. If true, Pulse will flush the current buffer and send this packet instantly. Use this for latency-sensitive packets.- Parameters:
force- true to send immediately
-
isForceSendImmediately
public boolean isForceSendImmediately()Checks if immediate sending is requested.- Returns:
- true if forced
-
isCancelled
public boolean isCancelled()- Specified by:
isCancelledin interfaceCancellable
-
setCancelled
public void setCancelled(boolean cancel) - Specified by:
setCancelledin interfaceCancellable
-
getHandlers
- Specified by:
getHandlersin classEvent
-
getHandlerList
-