Set<Plugin> plugins = new HashSet<Plugin>();
// Obtain all plugins that have a listener (ignore monitors)
boolean outGoing = packetType.isOutGoing();
com.comphenix.protocol.PacketType comType = getPacketType(packetType);
for (com.comphenix.protocol.events.PacketListener listener : ProtocolLibrary.getProtocolManager().getPacketListeners()) {
final ListeningWhitelist whitelist;
if (outGoing) {
whitelist = listener.getSendingWhitelist();
} else {
whitelist = listener.getReceivingWhitelist();
}
if (whitelist.getPriority() != ListenerPriority.MONITOR && whitelist.getTypes().contains(comType)) {
plugins.add(listener.getPlugin());
}
}
return plugins;
}