2016-03-01 01:23:45 +01:00
|
|
|
From dbfad51762956d4bc6c5c5d72cbf0f3a2badde7d Mon Sep 17 00:00:00 2001
|
2014-07-21 22:46:54 +02: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
|
2016-02-29 22:33:06 +01:00
|
|
|
index 519a380..08b14ec 100644
|
2014-07-21 22:46:54 +02:00
|
|
|
--- a/src/main/java/net/minecraft/server/PacketStatusListener.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/PacketStatusListener.java
|
2015-10-07 08:23:59 +02:00
|
|
|
@@ -108,6 +108,13 @@ public class PacketStatusListener implements PacketStatusInListener {
|
2016-02-29 22:33:06 +01:00
|
|
|
}
|
2014-07-21 22:46:54 +02:00
|
|
|
|
2016-02-29 22:33:06 +01:00
|
|
|
ServerPing.ServerPingPlayerSample playerSample = new ServerPing.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()]));
|
2014-07-21 22:46:54 +02:00
|
|
|
|
2016-02-29 22:33:06 +01:00
|
|
|
ServerPing ping = new ServerPing();
|
2014-07-21 22:46:54 +02:00
|
|
|
diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java
|
2015-05-25 21:09:58 +02:00
|
|
|
index e1cc2e0..936c860 100644
|
2014-07-21 22:46:54 +02:00
|
|
|
--- a/src/main/java/org/spigotmc/SpigotConfig.java
|
|
|
|
+++ b/src/main/java/org/spigotmc/SpigotConfig.java
|
2015-05-25 21:09:58 +02:00
|
|
|
@@ -267,4 +267,11 @@ public class SpigotConfig
|
2014-07-21 22:46:54 +02: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 );
|
|
|
|
+ }
|
|
|
|
}
|
|
|
|
--
|
2016-02-29 22:33:06 +01:00
|
|
|
2.5.0
|
2014-07-21 22:46:54 +02:00
|
|
|
|