2014-04-02 09:00:58 +02:00
|
|
|
From 4f61b2f41522cb6201606476786d796fe8544741 Mon Sep 17 00:00:00 2001
|
2014-01-26 11:50:53 +01:00
|
|
|
From: md_5 <git@md-5.net>
|
|
|
|
Date: Sun, 26 Jan 2014 21:48:34 +1100
|
|
|
|
Subject: [PATCH] Configurable Ping Sample Size
|
|
|
|
|
|
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/PacketStatusListener.java b/src/main/java/net/minecraft/server/PacketStatusListener.java
|
|
|
|
index 7903c43..f9da452 100644
|
|
|
|
--- a/src/main/java/net/minecraft/server/PacketStatusListener.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/PacketStatusListener.java
|
|
|
|
@@ -110,6 +110,13 @@ public class PacketStatusListener implements PacketStatusInListener {
|
|
|
|
}
|
|
|
|
|
|
|
|
ServerPingPlayerSample playerSample = new ServerPingPlayerSample(event.getMaxPlayers(), profiles.size());
|
|
|
|
+ // Spigot Start
|
|
|
|
+ if ( !profiles.isEmpty() )
|
|
|
|
+ {
|
|
|
|
+ java.util.Collections.shuffle( profiles ); // This sucks, its inefficient but we have no simple way of doing it differently
|
|
|
|
+ profiles = profiles.subList( 0, Math.min( profiles.size(), org.spigotmc.SpigotConfig.playerSample ) ); // Cap the sample to n (or less) displayed players, ie: Vanilla behaviour
|
|
|
|
+ }
|
|
|
|
+ // Spigot End
|
|
|
|
playerSample.a(profiles.toArray(new GameProfile[profiles.size()]));
|
|
|
|
|
|
|
|
ServerPing ping = new ServerPing();
|
|
|
|
diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java
|
2014-04-02 09:00:58 +02:00
|
|
|
index 2baed09..8eac742 100644
|
2014-01-26 11:50:53 +01:00
|
|
|
--- a/src/main/java/org/spigotmc/SpigotConfig.java
|
|
|
|
+++ b/src/main/java/org/spigotmc/SpigotConfig.java
|
2014-04-02 09:00:58 +02:00
|
|
|
@@ -249,4 +249,11 @@ public class SpigotConfig
|
2014-01-26 11:50:53 +01:00
|
|
|
{
|
|
|
|
commands.put( "tps", new TicksPerSecondCommand( "tps" ) );
|
|
|
|
}
|
|
|
|
+
|
|
|
|
+ public static int playerSample;
|
|
|
|
+ private static void playerSample()
|
|
|
|
+ {
|
|
|
|
+ playerSample = getInt( "settings.sample-count", 12 );
|
|
|
|
+ System.out.println( "Server Ping Player Sample Count: " + playerSample );
|
|
|
|
+ }
|
|
|
|
}
|
|
|
|
--
|
2014-04-02 09:00:58 +02:00
|
|
|
1.8.3.2
|
2014-01-26 11:50:53 +01:00
|
|
|
|