mirror of
https://github.com/ViaVersion/ViaVersion.git
synced 2024-11-22 10:05:12 +01:00
parent
a613edcb42
commit
58e7455cd9
@ -7,17 +7,19 @@ import us.myles.ViaVersion.protocols.protocol1_9to1_8.providers.MovementTransmit
|
||||
import us.myles.ViaVersion.protocols.protocol1_9to1_8.storage.MovementTracker;
|
||||
|
||||
public class ViaIdleThread implements Runnable {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
for (UserConnection info : Via.getManager().getConnections()) {
|
||||
ProtocolInfo protocolInfo = info.getProtocolInfo();
|
||||
if (protocolInfo != null && protocolInfo.getPipeline().contains(Protocol1_9To1_8.class)) {
|
||||
long nextIdleUpdate = info.get(MovementTracker.class).getNextIdlePacket();
|
||||
if (nextIdleUpdate <= System.currentTimeMillis()) {
|
||||
if (info.getChannel().isOpen()) {
|
||||
Via.getManager().getProviders().get(MovementTransmitterProvider.class).sendPlayer(info);
|
||||
}
|
||||
}
|
||||
if (protocolInfo == null || !protocolInfo.getPipeline().contains(Protocol1_9To1_8.class)) continue;
|
||||
|
||||
MovementTracker movementTracker = info.get(MovementTracker.class);
|
||||
if (movementTracker == null) continue;
|
||||
|
||||
long nextIdleUpdate = movementTracker.getNextIdlePacket();
|
||||
if (nextIdleUpdate <= System.currentTimeMillis() && info.getChannel().isOpen()) {
|
||||
Via.getManager().getProviders().get(MovementTransmitterProvider.class).sendPlayer(info);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user