mirror of
https://github.com/SpigotMC/BungeeCord.git
synced 2024-11-30 22:24:18 +01:00
Encapsulate ping fields
This commit is contained in:
parent
a1f928b210
commit
ff32764f9a
@ -54,14 +54,18 @@ public final class UserConnection implements ProxiedPlayer
|
||||
// reconnect stuff
|
||||
public int clientEntityId;
|
||||
public int serverEntityId;
|
||||
// ping stuff
|
||||
public int trackingPingId;
|
||||
public long pingTime;
|
||||
@Getter
|
||||
private String displayName;
|
||||
/*========================================================================*/
|
||||
@Getter
|
||||
@Setter
|
||||
private int ping = 1000;
|
||||
private int sentPingId;
|
||||
@Getter
|
||||
@Setter
|
||||
private long sentPingTime;
|
||||
@Getter
|
||||
@Setter
|
||||
private int ping = 100;
|
||||
/*========================================================================*/
|
||||
private final Collection<String> groups = new HashSet<>();
|
||||
private final Collection<String> permissions = new HashSet<>();
|
||||
|
@ -78,8 +78,8 @@ public class DownstreamBridge extends PacketHandler
|
||||
@Override
|
||||
public void handle(Packet0KeepAlive alive) throws Exception
|
||||
{
|
||||
con.trackingPingId = alive.id;
|
||||
con.pingTime = System.currentTimeMillis();
|
||||
con.setSentPingId( alive.id );
|
||||
con.setSentPingTime( System.currentTimeMillis() );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -74,9 +74,9 @@ public class UpstreamBridge extends PacketHandler
|
||||
@Override
|
||||
public void handle(Packet0KeepAlive alive) throws Exception
|
||||
{
|
||||
if ( alive.id == con.trackingPingId )
|
||||
if ( alive.id == con.getSentPingId() )
|
||||
{
|
||||
int newPing = (int) ( System.currentTimeMillis() - con.pingTime );
|
||||
int newPing = (int) ( System.currentTimeMillis() - con.getSentPingTime() );
|
||||
bungee.getTabListHandler().onPingChange( con, newPing );
|
||||
con.setPing( newPing );
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user