Do not send packet to empty collection

This commit is contained in:
themode 2020-11-20 14:14:55 +01:00
parent 98fe83c605
commit 871cb993b4
1 changed files with 3 additions and 0 deletions

View File

@ -39,6 +39,9 @@ public final class PacketUtils {
* @param packet the packet to send to the players
*/
public static void sendGroupedPacket(@NotNull Collection<Player> players, @NotNull ServerPacket packet) {
if (players.isEmpty())
return;
final boolean success = PACKET_LISTENER_MANAGER.processServerPacket(packet, players);
if (success) {
final ByteBuf finalBuffer = createFramedPacket(packet);