Skip to content
This repository has been archived by the owner on Jul 15, 2022. It is now read-only.

Commit

Permalink
Merge pull request #182 from SpigotMC/master
Browse files Browse the repository at this point in the history
Merge SpigotMC
  • Loading branch information
sleiss authored Sep 26, 2017
2 parents e5f4d90 + 95c004f commit 9d5ade5
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
3 changes: 3 additions & 0 deletions proxy/src/main/java/net/md_5/bungee/ServerConnection.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ public class ServerConnection implements Server
private boolean isObsolete;
@Getter
private final boolean forgeServer = false;
@Getter
@Setter
private long sentPingId = -1;

private final Unsafe unsafe = new Unsafe()
{
Expand Down
3 changes: 0 additions & 3 deletions proxy/src/main/java/net/md_5/bungee/UserConnection.java
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,6 @@ public final class UserConnection implements ProxiedPlayer
/*========================================================================*/
@Getter
@Setter
private long sentPingId;
@Getter
@Setter
private long sentPingTime;
@Getter
@Setter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@ public void handle(PacketWrapper packet) throws Exception
@Override
public void handle(KeepAlive alive) throws Exception
{
con.setSentPingId(alive.getRandomId());
con.setSentPingTime(System.currentTimeMillis());
server.setSentPingId( alive.getRandomId() );
con.setSentPingTime( System.currentTimeMillis() );
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,14 @@ public void handle(PacketWrapper packet) throws Exception
@Override
public void handle(KeepAlive alive) throws Exception
{
if ( alive.getRandomId() == con.getSentPingId() )
if ( alive.getRandomId() == con.getServer().getSentPingId() )
{
int newPing = (int) ( System.currentTimeMillis() - con.getSentPingTime() );
con.getTabListHandler().onPingChange( newPing );
con.setPing( newPing );
} else
{
throw CancelSendSignal.INSTANCE;
}
}

Expand Down

0 comments on commit 9d5ade5

Please sign in to comment.