diff --git a/src/main/java/net/minestom/server/network/socket/Server.java b/src/main/java/net/minestom/server/network/socket/Server.java index 5d0f32a05..8fda5710f 100644 --- a/src/main/java/net/minestom/server/network/socket/Server.java +++ b/src/main/java/net/minestom/server/network/socket/Server.java @@ -18,7 +18,7 @@ public final class Server { public static final Logger LOGGER = LoggerFactory.getLogger(Server.class); public static final int WORKER_COUNT = Integer.getInteger("minestom.workers", Runtime.getRuntime().availableProcessors() * 2); - public static final int SOCKET_BUFFER_SIZE = Integer.getInteger("minestom.buffer-size", 65535); + public static final int SOCKET_BUFFER_SIZE = Integer.getInteger("minestom.buffer-size", 262_143); public static final int MAX_PACKET_SIZE = 2_097_151; // 3 bytes var-int public static final boolean NO_DELAY = true; diff --git a/src/main/java/net/minestom/server/utils/PacketUtils.java b/src/main/java/net/minestom/server/utils/PacketUtils.java index a536ce824..ca94f3388 100644 --- a/src/main/java/net/minestom/server/utils/PacketUtils.java +++ b/src/main/java/net/minestom/server/utils/PacketUtils.java @@ -191,6 +191,6 @@ public final class PacketUtils { public static ByteBuffer allocateTrimmedPacket(@NotNull ServerPacket packet) { final var temp = PacketUtils.createFramedPacket(packet); - return ByteBuffer.allocate(temp.position()).put(temp.flip()); + return ByteBuffer.allocateDirect(temp.position()).put(temp.flip()); } }