mirror of
https://github.com/Minestom/Minestom.git
synced 2024-12-29 04:28:21 +01:00
Flush packets before computing mspt
Signed-off-by: TheMode <themode@outlook.fr>
This commit is contained in:
parent
b94d196021
commit
eca9b5e32d
@ -182,6 +182,11 @@ public final class UpdateManager {
|
|||||||
// Server tick (chunks/entities)
|
// Server tick (chunks/entities)
|
||||||
serverTick(tickStart);
|
serverTick(tickStart);
|
||||||
|
|
||||||
|
// Flush all waiting packets
|
||||||
|
PacketUtils.flush();
|
||||||
|
connectionManager.getOnlinePlayers().parallelStream().forEach(player ->
|
||||||
|
player.getPlayerConnection().flush());
|
||||||
|
|
||||||
// the time that the tick took in nanoseconds
|
// the time that the tick took in nanoseconds
|
||||||
final long tickTime = System.nanoTime() - currentTime;
|
final long tickTime = System.nanoTime() - currentTime;
|
||||||
|
|
||||||
@ -199,11 +204,6 @@ public final class UpdateManager {
|
|||||||
Acquirable.resetAcquiringTime();
|
Acquirable.resetAcquiringTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Flush all waiting packets
|
|
||||||
PacketUtils.flush();
|
|
||||||
connectionManager.getOnlinePlayers().parallelStream().forEach(player ->
|
|
||||||
player.getPlayerConnection().flush());
|
|
||||||
|
|
||||||
// Disable thread until next tick
|
// Disable thread until next tick
|
||||||
LockSupport.parkNanos((long) ((MinecraftServer.TICK_MS * 1e6) - tickTime));
|
LockSupport.parkNanos((long) ((MinecraftServer.TICK_MS * 1e6) - tickTime));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
Loading…
Reference in New Issue
Block a user