// Handle listeners
PacketType type = PacketType.getType(packet);
List<PacketListener> listenerList = listeners.get(type);
if (listenerList != null) {
CommonPacket cp = new CommonPacket(packet, type);
PacketSendEvent ev = new PacketSendEvent(player, cp);
ev.setCancelled(wasCancelled);
for (PacketListener listener : listenerList) {
listener.onPacketSend(ev);
}
if (ev.isCancelled()) {
return false;
}
}
// Handle monitors
handlePacketSendMonitor(player, type, packet);