Initialise ping array on startup. The code to decide when to regenerate the array is a bit iffy (Mojang!), as it relies on System.nanoTime() which is not an absolute time source.
This commit is contained in:
parent
fa94a8a99a
commit
aec53a59da
@ -1,22 +1,22 @@
|
|||||||
From d8be3082b4cc82d525e1152efc58bced681890b1 Mon Sep 17 00:00:00 2001
|
From 331f61fc74453d744df31d52edf5c9b804fb9597 Mon Sep 17 00:00:00 2001
|
||||||
From: md_5 <git@md-5.net>
|
From: md_5 <git@md-5.net>
|
||||||
Date: Sun, 26 Jan 2014 12:13:31 +1100
|
Date: Sun, 26 Jan 2014 12:13:31 +1100
|
||||||
Subject: [PATCH] Fix Ping Player Sample
|
Subject: [PATCH] Fix Ping Player Sample
|
||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||||
index a549a95..e967d17 100644
|
index 022e032..9c602b4 100644
|
||||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||||
@@ -105,6 +105,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
|
@@ -105,6 +105,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
|
||||||
private static final int TPS = 20;
|
private static final int TPS = 20;
|
||||||
private static final int TICK_TIME = 1000000000 / TPS;
|
private static final int TICK_TIME = 1000000000 / TPS;
|
||||||
public final double[] recentTps = new double[ 3 ];
|
public final double[] recentTps = new double[ 3 ];
|
||||||
+ public EntityPlayer[] pingPlayers;
|
+ public EntityPlayer[] pingPlayers = new EntityPlayer[ 0 ];
|
||||||
// Spigot end
|
// Spigot end
|
||||||
|
|
||||||
public MinecraftServer(OptionSet options, Proxy proxy) { // CraftBukkit - signature file -> OptionSet
|
public MinecraftServer(OptionSet options, Proxy proxy) { // CraftBukkit - signature file -> OptionSet
|
||||||
@@ -560,15 +561,23 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
|
@@ -561,15 +562,23 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
|
||||||
if (i - this.T >= 5000000000L) {
|
if (i - this.T >= 5000000000L) {
|
||||||
this.T = i;
|
this.T = i;
|
||||||
this.p.setPlayerSample(new ServerPingPlayerSample(this.C(), this.B()));
|
this.p.setPlayerSample(new ServerPingPlayerSample(this.C(), this.B()));
|
||||||
|
Loading…
Reference in New Issue
Block a user