From fea6acb1c4c52530d185828bae534fe027e25e08 Mon Sep 17 00:00:00 2001 From: ProfMobius Date: Thu, 10 Apr 2014 13:57:16 +0200 Subject: [PATCH] PlayerList is sent every 2 seconds. --- mcp/mobius/opis/events/OpisServerTickHandler.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/mcp/mobius/opis/events/OpisServerTickHandler.java b/mcp/mobius/opis/events/OpisServerTickHandler.java index 7b66b39..9066b8e 100644 --- a/mcp/mobius/opis/events/OpisServerTickHandler.java +++ b/mcp/mobius/opis/events/OpisServerTickHandler.java @@ -50,6 +50,7 @@ public enum OpisServerTickHandler implements ITickHandler { public int profilerRunningTicks; public long timer500 = System.nanoTime(); public long timer1000 = System.nanoTime(); + public long timer2000 = System.nanoTime(); public long timer5000 = System.nanoTime(); public HashMap cachedAccess = new HashMap(); @@ -108,13 +109,17 @@ public enum OpisServerTickHandler implements ITickHandler { ((ProfilerPacket)ProfilerSection.PACKET_OUTBOUND.getProfiler()).dataAmount = 0L; } + // Two second timer + if (System.nanoTime() - timer2000 > 2000000000L){ + timer2000 = System.nanoTime(); + OpisPacketHandler.sendPacketToAllSwing(NetDataList.create(Message.LIST_PLAYERS, EntityManager.INSTANCE.getAllPlayers())); + } + // Five second timer if (System.nanoTime() - timer5000 > 5000000000L){ timer5000 = System.nanoTime(); updatePlayers(); - OpisPacketHandler.sendPacketToAllSwing(NetDataList.create(Message.LIST_PLAYERS, EntityManager.INSTANCE.getAllPlayers())); - OpisPacketHandler.sendPacketToAllSwing(NetDataList.create(Message.LIST_PACKETS_OUTBOUND, ((ProfilerPacket)ProfilerSection.PACKET_OUTBOUND.getProfiler()).data)); OpisPacketHandler.sendPacketToAllSwing(NetDataList.create(Message.LIST_PACKETS_INBOUND, ((ProfilerPacket)ProfilerSection.PACKET_INBOUND.getProfiler()).data));