mirror of
https://github.com/Minestom/Minestom.git
synced 2025-01-13 11:41:52 +01:00
*Actually important Microoptimization*
Anything that handles every single connected player should be optimized
This commit is contained in:
parent
3536bdc856
commit
12adb9a965
@ -476,9 +476,7 @@ public final class MinecraftServer {
|
|||||||
MinecraftServer.chunkViewDistance = chunkViewDistance;
|
MinecraftServer.chunkViewDistance = chunkViewDistance;
|
||||||
if (started) {
|
if (started) {
|
||||||
|
|
||||||
final Collection<Player> players = connectionManager.getOnlinePlayers();
|
for (final Player player : connectionManager.getOnlinePlayers()) {
|
||||||
|
|
||||||
players.forEach(player -> {
|
|
||||||
final Chunk playerChunk = player.getChunk();
|
final Chunk playerChunk = player.getChunk();
|
||||||
if (playerChunk != null) {
|
if (playerChunk != null) {
|
||||||
|
|
||||||
@ -512,12 +510,12 @@ public final class MinecraftServer {
|
|||||||
"The entity view distance must be between 0 and 32");
|
"The entity view distance must be between 0 and 32");
|
||||||
MinecraftServer.entityViewDistance = entityViewDistance;
|
MinecraftServer.entityViewDistance = entityViewDistance;
|
||||||
if (started) {
|
if (started) {
|
||||||
connectionManager.getOnlinePlayers().forEach(player -> {
|
for (final Player player : connectionManager.getOnlinePlayers()) {
|
||||||
final Chunk playerChunk = player.getChunk();
|
final Chunk playerChunk = player.getChunk();
|
||||||
if (playerChunk != null) {
|
if (playerChunk != null) {
|
||||||
player.refreshVisibleEntities(playerChunk);
|
player.refreshVisibleEntities(playerChunk);
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user