mirror of
https://github.com/Minestom/Minestom.git
synced 2025-03-02 11:21:15 +01:00
Added networking optimization code in MainDemo
This commit is contained in:
parent
ccaf9b5c47
commit
7ebbb8bc6c
@ -6,6 +6,7 @@ import net.minestom.server.instance.*;
|
|||||||
import net.minestom.server.instance.batch.ChunkBatch;
|
import net.minestom.server.instance.batch.ChunkBatch;
|
||||||
import net.minestom.server.instance.block.Block;
|
import net.minestom.server.instance.block.Block;
|
||||||
import net.minestom.server.network.ConnectionManager;
|
import net.minestom.server.network.ConnectionManager;
|
||||||
|
import net.minestom.server.network.netty.NettyServer;
|
||||||
import net.minestom.server.utils.Position;
|
import net.minestom.server.utils.Position;
|
||||||
import net.minestom.server.world.biomes.Biome;
|
import net.minestom.server.world.biomes.Biome;
|
||||||
|
|
||||||
@ -36,6 +37,14 @@ public class MainDemo {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// OPTIONAL: optimize networking to prevent having unresponsive threads
|
||||||
|
{
|
||||||
|
NettyServer nettyServer = MinecraftServer.getNettyServer();
|
||||||
|
// Set the maximum bandwidth out and in to 500MB/s, largely enough for a single client
|
||||||
|
nettyServer.setWriteLimit(500_000);
|
||||||
|
nettyServer.setReadLimit(500_000);
|
||||||
|
}
|
||||||
|
|
||||||
// Start the server
|
// Start the server
|
||||||
minecraftServer.start("localhost", 25565);
|
minecraftServer.start("localhost", 25565);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user