Prevent stream allocation when viewable packets are disabled

Signed-off-by: TheMode <themode@outlook.fr>
This commit is contained in:
TheMode 2021-11-20 13:56:59 +01:00
parent fc3fbe83f0
commit 6ed55a68c0
1 changed files with 4 additions and 2 deletions

View File

@ -161,8 +161,10 @@ public final class PacketUtils {
@ApiStatus.Internal
public static void flush() {
VIEWABLE_STORAGE_MAP.entrySet().parallelStream().forEach(entry ->
entry.getValue().process(entry.getKey()));
if (VIEWABLE_PACKET) {
VIEWABLE_STORAGE_MAP.entrySet().parallelStream().forEach(entry ->
entry.getValue().process(entry.getKey()));
}
}
public static void writeFramedPacket(@NotNull ByteBuffer buffer,