mirror of
https://github.com/PaperMC/Paper.git
synced 2025-07-31 12:12:08 -07:00
@@ -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 );
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user