19972e09b8
5a0150f586ed3eb15fe6f1f596d1a5a7d806f0f9 Fix ITEM_BREAK e6a3911057bd94d8bd7021cbb4923fb84fb106d1 Upstream merge d1cdcf8d4c3639f956474f02ed662517cffbe23e Remove old patch 068df64aeee368377e1673667bffc7a6dcf90554 Rebuild all patches
44 lines
1.8 KiB
Diff
44 lines
1.8 KiB
Diff
From 4577b3294c5d498feae4d28113347212d7a6a5d1 Mon Sep 17 00:00:00 2001
|
|
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 22749e7..8327d0c 100644
|
|
--- a/src/main/java/net/minecraft/server/PacketStatusListener.java
|
|
+++ b/src/main/java/net/minecraft/server/PacketStatusListener.java
|
|
@@ -100,6 +100,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
|
|
index 345a49c..a0d88ec 100644
|
|
--- a/src/main/java/org/spigotmc/SpigotConfig.java
|
|
+++ b/src/main/java/org/spigotmc/SpigotConfig.java
|
|
@@ -266,4 +266,11 @@ public class SpigotConfig
|
|
{
|
|
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 );
|
|
+ }
|
|
}
|
|
--
|
|
2.1.0
|
|
|