mirror of
https://github.com/PaperMC/Paper.git
synced 2025-03-02 11:22:01 +01:00
Configurable Ping Sample Size
By: md_5 <git@md-5.net>
This commit is contained in:
parent
cd82f21617
commit
23c02d0942
@ -20,7 +20,7 @@
|
||||
|
||||
public class ServerStatusPacketListenerImpl implements ServerStatusPacketListener {
|
||||
|
||||
@@ -36,7 +49,101 @@
|
||||
@@ -36,7 +49,108 @@
|
||||
this.connection.disconnect(ServerStatusPacketListenerImpl.DISCONNECT_REASON);
|
||||
} else {
|
||||
this.hasRequestedStatus = true;
|
||||
@ -108,6 +108,13 @@
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ // Spigot Start
|
||||
+ if ( !server.hidesOnlinePlayers() && !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
|
||||
+ ServerStatus.Players playerSample = new ServerStatus.Players(event.getMaxPlayers(), event.getNumPlayers(), (server.hidesOnlinePlayers()) ? Collections.emptyList() : profiles);
|
||||
+
|
||||
+ ServerStatus ping = new ServerStatus(
|
||||
|
@ -271,4 +271,11 @@ public class SpigotConfig
|
||||
{
|
||||
SpigotConfig.commands.put( "tps", new TicksPerSecondCommand( "tps" ) );
|
||||
}
|
||||
|
||||
public static int playerSample;
|
||||
private static void playerSample()
|
||||
{
|
||||
SpigotConfig.playerSample = SpigotConfig.getInt( "settings.sample-count", 12 );
|
||||
System.out.println( "Server Ping Player Sample Count: " + SpigotConfig.playerSample );
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user