Skip to content
This repository has been archived by the owner on Feb 24, 2024. It is now read-only.

Commit

Permalink
move sendEvent back
Browse files Browse the repository at this point in the history
  • Loading branch information
MelonHell committed Dec 15, 2023
1 parent 25cb39b commit cc87751
Showing 1 changed file with 4 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -341,25 +341,16 @@ public void setNonce(byte[] nonce) {
this.nonce = nonce;
}

/**
* Send Server Packet Event.
*
* @return {@link PlayerPacketOutEvent::isCancelled} state
**/
private boolean sendEvent(SendablePacket packet) {
private void writePacket(SendablePacket packet, boolean compressed, boolean async) {
if (!channel.isConnected()) return;
final Player player = getPlayer();
// Outgoing event
if (player != null && outgoing.hasListener()) {
final ServerPacket serverPacket = SendablePacket.extractServerPacket(getServerState(), packet);
PlayerPacketOutEvent event = new PlayerPacketOutEvent(player, serverPacket);
outgoing.call(event);
return event.isCancelled();
if (event.isCancelled()) return;
}
return false;
}

private void writePacket(SendablePacket packet, boolean compressed, boolean async) {
if (!channel.isConnected()) return;
if (sendEvent(packet)) return;
// Write packet
// WARNING: A cached or framed packet will currently never go through writeServerPacketSync,
// so a state change inside one of them will never actually be triggered. Currently, cached
Expand Down

0 comments on commit cc87751

Please sign in to comment.